Artificial Intelligence — Agents and Environments

Shafi
DataDrivenInvestor
Published in
10 min readFeb 8, 2021

--

Understand Agents (Bots, Robots, Programs) and Environment (working place).

  1. Why Agents and Environments?
  2. Agents
  3. Environment
  4. Examples of Agents and Environment
  5. Conclusion

Agent and Environment are two pillars in Artificial Intelligence, our aim is to build intellectual agents and work in an environment. If you consider broadly agent is the solution and environment is the problem.

In simple terms, even starter or researcher can understand that and is defined Agent as game and Environment as ground.

Defining both agent and an environment with several examples , so that the reader may get attention and its contexts. Agents and Environments are not so simple. There are types that exist in both cases, below diagram summarizes these.

Before we start let us define few terms which will come across in the entire article.

Perception: what agent see the environment.

Perception history: It is the history of perception which comes in a specific period.

Actuators : A mechanism that puts something into action.

Effectors: Agents organs (hands and legs) that becomes active.

Types of Agents and Environments

It is better to refer to more 1st and 2nd chapters in A Modern Approach by Stuart Russell, Peter Norvig. Now we define types of agents and environments in an easy way to understand by the newbie or starter in AI. While defining the above we will come across other concepts which we will come across in different applications or domains.cc

Environment is the place where the agent is going to work. In general, Environment gives possible rewards, states, actions to the agents.

Task environments in AI obviously vast. We identify a small number of dimensions along which task environments can be categorized. Understand environments is required to understand AI.

If an agent’s Sensors give it access to the complete sate of the Environment at each point in time, then we say that the task environment is fully observable.

An Environment is Partially Observable due to noise and inaccurate sensors or because parts of the state are simply missing from the sensor data.

If the agent has no sensors at all then the Environment is Unobservable

Only one agent participates in the environment is Single Agent. More than one agent interact the with the environment is Multi Agent.

If one agent (entity) maximizing its performance over the other agent (entity) in the environment is Competitive Multi-Agent Environment. An agent can be treated based on physical laws (behave on Physical Laws).

Avoiding collisions maximizing the performance measure of all the agents, so, it is partially cooperative multi-agent environment.

If the next state of the environment is completely determined by the current state & the action executed by the agent, then we say the environment is deterministic, otherwise it is stochastic.

In a multi-agent environment, Uncertainty arises purely from the actions of other agents. In deterministic, actions of other agents unable to predict by any other agent (each agent).

An environment is Uncertain if it is not fully observable or Not Deterministic. Non-deterministic Environment is one in which actions are characterized by their possible outcomes, but no probabilities are attached to them.

Where as Stochastic generally implies that uncertainty about outcomes is quantified in terms of Probabilities. Nondeterministic environment descriptions are usually associated with performance measured that require the agent to succeed for all possible outcome of its actions.

In an Episodic environment, agent’s experience is divided into atomic episodes. In each episode agent receives a percept and then performs a single action. Next episode does not depend on the actions taken in previous episodes. Many Classification tasks are Episodic.

In Sequential environments, the current decision could affect all future decisions. Episodic environments are much simpler than sequential because agent that does not need to think ahead.

Static environments are easy to handle because the agent need not keep looking at the world. While deciding on an action, nor need it worry about the passage of time.

If the environment can change while an agent is deliberating, then we say that the environment is Dynamic for that agent;Otherwise environment is Static.

Dynamic environments are continuously asking the agent what it wants to do, If it has not decided yet,that counts as deciding to do nothing.

Semi-Dynamic Environments: If the environment itself does not change with the passage of time but the agent’s performance score does, then environment is Semi-Dynamic.

In these 2 distinct environments applies to the state of the environment, to the way time is handled, and to the percepts and actions of the agent. Chess-Discrete, Continuous — Autonomous vehicle driving.

These two are specially refers to environment itself not to agent; If a known environment, the outcomes for all actions are given. If the environment is unknown, the agent will have to learn how it works in order to make good decisions. These environments are the good examples of Exploitation (Known Environment) and Exploration (Unknown Environment) which come in Reinforcement Learning.

