Artificial and Computational Intelligence
Artificial and Computational Intelligence
Artificial and Computational Intelligence
Session 1
Chapter 1: Introduction of Artificial and Computational Intelligence
Contents
(1) What is Artificial Intelligence: Acting Humanly, Thinking humanly, Thinking rationally,
Acting Rationally
(2) Foundations of AI
(3) Brief Overview of Modern AI & Application Domains.
Introduction
Homo sapiens – man the wise.
We have tried to understand how we think.
A.I. is the study of how to make computers do things at which, at the moment, people are
better.
The term was coined in 1956 by John McCarthy at the
Massachusetts Institute of Technology (MIT).
Definition:
Artificial Intelligence is concerned with the design of intelligence in an artificial device.
There are two ideas in the definition.
– Intelligence
– artificial device
Features of Intelligence
Dr. Howard Gardner of Harvard University has, for example, identified 9 intelligences and
speculates that there may be more. He posits that we all possess these intelligences to some
degree but are stronger in some than in others. Recognizing and tapping into our strong
intelligences should therefore enhance our learning.
Bodily/kinesthetic - those who learn best through movement, games, hands-on tasks.
Musical/Rhythmic - those who learn best through music, song, rhythmic chants etc.
Intra personal - those who are in touch with their own feelings, ideas and values.
Inter personal - those who are outgoing and learn better cooperatively in pairs and groups
Naturalist - those who are at one with nature, the outdoors, animals.
Existentialist - those who seek the ‘big picture’ - why we are here and our role in the world.
Artificial Devices
AI operates within artificial devices, which can range from simple programs running on a
computer to complex robotic systems. These devices are designed to process data, analyze
information, and perform tasks autonomously or semi-autonomously.
Examples
– Smartphones
– Chatbots
– Self-Driving Cars
– Game Playing AI
– Robots
– Language Translation Apps
– Recommendation Systems and many more
What is Intelligence?
Intelligence: “ability to learn, understand and think” (Oxford dictionary)
Is it that which characterize humans?
or
Is there an absolute standard of judgement? Accordingly, there are two possibilities:
1. A system with intelligence is expected to behave as intelligently as a human.
2. A system with intelligence is expected to behave in the best possible manner.
Secondly, what type of behavior are we talking about?
1. Are we looking at the thought process or reasoning ability of the system?
2. Or are we only interested in the final manifestations of the system in terms of its
actions?
Different types of Intelligence
Thinking Humanly
The automation of activities that we associate with human thinking, activities such as
decision-making, problem solving, learning..."(Bellman, 1978)
This view is that artificial intelligence is about designing systems that are as intelligent as
humans.
This view involves trying to understand human thought and an effort to build machines that
emulate the human thought process. This view is the cognitive science approach to AI.
The interdisciplinary field of cognitive science brings together computer models from AI and
experimental techniques from psychology to try to construct precise and testable theories
of the workings of the human mind.
Suppose if we ask a person to explain how his brain connects different things during the
thinking process, he/she will probably close both eyes and will start to check how he/she
thinks but he/she cannot explain or interpret the process.
For example – If we want to model the thinking of Roger Federer and make the model
system to compete with someone or against him to play in a tennis game, it may not be
possible to replicate the exact thinking as Roger Federer, however, a good build of
Intelligence systems (Robot) can play and win the game against him.
His famous syllogisms provided patterns for argument structures that always gave correct
conclusions given correct premises. For example, “Socrates is a man; all men are mortal;
therefore Socrates is mortal." These laws of thought were supposed to govern the operation of
the mind, and initiated the field of logic.
Formal logic provides a precise notation and rules for representing and
reasoning with all kinds of things in the world.
Obstacles:
Informal knowledge representation.
Computational complexity and resources
Consider the following setting. There are two rooms, A and B. One of the rooms contains a
computer. The other contains a human.
The interrogator is outside and does not know which one is a computer. He can ask questions
through a teletype and receives answers from both A and B.
The interrogator needs to identify whether A or B are humans.
To pass the Turing test, the machine has to fool the interrogator into believing that it is human.
"The branch of computer science that is concerned with the automation of intelligent behavior"
(Luger and Stubblefield, 1993)
Acting rationally means acting so as to achieve one's goals, given one's beliefs.
The focus is on how the system acts and performs, and not so much on the reasoning process.
A rational agent is one that acts rationally, that is in the best possible manner.
Does not necessarily involve thinking.
An agent is just something that perceives and acts.
For example, pulling one's hand off a hot stove is a reflex action that is more successful than a
slower action taken after careful deliberation.
Advantages:
More general than the “laws of thought” approach.
More amenable to scientific development than human-based
approaches.
Foundations of AI
The foundation of Artificial Intelligence (AI) is built upon several key concepts, principles, and
techniques. Here are some fundamental aspects that form the foundation of AI:
1. Machine Learning (ML): Machine learning is a subset of AI that focuses on the
development of algorithms and models that enable computers to learn from data. This
learning process allows machines to improve their performance on a task over time
without being explicitly programmed.
3. Algorithms: AI algorithms are the instructions or rules that govern the behavior of AI
systems. These can include rule-based systems, decision trees, neural networks, and
various other mathematical models that enable machines to process information and
make decisions.
4. Neural Networks: Neural networks, inspired by the human brain, are a key component
of deep learning, a subset of machine learning. Deep neural networks are particularly
effective in handling complex tasks such as image recognition, natural language
processing, and speech recognition.
5. Natural Language Processing (NLP): NLP is a field of AI that focuses on enabling
machines to understand, interpret, and generate human language. It is essential for
applications such as language translation, sentiment analysis, and chatbots. Test
analysis and speech recognition are two important works in NLP.
6. Computer Vision: Computer vision involves enabling machines to interpret and
understand visual information from the world, including images and videos. Applications
include image recognition, object detection, and facial recognition.
7. Expert Systems: Expert systems are AI programs that mimic the decision-making
abilities of a human expert in a specific domain. These systems use rule-based reasoning
to solve complex problems.
AI Problems
While studying the typical range of tasks that we might expect an “intelligent entity” to perform,
we need to consider both “common- place” asks as well as “expert tasks”.
Common-place tasks
– Recognizing people, objects.
– Communicating (through natural language).
– Navigating around obstacles on the streets
These tasks are done routinely by people and some other animals.
Expert tasks
2. Deep Blue – In 1997, the Deep Blue chess program created by IBM, beat the current
world chess champion, Gary Kasparov.
4. Internet agents – The explosive growth of the internet has also led to growing interest
in internet agents to monitor users' tasks, seek needed information, and to learn
which information is most useful.
5. Autonomous agents –
– In space exploration, robotic space probes autonomously monitor their
surroundings, make decisions and act to achieve their goals.
– Chandrayan 3 soft landing by India the time it takes for a signal to travel from
the Moon to Earth 1.28 seconds. So, the total time from the Moon to Earth and
then from the earth to moon is 2.56 seconds.
6. Sophia – The Hanson created Sophia is an incredibly advanced social- learning robot.
Through AI, Sophia can efficiently communicate with natural language and use facial
expressions to convey human-like emotions.
7. Covera Health – It is utilizing collaborative data sharing and applied clinical analysis to
reduce the number of misdiagnosed patients throughout the world. The company’s
proprietary technology utilizes a framework that combines advanced data science and AI
to sort through existing diagnostics to provide practitioners with more accurate symptom
data when making a decision that will have a major impact on a patient’s life.
9. You can thank AI for the tweets you see on Twitter. The social media giant’s algorithms
suggest people to follow, tweets and news based on a user’s individual preferences.
Additionally, Twitter uses AI to monitor and categorize video feeds based on subject
matter. The company’s image cropping tool also uses AI to determine how to crop
images to focus on the most interesting part.
10. Amazon – Amazon is the king of e-commerce AI. Whether it's the company’s
recommendations on which products to buy, the warehouse robots that grab, sort and
ship products or the web services that power the website itself, Amazon employs AI in
almost every step of its process. Simply put, if you've done anything at all on Amazon in
the last five years, an algorithm has helped you do it.
In 2014 the company introduced its AI-powered voice assistant, Alexa. Inspired by the
computers on Star Trek, Alexa ushered in a wave of powerful, conversation-driven
virtual assistants.
We use the term percept to refer to the agent’s perceptual inputs at any given instant.
An agent’s percept sequence is the complete history of everything the agent has ever perceived in
general.
An agent choice of action at any given instant can depend on the entire percept sequence observed to
date.
An agent’s behavior is described by the agent function that maps any given percept sequence to an
action.
Self-Driving Car
We also have software agents or softbots that have some functions as sensors and some
functions as actuators. Askjeeves.com is an example of a softbot.
Expert systems like the Cardiologist is an agent.
Autonomous spacecrafts are agents.
Intelligent Agent
An Intelligent Agent must sense, must act, must be autonomous (to some extent). It also must be
rational.
AI is about building rational agents.
A rational agent always does the right thing. For each possible percept sequence, a rational
agent should select an action that is expected to maximize its performance measure, given the
evidence provided by the percept sequence and whatever built-in knowledge the agent has.
Rational Action is the action that maximizes the expected value of the performance measure
given the percept sequence to date.
Rationality maximizes expected performance, while perfection maximizes actual
performance.
Following are the main four rules for an AI agent:
Rule 1: An AI agent must have the ability to perceive the environment.
Rule 2: The Observation must be used to make decisions.
Rule 3: Decision should result in an action.
Rule 4: The action taken by an AI agent must be a rational action.
Rationality
Perfect Rationality assumes that the rational agent knows all and will take the action that
maximizes her utility. Human beings do not satisfy this definition of rationality.
However, a rational agent is not omniscient (knowing everything). It does not know the actual
outcome of its actions, and it may not know certain aspects of its environment. Therefore
rationality must take into account the limitations of the agent. The agent has too select the best
action to the best of its knowledge depending on its percept sequence, its background knowledge
Determinism
When a uniqueness in the agent’s current state completely determines the next state of the agent,
the environment is said to be deterministic.
The stochastic environment is random in nature which is not unique and cannot be completely
determined by the agent.
Examples:
Competitive vs Collaborative
An agent is said to be in a competitive environment when it competes against another agent to
optimize the output. The game of chess is competitive as the agents compete with each other to
win the game which is the output.
An agent is said to be in a collaborative environment when multiple agents cooperate to produce
the desired output. When multiple self- driving cars are found on the roads, they cooperate with
each other to avoid collisions and reach their destination which is the output desired.
Single-agent vs Multi-agent
An environment consisting of only one agent is said to be a single- agent environment. A person
left alone in a maze is an example of the single-agent system.
An environment involving more than one agent is a multi-agent environment. The game of
football is multi-agent as it involves 11 players in each team.
Dynamic vs Static
Static Environment: does not change from one state to the next while the agent is considering
its course of action. Example: An empty house is static as there’s no change in the surroundings
when an agent enters.
Dynamic Environment: A Dynamic Environment changes over time independent of the actions
of the agent -- and thus if an agent does not respond in a timely manner, this counts as a choice to
do nothing. Example: A roller coaster ride is dynamic as it is set in motion and the environment
keeps changing every instant.
If the environment itself does not change with passage of time but the agent performance score
does, then we say the environment is semi dynamic.
Example: Chess, when played with clock.
Episodically
An episodic environment means that subsequent episodes do not depend on what actions
occurred in previous episodes.
In a sequential environment, the agent engages in a series of connected episodes.
Continuity
If the number of distinct percepts and actions is limited, the environment is discrete
(Chess playing), otherwise it is continuous (Taxi driving).
Known vs Unknown
In a known environment, the output for all probable actions is given. Obviously, in case of
unknown environment, for an agent to make a decision, it has to gain knowledge about how the
environment works.
Agent Architecture
According to the architecture agents can be classified as follows
Table based agent
Disadvantages
The tables may become very large.
Learning a table may take a very long time, especially if the table is large.
Such systems usually have little autonomy, as all actions are pre-determined.
Subsumption Architecture
• Proposed by Rodney Brooks, 1986.
• Based on reactive systems.
• Brooks notes that in lower animals there is no deliberation, and the actions are based on
sensory inputs. But even lower animals are capable of many complex tasks.
• Subsumption has been widely influential in autonomous robotics and elsewhere in real-
time AI.
• The main features of Brooks’ architecture are:
There is no explicit knowledge representation.
Behavior is distributed, not centralized.
Response to stimuli is reflexive.
The design is bottom up, and complex behaviors are fashioned from the
combination of simpler underlying ones.
Individual agents are simple.
Conclusions
Looking ahead, the horizon for agents is boundless. As technology advances, we can anticipate
even more sophisticated agents reshaping the landscape of industries, making processes more
efficient, and augmenting human capabilities.
References
https://www.geeksforgeeks.org/agents-artificial-intelligence/
• Agents in Artificial Intelligence – GeeksforGeeks
This sequence of actions is called a solution plan. It is a path from the initial state to a goal state.
A plan P is a sequence of actions.
P = {a0, a1, … , aN} which leads to traversing a number of states {s0, s1, … , sN+1 Î G}.
A sequence of states is called a path. The cost of a path is a positive number. In many cases the
path cost is computed by taking the sum of the costs of each action.
Representation of Search Problem
A search problem is represented using a directed graph.
The states are represented as nodes.
The allowed actions are represented as arcs.
Tic-Tac-Toi Game
Traveling in Romania
A solution is a sequence of actions leading from the initial state to a goal state
Search Strategies
A search strategy is defined by picking the order of node expansion.
As per your syllabus I will discuss following uninformed search strategies in this chapter
Breath First Search (BFS)
Uniform cost Search
Depth First Search (DFS)
Depth Limited Search
Iterative Deepening Search
Bidirectional Search
Uninformed search is a class of general-purpose search algorithms which operates in brute
force-way. Uninformed search algorithms do not have additional information about state or
search space other than how to traverse the tree, so it is also called blind search.
Completeness: Uniform-cost search is complete, such as if there is a solution, UCS will find it.
Time Complexity: Let C* is Cost of the optimal solution, and ε is each step to get closer to the
goal node. Then the number of steps is = C*/ε+1. Here we have taken +1, as we start from state
0 and end to C*/ε.
Hence, the worst-case time complexity of Uniform-cost search is O(b1 + [C*/ε])
Space Complexity: The same logic is for space complexity so; the worst-case space complexity
of Uniform-cost search is O(b1 + [C*/ε]).
Optimal: Uniform-cost search is always optimal as it only selects a path with the lowest path
cost.
Advantages: It is optimal.
Disadvantages: It does not care about the number of steps involved in searching and only
concerned about path cost. Due to which this algorithm may be stuck in an infinite loop.
Completeness: DFS search algorithm is complete within finite state space as it will expand
every node within a limited search tree.
Time Complexity: Time complexity of DFS will be equivalent to the node traversed by the
algorithm. It is given by:
T(b)= 1+ b+ b2+ b3 +.........+ bm=O(bm)
Where, m= maximum depth of any node and this can be much larger than d (Shallowest solution
depth) and b = branching factor.
Space Complexity: DFS algorithm needs to store only single path from the root node, hence
space complexity of DFS is equivalent to the size of the fringe set, which is O(bm).
Optimal: DFS search algorithm is non-optimal, as it may generate a large number of steps or
high cost to reach to the goal node.
The depth of each state is recorded as it is generated. When picking the next state to expand, only
those with depth less or equal than the current depth are expanded.
Combination of DFS and BFS.
Expand nodes from the start and goal state simultaneously. Check at each stage if the nodes of
one have been generated by the other. If so, the path concatenation is the solution.
Bidirectional search can use search techniques such as BFS, DFS, DLS, etc.
Heuristic Function
Heuristic is a word from the Greek heuriskein meaning "to discover".
Heuristic Function is a function that estimates the cost of getting from one place to another
(from the current state to the goal state). Also called as simply a heuristic.
Used in a decision process to try to make the best choice of a list of possibilities (to choose the
move more likely to lead to the goal state). The best move is the one with the least cost.
It can also be defined thus as a function that ranks alternatives in search algorithms at each
branching step based on available information to decide which branch to follow.
For example: The problem might be finding the shortest driving distance to a point. A heuristic
cost would be the Straight-Line Distance to the point. The true distance would likely be higher.
Types of Heuristics
There are different types of heuristics that people use as a way to solve
a problem or to learn something.
1. Affect heuristic.
2. Anchoring and adjustment heuristic
3. Availability heuristic
4. Common sense heuristic
5. Familiarity heuristic
6. Representativeness heuristic
Reference: https://examples.yourdictionary.com/examples-of- heuristics.html
Complete?
– Yes (unless there are infinitely many nodes with f ≤ f(G) )
Optimal?
– Yes
– Also optimally efficient:
• No other optimal algorithm will expand fewer nodes, for a given heuristic
Time?
– Exponential in worst case
Space?
– Exponential in worst case
Optimality of A* Search
Heuristic Function
In contrast to the uninformed search, informed search strategies use additional knowledge
beyond what we provide in the problem definition. The additional knowledge is available
through a function called a Heuristic.
Heuristic functions are the heart of any informed search algorithm.
Admissibility of h(s)
Let π be a problem with state space θ and let ℎ be a heuristic function for θ.
We say that ℎ is admissible if, for all 𝑠∈𝑆, we have
ℎ (𝑠) ≤ ℎ*(s)
The function ℎ*(𝑠) corresponds to the real cost of the optimal path from
node 𝑛 to a goal state.
The function ℎ is an optimistic estimation of the costs that occur. It underestimates the real costs
and provides the search algorithm with a lower bound on the goal distance.
The A* algorithm is a classical and probably the most famous example of an informed search
strategy. Given a proper heuristic, A* is guaranteed to find the optimal path between the start
and goal nodes (if such a path exists), and its implementations are usually very efficient in
practice. Other examples of informed algorithms are Best-First Search (BFS), Recursive Best-
First Search (RBFS), and Simplified Memory-bounded A* (SMA*).
Since informed algorithms rely so much on heuristics, it’s crucial to define them well.
But how can we characterize and compare heuristics to decide which one to use?
An obvious criterion for evaluating heuristics is their accuracy. The more heuristic estimates
reflect the actual costs, the more useful the heuristic is. It may seem that the actual cost of the
path from a state to the goal is the ideal heuristic.
However, there’s a price to pay for such high accuracy. The only way to have such a heuristic
is to find the shortest path between and the goal, which is an instance of the original problem.
Highly accurate heuristics usually require more computation, which slows down the search.
Therefore, a good heuristic will make a balance between its accuracy and computational
complexity, sacrificing the former for the latter to some extent.
Since we know N and d, we can compute b. However, we can’t run the algorithm only once and
determine the EBF of b. That’s because the problem instances vary, and the values of N and d
will vary. Further, the algorithm itself may be randomized.
To overcome those issues, we should calculate the EBFs on a random representative sample of
instances.
We can then compute the mean or median score, quantifying the statistical uncertainty with
confidence or credible intervals.
If A* finds a solution at depth 5 using 52 nodes, then the effective branching factor is 1.92.
Experimental measurements of b* on a small set of problems can provide a good guide to the
heuristic’s overall usefulness.
The efficient heuristics will have an EBF close to 1.
Distance between two points are measured along axis at right angle
We see that h2 (s) > h1 (s) since for each misplaced symbol (a number or the empty cell), the
minimal Manhattan distance to the goal position is 1.
Experimentation with A* and random instances should indicate that the average EBF of h2 is
smaller than that of h1.
Since the relaxed problem has more edges in the state space, it’s easier to solve.
The relaxed costs can serve as heuristics for the original problem.
Cost
To solve a 24-puzzle instance, IDA* (Iterative Deepening A*) with Manhattan distance
would take about 65000 years on average.
Assume that each tile moves independently.
In fact, tiles interfere with each other.
According to these interactions is the key to more accurate heuristic functions.
Linear Conflict
Performances
Conclusion
Here, we talked about uninformed and informed search strategies. Uninformed
algorithms use only the problem definition, whereas the informed strategies can also use
additional knowledge available through a heuristic that estimates the cost of the optimal path to
the goal state.
If the heuristic estimates are easy to compute, the informed search algorithms will be
faster than the uninformed. That’s because the heuristic allows them to focus on the promising
parts of the search tree. However, an efficient heuristic isn’t easy to formulate.
References
NPTEL :: Computer Science and Engineering - NOC:An Introduction to Artificial Intelligence
https://archive.nptel.ac.in/courses/106/102/106102220/
By Prof. Mausam
When a goal is found, the path to the goal constitute the solution. But, depending on the
applications, the path may or may not matter.
Which leads to a solution state required to reach the goal node. But beyond these “classical
search algorithms," we have some “local search algorithms” where the path cost does not
matters, and only focus on solution-state needed to reach the goal node.
A local search algorithm completes its task by traversing on a single current node rather than
multiple paths and following the neighbors of that node generally. It is a iterative improvement
algorithm.
Although local search algorithms are not systematic, still they have the following
advantages:
No need to maintain any search tree.
Local search algorithms use a very little or constant amount of memory as they operate
only on a single path.
Most often, they find a reasonable solution in large or infinite state spaces where the
classical or systematic algorithms do not work.
Local Search
• Keep track of the current state
• Move only to the neighboring states
• Ignore paths
“Pure optimization” problems
– All states have an objective function, which we have to optimize.
– Goal is to find state with max (or min) objective value.
– Does not quite fit into path-cost/goal-state formulation.
– Local search can do quite well on these problems.
1. Hill-climbing Search
It is also known as greedy local search. It ends with a local maximum, a global maximum, or can
become stuck with no further progress possible.
Hill-Climbing on 8 queens
Hill-Climbing search
At first sight, a local beam search with k states might seem to be nothing more than running k
random restarts in parallel instead of in sequence.
In fact, the two algorithms are quite different.
In a random-restart search, each search process runs independently of the others.
In a local beam search, useful information is passed among the parallel search threads.
In effect, the states that generate the best successors say to the others,
“Come over here, the grass is greener!”
The algorithm quickly abandons unfruitful searches and moves its resources to where the most
progress is being made.
Local beam search can suffer from a lack of diversity among the k states - they can become
clustered in a small region of the state space, making the search little more than a k-times-
slower version of hill climbing.
A variant called stochastic beam search, analogous to stochastic hill climbing, helps alleviate this
problem.
Instead of choosing the top k successors, stochastic beam search chooses successors with
probability proportional to the successor’s value, thus increasing diversity.
Simulated Annealing
The Simulated Annealing algorithm is based upon Physical Annealing in real life.
Physical Annealing is the process of heating up a material until it reaches an annealing
temperature and then it will be cooled down slowly in order to change the material to a desired
structure.
When the material is hot, the molecular structure is weaker and is more susceptible to change.
When the material cools down, the molecular structure is harder and is less susceptible to
change.
Another important part of this analogy is the following equation from Thermal Dynamics:
This equation calculates the probability that the Energy Magnitude will increase. We can
calculate this value given some Energy Magnitude and some temperature t along with the
Boltzmann constant k.
Simulated Annealing (SA) mimics the Physical Annealing process but is used for optimizing
parameters in a model.
This process is very useful for situations where there are a lot of local minima/maxima such that
algorithms like Gradient Descent would be stuck at.
Each reduction rule reduces the temperature at a different rate and each method is better at
optimizing a different type of model. For the 3rd rule, beta is an arbitrary constant.
Step 3: Starting at the initial temperature, loop through n iterations of Step 4 and then decrease
the temperature according to alpha. Stop this loop until the termination conditions are reached.
The termination conditions could be reaching some end temperature, reaching some acceptable
threshold of performance for a given set of parameters, etc. The mapping of time to temperature
and how fast the temperature decreases is called the Annealing Schedule.
Step 4: Given the neighbourhood of solutions N(s), pick one of the solutions and calculate the
difference in cost between the old solution and the new neighbour solution. The neighbourhood
of a solution are all solutions that are close to the solution. For example, the neighbourhood of a
set of 5 parameters might be if we were to change one of the five parameters but kept the
remaining four the same.
Step 5: If the difference in cost between the old and new solution is greater than 0 (the new
solution is better), then accept the new solution. If the difference in cost is less than 0 (the old
solution is better), then generate a random number between 0 and 1 and accept it if it’s under the
value calculated from the Energy Magnitude equation from before.
In the Simulated Annealing case, the equation has been altered to the following:
Where the delta c is the change in cost and the t is the current temperature.
The P calculated in this case is the probability that we should accept the new solution.
When the temperature is lower, the algorithm is less likely or will not to accept a worse solution.
This promotes Exploitation which means that once the algorithm is in the right search space,
there is no need to search other sections of the search space and should instead try to converge
and find the global maximum.
Advantages
Easy to implement and use.
Provides optimal solutions to a wide range of problems.
Disadvantages
Can take a long time to run if the annealing schedule is very long.
Genetic Algorithm
or
Genetic Algorithms
Genetic algorithms, which work based on Darwin's principle of selection (that is, survival of
the fittest), have been used as optimization tools.
An optimization problem can be a single objective problem or it can be a multi
objective problem.
A single objective optimization problem can be a maximization problem or a minimization
problem.
Multi objective optimization problems are more complex in nature.
t := 0;
Compute initial population p;
WHILE stopping condition not fulfilled DO BEGIN
select individuals for reproduction; create offsprings by crossing individuals; eventually mutate
some individuals; compute new generation.
END
BPMOGA
https://www.elsevier.com/locate/eswa
Background
In last class we have discussed about Genetic Algorithm (GA). It is an optimization algorithm.
Initially proposed by Marco Dorigo in 1992 in his PhD thesis, the first algorithm was aiming to
search for an optimal path in a graph, based on the behavior of ants seeking a path between their
colony and a source of food.
Ants are eusocial insects that prefer community survival and sustaining rather than as individual
species.
They communicate with each other using sound, touch, and pheromone.
Pheromones are organic chemical compounds secreted by the ants that trigger a social response
in members of same species.
Since most ants live on the ground, they use the soil surface to leave pheromone trails that may
be followed (smelled) by other ants. Ants live in community nests and the underlying principle of
ACO is to observe the movement of the ants from their nests in order to search for food in the
shortest possible path.
Initially, ants start to move randomly in search of food around their nests. This randomized
search opens up multiple routes from the nest to the food source.
Now, based on the quality and quantity of the food, ants carry a portion of the food back with
necessary pheromone concentration on its return path.
Depending on these pheromone trials, the probability of selection of a specific path by the
following ants would be a guiding factor to the food source.
Evidently, this probability is based on the concentration as well as the rate of evaporation of
pheromone. It can also be observed that since the evaporation rate of pheromone is also a
deciding factor, the length of each path can easily be accounted for.
If C1 > C2, then the probability of choosing path 1 is more than path 2. If C1 < C2, then Path 2
will be more favorable.
For the return path, the length of the path and the rate of evaporation of the pheromone are the
two factors.
1. Concentration of pheromone according to the length of the path:
Where Li is the length of the path and K is the constant depending upon the length of the path. If
the path is shorter, concentration will be added more to the existing pheromone concentration.
Here parameter v varies from 0 to 1. If v is higher, then the concentration will be less.
In the initialization step of ACO, several key aspects are set up to prepare the algorithm for
solving the optimization problem.
1. Problem Representation: Define how the problem solution will be represented. This
could involve encoding the problem into a suitable format, such as a graph for the
Traveling Salesman Problem (TSP) or a network for the Vehicle Routing Problem
(VRP).
2. Number of Ants: Determine the number of artificial ants that will participate in the
search. Typically, this value is predefined based on problem characteristics and
computational resources. Having more ants can enhance exploration but may increase
computational complexity.
3. Pheromone Initialization: Initialize the pheromonelevels on solution components or
positions. Pheromones represent the amount of chemical substance deposited by ants on
solution components and play a crucial role in guiding the search process. Common
initialization strategies include setting all pheromone levels to a constant value or
randomizing initial pheromone levels.
4. Heuristic Information: Calculate or assign heuristic information to guide ant movement.
Heuristic information provides additional guidance to ants based on problem-specific
knowledge. For example, in the TSP, heuristic information could be the inverse of the
distance between cities.
5. Ant Placement: Randomly place ants on solution components or positions to start the
construction of solutions. Ants are typically distributed evenly across the problem space
to ensure a fair exploration of the solution space.
6. Parameter Initialization: Set other algorithm parameters such as the pheromone
evaporation rate, exploration-exploitation trade-off parameters (e.g., alpha and
beta), and convergence criteria. These parameters influence the behavior of the
algorithm and may need to be tuned through experimentation.
• After a certain number of iterations or upon reaching a termination condition, select the
best solution found by the ants.
• This solution represents the output of the Ant Colony Optimization algorithm and
serves as the optimized solution to the given problem.
Particle Swarm Optimization (PSO)
Chances for getting food is much more when the search is done collectively than individually.
Exploration Vs Exploitation
High C2 – Population converges too fast to the best solution found so far i.e. High Exploitation
High C1 – Each swarm stick to their personal best performance i.e. High Exploration of personal
knowledge
High w – Individual swarm keep exploring the current direction i.e. High Exploration
Required: A balance
Decrease w iteratively. Initially it will do High Exploration then High Exploitation
References
• HK Lum of Kings college
London, University of London
• Greeks for Greeks
Types of Games
Game
S0: The initial state, which specifies how the game is set up at the start.
PLAYER(s): Defines which player has the move in a state.
ACTIONS(s): Returns the set of legal moves in a state.
RESULT(s, a): The transition model, which defines the result of a move.
TERMINAL-TEST(s): A terminal test, which is true when the game is over and false otherwise.
States where the game has ended are called terminal states.
UTILITY(s, p): A utility function (also called an objective function or payoff function), applied
to terminal states, defines the final numeric value for a game that ends in terminal state s for a
player p. In chess, the outcome is a win, loss or draw, with value +1, 0, or 1/2. Some games have
a wider variety of possible outcomes, e.g. In backgammon the payoffs range from 0 to +192.
A zero-sum game is one where the total payoff to all players is the
same for every instance of the game. e.g. Chess, 0+1=1+0=1/2+1/2
Typical Case
2-person game
Players alternate moves
Zero-sum: one player’s loss is the other’s gain
Perfect Information: Both players have access to complete information about the state of the
game. No information is hidden from either player.
The zero-sum assumption allows us to use a single evaluation function to describe the goodness
of a board with respect to both players.
f(n) >> 0: position n good for me and bad for you
f(n) << 0: position n bad for me and good for you
f(n) near 0: position n is a neutral position
f(n) = + infinity: win for me
f(n) = - infinity: win for you
Evaluation function examples
Example of an evaluation function for Tic-Tac-Toe:
f(n) = [# of 3-lengths open for me] - [# of 3-lengths open for you]
where a 3-length is a complete row, column, or diagonal Alan Turing’s function for chess.
f(n) = w(n)/b(n) where w(n) = sum of the point value of white’s pieces and b(n) = sum of
black’s
Most evaluation functions are specified as a weighted sum of position features:
f(n) = w1*feat1(n) + w2*feat2(n) + ... + wn*featk(n)
Example features for chess are piece count, piece placement, squares controlled, etc.
Deep Blue has about 6000 features in its evaluation function
Minimax Procedure
Create start node as a MAX node with current board configuration.
Expand nodes down to some depth of lookahead in the game.
Apply the evaluation function at each of the leaf nodes.
“Back up” values for each of the non-leaf nodes until a value is computed for the root node.
At MIN nodes, the backed-up value is the minimum of the values associated with its
children.
At MAX nodes, the backed-up value is the maximum of the values associated with its
children.
Pick the operator associated with the child node whose backed-up value determined the value at
the root.
Properties of Minimax
Complete? Yes (if tree is finite)
Optimal? Yes (against an optimal opponent)
Time complexity? O(bm)
Space complexity? O(bm) (depth-first exploration)
Search can be stopped below any MAX node having an alpha value greater than or equal
to the beta value of any of its MIN ancestors.
Each wi is a weight and each fi is a feature of the position. For chess, the fi could be the numbers of
each kind of piece on the board (i.e. feature), and wi could be the values of the pieces (1 for pawn, 3
for bishop, etc.).
Adding up the values of features in fact involves a strong assumption (that the contribution of each
feature is independent of the values of the other features), thus current programs for games also use
nonlinear combinations of features.
Deep Blue has about 6000 features in its evaluation function.
Let us assume we have implemented a minimax search with a reasonable evaluation function for
chess, and a reasonable cutoff test with a quiescence search.
With a well-written program on an ordinary computer, one can probably search about 1000
positions a second. How well will our program play?
In tournament chess, one gets about 150 seconds per move, so we can look at 150,000 positions.
In chess, the branching factor is about 35, so our program will be able to look ahead only three
or four ply, and will play at the level of a complete novice! Even average human players can
make plans six or eight ply ahead, so our program will be easily fooled.
Fortunately, it is possible to compute the correct minimax decision without looking at every node
in the search tree. The process of eliminating a branch of the search tree from consideration
without examining it is called pruning the search tree. The particular technique we will examine
is called alpha-beta pruning. When applied to a standard minimax tree, it returns the same
move as minimax would, but prunes away branches that cannot possibly influence the final
decision.
Effectiveness: If we assume that this can be done, then it turns out that alpha-beta only needs to
examine O(bd/2) nodes to pick the best move, instead of O(bd) with minimax. This means that the
effective branching factor is √b instead of b - for chess, 6 instead of 35.
Put another way, this means that alpha-beta can look ahead twice as far as minimax for the same
cost. Thus, by generating 150,000 nodes in the time allotment, a program can look ahead eight
ply instead of four. By thinking carefully about which computations actually affect the decision,
we are able to transform a program from a novice into an expert.
Forward Pruning: Some moves at a given node are pruned immediately without further
consideration.
PROBCUT (probabilistic) algorithm: A forward-pruning version of alpha-beta search that uses
statistic gained from prior experience to lessen the chance that the best move will be pruned.
Chess has received by far the largest share of attention in game playing. In speed chess,
computers have defeated the world champion, Gary Kasparov. Figure shows the ratings of
human and computer champions over the years.
Progress beyond a mediocre level was initially very slow: some programs in the early 1970s
became extremely complicated, with various kinds of tricks for eliminating some branches of
search, generating plausible moves, and so on, but the programs that won the ACM North
American Computer Chess Championships (initiated in 1970) tended to use straightforward
alpha beta search, augmented with book openings and infallible endgame algorithms.
The first real jump in performance came not from better algorithms or evaluation functions, but
from hardware. Belle, the first special- purpose chess computer (Condon and Thompson, 1982),
used custom integrated circuits to implement move generation and position evaluation, enabling
it to search several million positions to make a single move. Belle's rating was around 2250, on
a scale where beginning humans are 1000 and the world champion around 2750; it became the
first master-level program.
The HITECH system, also a special-purpose computer, was designed by former world
correspondence champion Hans Berliner and his student Carl Ebeling to allow rapid calculation
of very sophisticated evaluation functions. Generating about 10 million positions per move and
using probably the most accurate evaluation of positions yet developed, HITECH became
computer world champion in 1985, and was the first program to defeat a human grandmaster,
Arnold Denker, in 1987. At the time it ranked among the top 800 human players in the world.
AI-Game & Optimal decisions in games & Imperfect real-time decisions & Partially