Agent Search and Game Playing 2 1
Agent Search and Game Playing 2 1
Agent Search and Game Playing 2 1
An agent can be anything that perceiveits environment through sensors and act upon that environment through
actuators. An Agent runs in the cycle of perceiving, thinking, and acting.
An agent can be:
Human-Agent: A human agent has eyes, ears, and other organs which work for sensors and hand, legs, vocal tract work for
actuators.
Robotic Agent: A robotic agent can have cameras, infrared range finder, NLP for sensors and various motors for actuators.
Software Agent: Software agent can have keystrokes, file contents as sensory input and act on those inputs and display
output on the screen.
Hence the world around us is full of agents such as thermostat, cellphone, camera, and even we are also agents.
Sensor: Sensor is a device which detects the change in the environment and sends the information to other electronic
devices. An agent observes its environment through sensors.
Actuators: Actuators are the component of machines that converts energy into motion. The actuators are only responsible
for moving and controlling a system. An actuator can be an electric motor, gears, rails, etc.
Effectors: Effectors are the devices which affect the environment. Effectors can be legs, wheels, arms, fingers, wings, fins,
and display screen.
Here are many examples of agents in artificial intelligence. Here are a few:
Intelligent personal assistants: These are agents that are designed to help users with various tasks, such as scheduling
appointments, sending messages, and setting reminders. Examples of intelligent personal assistants include Siri, Alexa, and
Google Assistant.
Autonomous robots: These are agents that are designed to operate autonomously in the physical world. They can perform
tasks such as cleaning, sorting, and delivering goods. Examples of autonomous robots include the Roomba vacuum cleaner
and the Amazon delivery robot.
Gaming agents: These are agents that are designed to play games, either against human opponents or other agents.
Examples of gaming agents include chess-playing agents and poker-playing agents.
Fraud detection agents: These are agents that are designed to detect fraudulent behavior in financial transactions. They can
analyze patterns of behavior to identify suspicious activity and alert authorities. Examples of fraud detection agents include
those used by banks and credit card companies.
Characteristics of an Agent
Hierarchical Agents
• These agents are organized into a hierarchy, with high-level agents overseeing the behavior of lower-level agents.
• The high-level agents provide goals and constraints, while the low-level agents carry out specific tasks.
• Hierarchical agents are useful in complex environments with many tasks and sub-tasks.
Black box model of an artificial agent refers to a type of model or system where the internal workings or processes are not
visible or understandable to the user.
Instead, only the inputs and the corresponding outputs are known and observed.
This concept is widely used in artificial intelligence (AI) and machine learning (ML), where complex algorithms, such as
deep learning networks, often function as black boxes due to their intricate and opaque internal mechanisms.
It's like a black box: you feed data in one end (the input), and you get an output on the other, but the inner workings are a
mystery.
Here's a breakdown of how it works:
Input: The AI system receives data, which could be text, images, numbers, or a combination.
Internal Workings: This is the black box part. Complex algorithms, often based on machine learning or deep learning,
analyze the data and identify patterns. These patterns are what allow the model to make predictions or decisions.
Output: Based on the analysis, the AI system produces an output, such as a classification (is this a cat or a dog in the
image?), a prediction (what will the weather be like tomorrow?), or a recommendation (what product would this
customer be interested in?).
Why are black box models a thing?
• Black box models often achieve very good results, especially in complex tasks like image recognition or spam
filtering.
• They can learn from massive amounts of data and identify patterns that humans might miss.
• This makes them very useful in a variety of applications.
Disadvantages:
Lack of Transparency: This can lead to issues in trust, accountability, and understanding, especially in regulated industries.
Difficulty in Debugging: When these models fail or produce unexpected results, it is challenging to pinpoint the cause of the
problem.
Ethical and Legal Concerns: The opacity of black box models can complicate ethical considerations and legal compliance,
particularly regarding bias and fairness.
In the context of artificial intelligence (AI), searching involves techniques and algorithms that allow an AI system
to navigate through a space of possible solutions to find a goal or optimal answer.
This is a fundamental concept in AI, particularly in problem-solving, decision-making, and planning tasks.
•Completeness: A search algorithm is said to be complete if it guarantees to return a solution if at least any
solution exists for any random input.
•Optimality: If a solution found for an algorithm is guaranteed to be the best solution (lowest path cost) among
all other solutions, then such a solution for is said to be an optimal solution.
•Time Complexity: Time complexity is a measure of time for an algorithm to complete its task.
•Space Complexity: It is the maximum storage space required at any point during the search, as the complexity
of the problem.
Algorithm:
•Step 1:SET STATUS = 1 (ready state) for each node in G
•Step 2:Enqueuethe starting node In a queue and set its STATUS = 2 (waiting state)
•Step 3:Repeat Steps 4 and 5 until QUEUE is empty
•Step 4:Dequeuea node N. Process it and set its STATUS = 3 (processed state).
•Step 5:Enqueueall the neighbours of N that are in the ready state (whose STATUS = 1) and set
their STATUS = 2 (waiting state)[END OF LOOP]
•Step 6:EXIT
•Completeness:
Complete if the goal node is at finite depth.
•Optimality:
It is guaranteed to find the shortest path.
•Time complexity
O(b(d+1)) Where the d= depth of shallowest solution and b is a node at every state.
•Space complexity
O(b(d+1))
•Weakness Suppose we have a tree having branching factor ‘b’
Time and space complexity is higher. (number of children of each node), and its depth ‘d
Algorithm
•Step 1:SET STATUS = 1 (ready state) for each node in G
•Step 2:Push the starting node A on the stack and set its STATUS = 2 (waiting state)
•Step 3:Repeat Steps 4 and 5 until STACK is empty
•Step 4:Pop the top node N. Process it and set its STATUS = 3 (processed state)
•Step 5:Push on the stack all the neighbors of N that are in the ready state (whose STATUS = 1) and set their STATUS = 2
(waiting state)[END OF LOOP]
•Step 6:EXIT
Advantage:
•DFS requires very less memory as it only needs to store a stack of the nodes on the path from root node to the current
node.
•It takes less time to reach to the goal node than BFS algorithm(if it traverses in the right path).
Disadvantage:
•There is the possibility that many states keep re-occurring, and there is no guarantee of finding the solution.
•DFS algorithm goes for deep down searching and sometime it may go to the infinite loop.
Conditions of failure:
•Standard failure value: It indicates that problem does not have any
solution.
•Cutoff failure value: It defines no solution for the problem within a given
depth limit.
Properties :
•Completeness: DLS search algorithm is complete if the solution is
above the depth-limit.
•Time Complexity: Time complexity of DLS algorithm is O(bℓ).
•Space Complexity: Space complexity of DLS algorithm is O(b×ℓ).
•Optimal: Depth-limited search can be viewed as a special case of
DFS, and it is also not optimal even if ℓ>d
f(n)=g(n).
•Were, h(n)= estimated cost from node n to the goal.
Advantages:
•Best first search can switch between BFS and DFS by gaining the advantages of both the algorithms.
•This algorithm is more efficient than BFS and DFS algorithms.
Disadvantages:
•It can behave as an unguided depth-first search in the worst case scenario.
•It can get stuck in a loop as DFS.
•This algorithm is not optimal.
Algorithm:
•Step 1:Place the starting node into the OPEN list.
•Step 2:If the OPEN list is empty, Stop and return failure.
•Step 3:Remove the node n, from the OPEN list which has the lowest value of h(n), and places it in the CLOSED
list.
•Step 4:Expand the node n, and generate the successors of node n.
•Step 5:Check each successor of node n, and find whether any node is a goal node or not. If any successor node is
goal node, then return success and terminate the search, else proceed to Step 6.
•Step 6:For each successor node, algorithm checks for evaluation function f(n), and then check if the node has
been in either OPEN or CLOSED list. If the node has not been in both list, then add it to the OPEN list.
•Step 7:Return to Step 2
Global maximum: It is the best possible state in the state space diagram. This is because, at this stage, the
objective function has the highest value.
Plateau/flat local maximum: It is a flat region of state space where neighboring states have the same value.
Ridge: It is a region that is higher than its neighbors but itself has a slope. It is a special kind of local maximum.
Current state: The region of the state space diagram where we are currently present during the search.
Shoulder: It is a plateau that has an uphill edge.
• Intentionality is the ability to think, feel and act in a deliberate way towards a purpose.
• It is widely believed that intentionality is a common human trait and ability.
• It is less clear whether machines could ever possess such a dimension.
• Most AI is focused on practical problems such as recognizing an image, driving a car or
searching the internet.
• In other words, AI is currently mostly about learning how to answer a question, make a
decision or predict something.
• It isn't about forming high level goals and acting with a purpose.
A game can be formally defined as a kind of search problem with the following
components:
The initial state , which includes the board position and an indication of whose
move it is.
A set of Operators, which define the legal moves that a player can make
A terminal Test, which determines when the game is over. States where the
game has ended are called terminal states.
Payoff function. A utility function (also called a payoff function), which gives a
numeric value for the outcome of a game. In chess, the outcome is a win, lose
or draw, which we can represent by the values +1, -1 or 0. Some games have a
wider variety of possible outcomes; for example, the payoffs in backgammon
range from +192 to -192.
The most common search technique in game playing is Minimax search procedure. It is depth-first depth-limited
search procedure. It is used for games like chess and tic-tac-toe.
Minimax algorithm uses two functions –
MOVEGEN : It generates all the possible moves that can be generated from the current position.
STATICEVALUATION : It returns a value depending upon the goodness from the viewpoint of two-player
Strategies Rules
Plies, Moves and Turns
A strategy is a list of the optimal choices for each player at each stage of a given game.
It is common in game theory to refer to one player's turn as a "ply" of the game.
One round of all the player's turns is called a "move“, this originates in Chess, where one move consists of
each player taking on turn.
There are many more games, however, that treat each player's turn as a separate move and this is the
terminology normally used in turn-based strategy games
• Assume that two players named X (MAX) and 0 (MIN) who are playing the game.
• MAX is playing first.
• Initially MAX has 9 possible moves.
• Play alternates between MAX and MIN until we reach leaf nodes corresponding to
terminal states such that one player has 3 in a row or all squares are filled.