Agent is the solution to our problem. Agent needs Intelligence that what AI provides to work in Environment. Every Agent has to perform its own Agent Program, Agent Function , Mapping from Percept into Action. The below diagram describes this.

Operations of an Agent : Agent Program,Agent Function are the operations.

Agent Program : It runs on some sort of computing device with physical sensors and actuators — call this as the Architecture.

Structure of Agents

Therefore Agent = Architecture + Program ; Obviously , program should appropriate for the architecture. Example for Programs action and architecture is shown below.

Architecture makes the percepts from the sensors available to the program, runs the program and feeds the program’s action choices to the actuators as they are generated. Let us discuss Agent side concepts.

Agent Program structure takes the current percept as input from the sensors and return an action to the actuators.

Relation among the components of an agent and environment
Structure of Agent Program

The agent program takes the current percept as input because nothing more is available from the environment.

The Agent function which takes the entire percept history as input. The difference between the agent program, which takes the current percept as input and agent function which takes the entire percept history.

There are four basic kinds of agent programs that embody the principles underlying almost all intelligent systems. They are Simple reflex agents, Model-based reflex agents, Goal-based agents and Utility-based agents. Each agent program combines particular components in particular way to generate actions.

It is the simplest agent, where as these agents directly select action from perception and ignoring the perception history. Simple reflex behaviors occur even in more complex environments. Let us define Condition-Action rule.

Condition Action Rule : It is connection and defined is as “Processing on the visual input to establish the condition, then it triggers in the agent program to the action. This connection is called “Condition-Action Rule”. Schematic diagram of a simple reflex agent defined as follows

Depicts how condition-action rule allow the Simple reflex agent to make the connection from percept to action

When the agent partially observe the environment, agent needs to keep track of the part of the world it can’t see now. i.e., agent should maintain some sort of internal state , which depends on the perception history and unobserved aspects of the current state. i.e in pictorially it is defined as

Update Internal state : It requires 2 kinds of knowledge to encoded in the agent program.

Model: The knowledge “How the world works” Whether implemented in simple boolean circuits or in complete scientific theories is called the Model of the World. An agent that uses such a model is called a Model-Based-Agent.

So, Current State = Old Internal State + Current Percept

Structure of the Model-based Reflex Agent

Structure of Model Reflex agent

The agent needs some sort of goal information which describes situations that are desirable.

Search & Planing are the sub-fields of AI that achieve the Agent’s goal. The goal-based agent’s behavior can easily be changed to go to a different destination, simply by specifying the destination as the Goal. Goal-based agent structure is defined as

Structure of Goal-based Agent

Goals provide a distinction between Happy & Unhappy states specifying with “happy” & “unhappy states”. Specifying happy & unhappy does not mean scientifically, economists & computer scientists use the term “Utility”.

An agent’s Utility function is described as an internalization of the performance measure.

Goal-based agents and Utility-based agents has many advantage in terms of flexibility and learning. Utility agents make rational decisions when goals are inadequate 1) The utility function specifies the appropriate trade off. 2) Utility provides likelihood of success can be weighted against the importance of the goals.

A rational utility-based agent chooses the action that maximizes the expected utility of the actions outcomes. The structure of the Utility-based agent structure is described as follows.

It is Model-based, Utility-based agent

Examples of Agents and Environments are many due to their contexts,applications and necessity. Possible and well known agents and environments listed in the below diagram.

Simple agents and environments

Agents and Environments are compulsory to understand before we develop any kind of Intelligent Agent for our applications. In order to design any Intellectual Agent based on the environment , it is necessary to understand what type of agent need to build, what it requires, what kind of equipment,etc., It is better to refer to more 1st and 2nd chapters in A Modern Approach by Stuart Russell, Peter Norvig..

Thanks for reading my article and appreciate your feedback, comments and share.

References :

This article is based on the 2nd chapter in Artificial Intelligence: A Modern Approach by Stuart Russell, Peter Norvig.

--

--

Researcher & Enthusiast in AI, Quantum Computing, and Astrophysics.