You are on page 1of 88

Introduction

T. Mihoc

Overview and
Historical
Perspective

State space search

Introduction

T. Mihoc1
1 Department of Computer Science

Babeş Bolyai University of Cluj Napoca

20 February 2019
Introduction
Outline
T. Mihoc

Overview and
Historical
Perspective

State space search

Overview and Historical Perspective

State space search


Introduction
Bibliography
T. Mihoc

Overview and
Historical
Perspective

State space search

I Raj Ramesh, What is Artificial Intelligence?


I Vellino, Andre. (1986). Artificial intelligence: The very
idea: J. Haugeland, (MIT Press, Cambridge, MA,
1985); 287 pp.. Artificial Intelligence. 29. 349353.
I Russell, Stuart J., and Peter Norvig. Artificial
intelligence: a modern approach. Malaysia; Pearson
Education Limited,, 2016.
Introduction
What is AI?
T. Mihoc

Overview and
Historical
Perspective

State space search


Definition (according to Encyclopedia Britannica)

Artificial intelligence (AI) is the ability of a digital


computer or computer-controlled robot to perform tasks
commonly associated with intelligent beings. The term is
frequently applied to the project of developing systems
endowed with the intellectual processes characteristic of
humans, such as the ability to reason, discover meaning,
generalize, or learn from past experience.
Introduction
What is Intelligence?
T. Mihoc

Overview and
Historical
Perspective

State space search

I All but the simplest human behaviour is ascribed to


intelligence!
Introduction
What is Intelligence?
T. Mihoc

Overview and
Historical
Perspective

State space search

I All but the simplest human behaviour is ascribed to


intelligence!

I Even the most complicated insect behaviour is never


taken as an indication of intelligence!
Introduction
What is Intelligence?
T. Mihoc

Overview and
Historical
Perspective

State space search

I All but the simplest human behaviour is ascribed to


intelligence!

I Even the most complicated insect behaviour is never


taken as an indication of intelligence!

WHY?
Introduction
What is Intelligence?
T. Mihoc

Overview and
Historical
Perspective

State space search


Human intelligence is characterized not by just one trait but
by the combination of many diverse abilities:

I Learning
Introduction
What is Intelligence?
T. Mihoc

Overview and
Historical
Perspective

State space search


Human intelligence is characterized not by just one trait but
by the combination of many diverse abilities:

I Learning
I Reasoning
Introduction
What is Intelligence?
T. Mihoc

Overview and
Historical
Perspective

State space search


Human intelligence is characterized not by just one trait but
by the combination of many diverse abilities:

I Learning
I Reasoning
I Problem Solving
Introduction
What is Intelligence?
T. Mihoc

Overview and
Historical
Perspective

State space search


Human intelligence is characterized not by just one trait but
by the combination of many diverse abilities:

I Learning
I Reasoning
I Problem Solving
I Perception
Introduction
What is Intelligence?
T. Mihoc

Overview and
Historical
Perspective

State space search


Human intelligence is characterized not by just one trait but
by the combination of many diverse abilities:

I Learning
I Reasoning
I Problem Solving
I Perception
I Language
Introduction
Learning
T. Mihoc

Example: Overview and


a simple method by trial and error based on rote learning Historical
Perspective
I advantages: really easy to implement; State space search

I disadvantages: it may lack generalization;


Introduction
Learning
T. Mihoc

Example: Overview and


a simple method by trial and error based on rote learning Historical
Perspective
I advantages: really easy to implement; State space search

I disadvantages: it may lack generalization;

Generalization
involves applying past experience to analogous new situations
Introduction
Learning
T. Mihoc

Example: Overview and


a simple method by trial and error based on rote learning Historical
Perspective
I advantages: really easy to implement; State space search

I disadvantages: it may lack generalization;

Generalization
involves applying past experience to analogous new situations

Example:
I a program that learns the past tense of regular English
verbs by rote will not be able to produce the past tense
of a word such as jump unless it previously had been
presented with jumped
Introduction
Learning
T. Mihoc

Example: Overview and


a simple method by trial and error based on rote learning Historical
Perspective
I advantages: really easy to implement; State space search

I disadvantages: it may lack generalization;

Generalization
involves applying past experience to analogous new situations

Example:
I a program that learns the past tense of regular English
verbs by rote will not be able to produce the past tense
of a word such as jump unless it previously had been
presented with jumped
I a program that is able to generalize can learn the add
ed rule and so forms the past tense of jump based on
experience with similar verbs
Introduction
Reasoning
T. Mihoc

Overview and
Ability to draw inferences appropriate to the situation! Historical
Perspective

State space search


Introduction
Reasoning
T. Mihoc

Overview and
Ability to draw inferences appropriate to the situation! Historical
Perspective

State space search


I deductive:
Fred must be in either the museum or the café. He is
not in the café; therefore he is in the museum.
Introduction
Reasoning
T. Mihoc

Overview and
Ability to draw inferences appropriate to the situation! Historical
Perspective

State space search


I deductive:
Fred must be in either the museum or the café. He is
not in the café; therefore he is in the museum.
I common in mathematics and logic, where elaborate
structures of irrefutable theorems are built up from a
small set of basic axioms and rules
Introduction
Reasoning
T. Mihoc

Overview and
Ability to draw inferences appropriate to the situation! Historical
Perspective

State space search


I deductive:
Fred must be in either the museum or the café. He is
not in the café; therefore he is in the museum.
I common in mathematics and logic, where elaborate
structures of irrefutable theorems are built up from a
small set of basic axioms and rules
I inductive:
Previous accidents of this sort were caused by
instrument failure; therefore this accident was caused by
instrument failure.
Introduction
Reasoning
T. Mihoc

Overview and
Ability to draw inferences appropriate to the situation! Historical
Perspective

State space search


I deductive:
Fred must be in either the museum or the café. He is
not in the café; therefore he is in the museum.
I common in mathematics and logic, where elaborate
structures of irrefutable theorems are built up from a
small set of basic axioms and rules
I inductive:
Previous accidents of this sort were caused by
instrument failure; therefore this accident was caused by
instrument failure.
I common in science, where data are collected and
tentative models are developed to describe and predict
future behaviour – until the appearance of anomalous
data forces the model to be revised
Introduction
Problem solving
T. Mihoc

Overview and
In AI is a systematic search through a range of possible Historical
Perspective
actions in order to reach some predefined goal or solution.
State space search
Introduction
Problem solving
T. Mihoc

Overview and
In AI is a systematic search through a range of possible Historical
Perspective
actions in order to reach some predefined goal or solution.
State space search
I special purpose – tailor-made for a particular problem
and often exploits very specific features of the situation
in which the problem is embedded
Introduction
Problem solving
T. Mihoc

Overview and
In AI is a systematic search through a range of possible Historical
Perspective
actions in order to reach some predefined goal or solution.
State space search
I special purpose – tailor-made for a particular problem
and often exploits very specific features of the situation
in which the problem is embedded
I general purpose – is applicable to a wide variety of
problems
Introduction
Problem solving
T. Mihoc

Overview and
In AI is a systematic search through a range of possible Historical
Perspective
actions in order to reach some predefined goal or solution.
State space search
I special purpose – tailor-made for a particular problem
and often exploits very specific features of the situation
in which the problem is embedded
I general purpose – is applicable to a wide variety of
problems
Example: means-end analysis: a step-by-step, or
incremental, reduction of the difference between the current
state and the final goal.
Introduction
Problem solving
T. Mihoc

Overview and
In AI is a systematic search through a range of possible Historical
Perspective
actions in order to reach some predefined goal or solution.
State space search
I special purpose – tailor-made for a particular problem
and often exploits very specific features of the situation
in which the problem is embedded
I general purpose – is applicable to a wide variety of
problems
Example: means-end analysis: a step-by-step, or
incremental, reduction of the difference between the current
state and the final goal.
I for a robot the program selects actions from a list {PICKUP, PUTDOWN,

MOVEFORWARD, MOVEBACK, MOVELEFT, MOVERIGHT} until the goal is reached


Introduction
Problem solving
T. Mihoc

Overview and
In AI is a systematic search through a range of possible Historical
Perspective
actions in order to reach some predefined goal or solution.
State space search
I special purpose – tailor-made for a particular problem
and often exploits very specific features of the situation
in which the problem is embedded
I general purpose – is applicable to a wide variety of
problems
Example: means-end analysis: a step-by-step, or
incremental, reduction of the difference between the current
state and the final goal.
I for a robot the program selects actions from a list {PICKUP, PUTDOWN,

MOVEFORWARD, MOVEBACK, MOVELEFT, MOVERIGHT} until the goal is reached

Examples of problems solved: finding the sequence of moves in a


board game, devising mathematical proofs, and manipulating
”virtual objects” in a computer-generated world, ...
Introduction
Perception
T. Mihoc

The environment is scanned and the scene is decomposed Overview and


Historical
into separate objects in various spatial relationships. Perspective

State space search


Introduction
Perception
T. Mihoc

The environment is scanned and the scene is decomposed Overview and


Historical
into separate objects in various spatial relationships. Perspective

State space search


Analysis is complicated because an object may appear
different depending on:
I the angle from which it is viewed
I the direction and intensity of illumination in the scene
I how much the object contrasts with the surrounding
field
Introduction
Perception
T. Mihoc

The environment is scanned and the scene is decomposed Overview and


Historical
into separate objects in various spatial relationships. Perspective

State space search


Analysis is complicated because an object may appear
different depending on:
I the angle from which it is viewed
I the direction and intensity of illumination in the scene
I how much the object contrasts with the surrounding
field
Present: able to identify individuals, autonomous vehicles to
drive at moderate speeds on the open road, and robots to
roam through buildings collecting empty soda cans.
FREDDY (1966–73) - a stationary robot able to recognize a
variety of objects and could be instructed to assemble simple
artifacts, such as a toy car, from a random heap of components
Introduction
Language
T. Mihoc

Overview and
Historical
Perspective

A system of signs having meaning by convention! State space search

An important characteristic of full - fledged human


languages – in contrast to others – is their productivity.

A productive language can formulate an unlimited variety of


sentences.
Introduction
Language
T. Mihoc

Overview and
Historical
Perspective

A system of signs having meaning by convention! State space search

Not necessary a full language, or s spoken one


I traffic signs
I bird calls

An important characteristic of full - fledged human


languages – in contrast to others – is their productivity.

A productive language can formulate an unlimited variety of


sentences.
Introduction
AI methods
T. Mihoc

Overview and
Historical
Perspective

State space search


a very simple classification:

Two distinct methods:


I symbolic (”top-down”) approach – seeks to replicate
intelligence by analyzing cognition independent of the
biological structure of the brain, in terms of the
processing of symbols;
I connectionist (”bottom-up”) approach – involves
creating artificial neural networks in imitation of the
brains structure;
Introduction
Comparison with humans
T. Mihoc

Overview and
Historical
Perspective

State space search


I humans see → computer vision
Introduction
Comparison with humans
T. Mihoc

Overview and
Historical
Perspective

State space search


I humans see → computer vision
I humans hear → speech recognition
Introduction
Comparison with humans
T. Mihoc

Overview and
Historical
Perspective

State space search


I humans see → computer vision
I humans hear → speech recognition
I humans execute tasks, move, ... → robotics
Introduction
Comparison with humans
T. Mihoc

Overview and
Historical
Perspective

State space search


I humans see → computer vision
I humans hear → speech recognition
I humans execute tasks, move, ... → robotics
I humans recognise patterns → Pattern recognition
Introduction
Comparison with humans
T. Mihoc

Overview and
Historical
Perspective

State space search


I humans see → computer vision
I humans hear → speech recognition
I humans execute tasks, move, ... → robotics
I humans recognise patterns → Pattern recognition
I humans recognise objects → Object recognition
Introduction
Comparison with humans
T. Mihoc

Overview and
Historical
Perspective

State space search


I humans see → computer vision
I humans hear → speech recognition
I humans execute tasks, move, ... → robotics
I humans recognise patterns → Pattern recognition
I humans recognise objects → Object recognition
I humans hear and understand language → NLP
...
Introduction
Comparison with humans
T. Mihoc

Overview and
Historical
Perspective

State space search


Introduction
Natural computing
T. Mihoc

Overview and
Historical
Perspective
algorithms that mimic natural phenomena State space search

I birds (/fish) behaviour → Particles Swarm Optimisation

I life evolution → Evolutionary Computation

I ants behaviour → Ant Colony Optimisation

I annealing → Simulated Annealing

...
Introduction
Short History
T. Mihoc

Overview and
Historical
Perspective

State space search


I Birth of AI → 1943 – 1956

I ”Golden Age” → 1956 – 1974

I First Winter → 1974 – 1980

I Boom → 1980 – 1987

I Second Winter → 1987 – 1993

I Meta-modern AI → after 1993


Introduction
Solving a problem
T. Mihoc

Overview and
Historical
Perspective

State space search

Identifying a solution
I in mathematics → optimisation process

I in computer science (AI) → search process


Introduction
Optimisation problems
T. Mihoc
collection of mathematical principles and methods used for
Overview and
solving quantitative problems in many disciplines Historical
Perspective

State space search


Introduction
Optimisation problems
T. Mihoc
collection of mathematical principles and methods used for
Overview and
solving quantitative problems in many disciplines Historical
Perspective
I a single numerical quantity, or objective function, that
State space search
is to be maximized or minimized
Example: the expected return on a stock portfolio, a company’s production costs or

profits, the time of arrival of a vehicle at a specified destination, or the vote share of a political

candidate
Introduction
Optimisation problems
T. Mihoc
collection of mathematical principles and methods used for
Overview and
solving quantitative problems in many disciplines Historical
Perspective
I a single numerical quantity, or objective function, that
State space search
is to be maximized or minimized
Example: the expected return on a stock portfolio, a company’s production costs or

profits, the time of arrival of a vehicle at a specified destination, or the vote share of a political

candidate

I a collection of variables, which are quantities whose


values can be manipulated in order to optimize the
objective
Example: the quantities of stock to be bought or sold, the amounts of various resources

to be allocated to different production activities, the route to be followed by a vehicle through a

traffic network, or the policies to be advocated by a candidate


Introduction
Optimisation problems
T. Mihoc
collection of mathematical principles and methods used for
Overview and
solving quantitative problems in many disciplines Historical
Perspective
I a single numerical quantity, or objective function, that
State space search
is to be maximized or minimized
Example: the expected return on a stock portfolio, a company’s production costs or

profits, the time of arrival of a vehicle at a specified destination, or the vote share of a political

candidate

I a collection of variables, which are quantities whose


values can be manipulated in order to optimize the
objective
Example: the quantities of stock to be bought or sold, the amounts of various resources

to be allocated to different production activities, the route to be followed by a vehicle through a

traffic network, or the policies to be advocated by a candidate

I a set of constraints, which are restrictions on the values


that the variables can take
Example: a manufacturing process cannot require more resources than are available, nor

can it employ less than zero resources


Introduction
Search problems
T. Mihoc

Overview and
Historical
Perspective

State space search

I a single numerical quantity, or objective function

I actions that accomplish the objectives


I each action changes a state of the problem

I more actions that map the initial state of problem into


a final state
Introduction
problem definition
T. Mihoc

I search space Overview and


Historical
I all possible states Perspective
I representation: State space search
I explicit - construction of all possible states
I default - by using some data structures and some
functions (operators)
I one or more initial state
I one or more final states
I one or more paths
I more successive states
I a set of rules (actions)
I successor functions (operators) - next state after a given
one
I cost functions that evaluate:
I how a state is mapped into another state
I an entire path
I objective functions that check if a state is final or not
Introduction
solving the problems by search
T. Mihoc

Overview and
Historical
Perspective

State space search


Aspects to consider:

I Computational complexity (temporal and spatial)

I Completeness → the algorithms always ends and finds a


solution (if it exists)

I Optimallity → the algorithms finds the optimal solution


(the optimal cost of the path from the initial state to
the final state)
Introduction
Search strategies
T. Mihoc

Overview and
Historical
Perspective
I Search space organises similar with an abstract data
State space search
type (ADT)
I ADT list → linear structure
I ADT tree → hierarchic structure
I ADT graph → graph-based structure

I aspects to consider:
I representation
I domain and operations

I types:
I informed search strategies (ISS)
I uninformed search strategies (USS)
Introduction
Uninformed Search strategies
T. Mihoc

Characteristics: Overview and


Historical
I are NOT based on problem specific information Perspective

State space search


I are general
I brute force methods

Topology (based on node exploration):


I USS in linear structures
I linear search
I binary search
I USS in non-linear structures
I Breadth-first search
I Uniform cost search (branch and bound)
I Depth first search
I Limited depth first search
I Iterative deepening depth-first search
I Bidirectional search
Introduction
Search strategies
T. Mihoc

Overview and
Historical
Perspective

State space search


Introduction
Performances’ comparison
T. Mihoc

Overview and
Historical
Perspective

for uninformed Search Strategies State space search


Introduction
Informed search strategies (ISS)
T. Mihoc

Overview and
classification based on topology Historical
Perspective

State space search


I Global search strategies
I Best first search

I Greedy best-first search

I A∗ + versions of A∗

I Local Search strategies

I Hill Climbing

I Simulated Annealing

I Tabu search
Introduction
Informed search strategies (ISS)
T. Mihoc

Overview and
Historical
Perspective

State space search

I Characteristics

I Based on specific information about the problem (trying


to choose ’intelligent’ the nodes to be explored)

I An evaluation (heuristic) function sorts the nodes

I Specific to the problem


Introduction
SS in tree-based structures
T. Mihoc
Basic elements:
Overview and
Historical
I f (n) – evaluation function for estimating the cost of a Perspective
solution through node (state) n State space search

I h(n) – evaluation function for estimating the cost of a


solution path from node (state) n to the final node
(state)
I g (n) – evaluation function for estimating the cost of a
solution path from the initial node (state) to node
(state) n
I f (n) = g (n) + h(n)
Introduction
Heuristic functions
T. Mihoc

Overview and
I Etymology: heuriskein (gr) Historical
Perspective
I to find, to discover
State space search
I study of methods and rules of discovering and invention
I Utility
I Evaluation of the state potential (in the search space)
I Estimation of paths cost from the current state to the
final state
I Characteristics
I Depends on the problem to be solved
I New functions for new problems
I A specific state is evaluated (instead of operators that
map a state into another one)
I Positive functions for each node n
I h(n) ≥ 0 for all states n
I h(n) = 0 for final state
I h(n) = ∞ for a state that is dead end
Introduction
Examples of heuristic functions
T. Mihoc

Overview and
Historical
I Missionary and cannibal problem Perspective

State space search


* h(n) - no of persons from initial river side

I 8-puzzle
* h(n) - no of pieces that are in wrong places
* h(n) - sum of Manhattan distance (of each piece
relative to the final position)

I Travelling salesman problem


* h(n) - nearest neighbour ! ! !

I Pay a sum by using a minimal number of coins


* h(n) choose the coin of best (large) value smaller than
the sum to be paid
Introduction
Best First Search (BFS)
T. Mihoc

Overview and
Historical
Perspective
Basic Elements State space search
I Best first search = first, the best element is processed
I Each state is evaluated by a function f
I The best evaluated state is explored
I Example of a SS that depends on evaluation function:
I Uniform cost search (from USS)
I f = pathcost
I ISSs use heuristic functions
I 2 possible BFS strategies
I Expand the closest node to the objective state
I Expand the best evaluated (best cost) node
Introduction
Best First Search (BFS)
T. Mihoc

function BestFS(elem,list) Overview and


found = false Historical
Perspective
visited = ∅
State space search
toVisit = {start} . FIFO sorted list (priority queue)
while ((toVisit! = ∅)&&(!found)) do
if (toVisit == ∅) then return false
end if
node = pop(toVisit)
visited = visited ∪ {node}
if (node == elem) then found = true
elseaux = ∅
end if
for all unvisited children of node do
aux = aux ∪ {child}
end for
toVisit = toVisit ∪ aux . adding best ones in the front
end while
return found
end function
Introduction
Best First Search (BFS)
T. Mihoc
I Complexity analyse
Overview and
I Time complexity Historical
Perspective
I b - ramification factor
I d - maximal length (depth) of solution State space search
I T (n) = 1 + b 2 + ... + b d ≥ O(b d )
I Space complexity
I S(n) = T (n)
I Completeness
I No - infinite paths if the heuristic evaluates each node
of the path as being the best selection
I Optimality
I Possible - depends on heuristic
I Advantages
I Specific information helps the search
I Good speed to find the final state
I Disadvantages
I State evaluation → effort (computational, physic, etc)
I Some ’bad’ paths could seem to be good
I Applications Web crawler (automatic indexer); games
Introduction
Greedy
T. Mihoc

Overview and
Evaluation function f (n) = h(n) Historical
Perspective
I cost path estimation from the current state to the final State space search

one - h(n)
I cost minimization for the path that must be followed

visited to visit
∅ A
A D, B, C
A, D E, F, G, B, C
A, D, E H, I, F, B, C
A, D, E, H ∅
Introduction
Greedy
T. Mihoc
function Greedy(elem,list)
Overview and
found = false Historical
visited = ∅ Perspective

toVisit = {start} . FIFO sorted list (priority queue) State space search
while ((toVisit! = ∅)&&(!found)) do
if (toVisit == ∅) then return false
end if
node = pop(toVisit)
visited = visited ∪ {node}
if (node == elem) then found = true
else
aux = ∅
end if
for first unvisited child of node do
aux = aux ∪ {child}
end for
toVisit = aux ∪ toVisit . adding best one in the front
according to h(n)
end while
return found
end function
A∗
Introduction

T. Mihoc
Basic Elements
Overview and
Historical
Perspective
I Combination of positive aspects from:
State space search
I Uniform cost search
I Optimality and completeness
I sorted queues
I Greedy Search
I Speed
I Sorted based on evaluation
I Evaluation function f(n)
I Cost estimation of the path that passes though node n
f (n) = g (n) + h(n)
I g (n) - cost function from the initial state to the current
state n
I h(n) - cost heuristic function from the current state to
the final state
I Minimisation of the total cost for a path
A∗
Introduction

T. Mihoc
Example – Knapsack problem
Overview and
Historical
capacity W , n objects o1 o2 o3 o4 Perspective
(o1 , o2 , ..., on ) each of then pi 10 18 32 14 State space search
having a profit pi , i = 1, 2, ..., n Wi 1 2 4 3

Solution: for W = 5 → o1 and


P
I h(n) = pj , for not
o3 selected
P objectsPand
wj ≤ W − wi

Fetch node is a tuple (p, w , p ∗ , f )


where:
I p - profit of selected objects (function
g (n))

I w - weight of selected objects

I p ∗ - maximal profit that can be obtained


starting from the current state and
P
I g (n) = pi , for selected tacking into account the available space
objects oi in the knapsack (function h(n))
A∗
Introduction

T. Mihoc
function BestFS(elem, list)
Overview and
found = false Historical
visited = ∅ Perspective

toVisit = {start} . FIFO sorted list (priority queue) State space search
while ((toVisit! = ∅)&&(!found)) do
if (toVisit == ∅) then return false
end if
node = pop(toVisit)
visited = visited ∪ {node}
if (node == elem) then found = true
else
aux = ∅
end if
for all unvisited children of node do
aux = aux ∪ {child}
end for
toVisit = toVisit ∪ aux . adding a node based on its
evaluation f (n) = g (n) + h(n) (best one in the front of list)
end while
return found
end function
A∗
Introduction

T. Mihoc
I Complexity analyse
Overview and
I Time complexity Historical
Perspective
I b - ramification factor
I dmax - maximal length (depth) of an explored tree State space search
I T (n) = 1 + b + b 2 + ... + b dmax => O(b dmax )
I Space complexity
I d - length (depth) of solution
I T (n) = 1 + b + b 2 + ... + b d => O(b d )
I Completeness: yes
I Optimality:yes
I Advantages
I Expands the fewest nodes of the tree
I Disadvantages
I Large amount of memory
I Applications:
I Planning problems
I Problems of partial sums
I Puzzles
I Optimal paths in graphs
A∗
Introduction

T. Mihoc

I Versions Overview and


Historical
I iterative deepening A* (IDA*) Perspective

I memory-bounded A* (MA*) State space search

I simplified memory bounded A* (SMA*)


I recursive best-first search (RBFS)
I dynamic A* (DA*)
I real time A*
I hierarchical A*
I Bibliography
I 02/AI DA.pdf
I 02/AI DA2 .pdf
I 02/SMAR TA.pdf
I 02/RecursiveBest − FirstSearch.ppt
I 02/IDS.pdf
I 02/IDAM A.pdf
I http://en.wikipedia.org/wiki/IDA*
I http://en.wikipedia.org/wiki/SMA*
Introduction
Topology of search strategies
T. Mihoc
I Solution generation
Overview and
I Constructive search: Solution is identified step by step Historical
Perspective
I Perturbative search: A possible solution is modified in
State space search
order to obtain another possible solution
I Search space navigation
I Systematic search: The entire search space is visited
I Solution identification (if it exists) → complete
algorithms
I Local search
I Moving from a point of the search space into a
neighbour point → incomplete algorithm
I A state can be visited more times
I Certain items of the search
I Deterministic search: identify exactly the solution
I Stochastic search: approximate the solution
I Search space exploration
I Sequential search
I Parallel search
Introduction
Local search strategies (LSS)
T. Mihoc

Overview and
Historical
Perspective

State space search


I Simple local search - a single neighbour state is retained

I Hill Climbing → chooses the best neighbour


I Simulated Annealing → probabilistic-ally chooses the
best neighbour
I Tabu search → retains the recent visited solutions
I Beam local search - more states (population) are
retained
I Evolutionary Algorithms
I Particle swarm optimisation
I Ant colony optimisation
Introduction
Hill climbing (HC)
T. Mihoc
Basic elements
Overview and
I Climbing a foggy mountain by an amnesiac hiker Historical
Perspective
I Continuous moving to better values (larger → mountain State space search

climbing)
I Search advances to improved states until an optimal
one is identified
I How a possible solution is accepted
I Best neighbour of the current solution better than the
current solution
I Improvement by:
I Maximisation of states quality → steepest ascent HC
I Minimisation of states quality → gradient descent HC
I HC 6= steepest ascent/gradient descent (SA/GD)
I HC optimises f (x) with x ∈ R n by changing an element
of x
I SA/GD optimises f (x) with x ∈ R n by changing all the
elements of x
Introduction
Hill climbing (HC) I
T. Mihoc
Example - Construct towers from different geometrical shapes
Overview and
Historical
Perspective

State space search


We have n rectangular pieces stack (on one of two
(of the same width, but supplementary stacks).
different lengths) that are
overlapped in a stack.
Construct a stable tower
from all pieces such that at
each move only a piece is
moved from the top of the

I Solution representation
I State x - vector of n pairs (i, j), where i is the index of
the piece (i = 1, 2, ..., n) and j is the index of the stack
(j = 1, 2, 3)
Introduction
Hill climbing (HC) II
T. Mihoc
Example - Construct towers from different geometrical shapes
I initial state - vector of initial tower Overview and
Historical
Perspective

State space search

I final state - vector of the final tower

I State evaluation
I f1 = no.ofcorrectlylocatedpieces → maximisation
I f2 = no.ofwronglylocatedpieces → minimisation
I f = f1 f2 → maximization
I Neighbourhood
I Possible moves – Move a piece i from stack j1 on stack
j2
I How a possible solution is accepted: Best neighbour of
the current solution better than the current solution
Introduction
Hill climbing (HC)
T. Mihoc
Algorithm
Overview and
Historical
function HC(S) Perspective
x = s1 State space search
x∗ = x
k=0
while (not termination criteria) do
k =k +1
N = all neighbours of x
s = best solution from N
if (f (s) is better than f (x)) then
x =s
else
State
end if
end while
x∗ = x
return x ∗
end function
Introduction
Hill climbing (HC)
T. Mihoc

I Search analyse: convergence to local optima Overview and


Historical
I Advantages Perspective
I Simple implementation → solution approximation State space search
(when the real solution is difficult or impossible to find)
(TSP with many towns)
I Does not require memory (does not come back into the
previous state)
I Disadvantages
I Evaluation function is difficult to be approximated
I If a large number of moves are executed, the algorithm
is inefficient
I If a large number of moves are executed, the algorithm
can block
I in a local optimum
I On a plateau - evaluation is constant
I On a peak - a skip of more steps can help the search
I Applications: Cannibal’s problem, 8-puzzle, 15-puzzle, TSP,
Queens problem, ...
Introduction
Hill climbing (HC)
T. Mihoc
Versions
Overview and
Historical
Perspective

State space search

I Stochastic HC
I The next state is randomly selected

I First-choice HC
I Randomly generation of successors until a new one is
identified
I Random-restart HC → beam local search

I Restart the search from a randomly initial state when


the search does not advance
Introduction
Simulated Annealing
T. Mihoc
Basic elements
Overview and
I Inspired by physical process modelling Historical
I Metropolis et al. 1953, Kirkpatrick et al. 1982 Perspective

I Successors of the current state are randomly selected State space search

I if a successor is better than the current state


I it becomes the new current state
I otherwise is retained with a given probability
I Weak moves are allowed with a given probability p
I escape from local optima
I Probability p = e ∆E /T
I Depends on difference (energy) ∆E
I Is modelled by a temperature parameter T
I The frequency of weak moves and their size gradually
decrease when T is decreasing
I T = 0 → hill climbing
I T → ∞ → weak moves are frequently performed
I Optimal solution is identified only if the temperature
slowly decreases
I How a new possible solution is accepted
Introduction
Simulated Annealing
T. Mihoc
Example: 8-queens problem
Overview and
Historical
Iteration 1 (k = 1) o ∆E = Perspective
f (s2 ) − f (s1 ) = 1 State space search
I Current state x =initial
o P(∆E ) = e −1/100
state o r = rndom(0, 1)
s1 = (8, 5, 3, 1, 6, 7, 2, 4) o if r < P(∆E ) → x =
s2
o f (s1 ) = 1 + 1 = 2
I x∗ =x
I T = 100/1 = 100
I A neighbour of current
state x → queen of line
5 is swapped with queen
of line 7 →
s2 = (8, 7, 3, 1, 6, 5, 2, 4)

o f (s2 ) = 1 + 1 + 1 = 3
Introduction
Simulated Annealing
T. Mihoc
Algorithm
Overview and
Historical
function SA(S) Perspective
x = s1 . initial state State space search
x∗ = x . best solution found until a given moment
k=0 . iteration number
while (not termination criteria) do
k =k +1
generate a neighbour s of x
if f (s) is better than f (x) then
x =s
else
pick a random number r ∈ (0, 1)
if r < P(∆E ) then
x =s
end if
end if
end while
x ∗ = x return x ∗ ;
end function
Introduction
Simulated Annealing
T. Mihoc
I Search analyse
Overview and
I Convergence (complete, optimal) through global optima is slowly Historical
Perspective
I Advantages
State space search
I Statistic-based algorithm → it is able to identified the optimal solution, but it requires

many iterations
I Easy to implement
I Generally, if find a good (global) solution
I Can solve complex problems (with noise and many constraints)

I Disadvantages
I Slowly algorithm convergence to solution takes a long time
I Trade-off between the solutions quality and the time
required to find it
I Depends on some parameters (temperature)
I The provided optimal solution could be local or global
I The solutions quality depends on the precision of variables involved in the algorithm

I Applications
I Combinatorial optimisation problems → knapsack problem
I Design problems → digital circuits design
I Planning problems → production planning, tennis game planning
Introduction
Tabu Search
T. Mihoc
Basic elements
Overview and
I Tabu → things that cannot be touched because they are sacred Historical
Perspective
I Proposed in 1970 by F. Glover
State space search
I Main idea
I starts with a state that violates some constraints and

I Performs changes for eliminating them (the search moves into the best neighbour

solution of the current solution) in order to identify the optimal solution


I Retains:

I Current state
I Visited states and performed moves (limited list of states that must be avoided)

I How a possible solution is accepted


I Best neighbour of the current solution better than the current solution and

un-visited until that moment


I 2 important elements

I Tabu moves (T) determined by a non-Markov process that uses information obtained

during last generations of search process


I Tabu conditions linear inequalities or logical links that depend on current solution

I Influence the selection of tabu moves


Introduction
Tabu Search
T. Mihoc
Algorithm
Overview and
Historical
Perspective
function TS(S)
State space search
Select x ∈ S . S search space
x∗ = x . best solution until a moment
k=0 . iteration number
T =∅ . list of tabu moves
while (not termination criteria) do
k =k +1
generate a subset of solutions in the neighbourhood N − T of
x
choose the best solution s from N − T and set x = s
if f (x) < f (x ∗ ) then
x∗ = x
end if
update T with moves of generating x
end while
return x ∗
end function
Introduction
Tabu Search
T. Mihoc

Overview and
I Stop conditions Historical
Perspective
I Fix number of iterations State space search
I A given number of iterations without improvements
I Sufficient proximity to the solution (if it is known)
I Depletion un-visited elements of a neighbourhood
I Search analyse
I Quickly convergence to global optima
I Advantages
I The algorithm is general and can be easy implemented
I Quickly algorithm (can find in a short time the optimal
solution)
I Disadvantages
I Identify the neighbours in continuous search spaces
I Large number of iterations
I Global optima identification is not guaranteed
Introduction
Tabu Search
T. Mihoc
Example
Overview and
I Statement: pay a sum S by using n coins of values vi , Historical
Perspective
as many as possible (each coin has bi copies)
State space search
I Solution representation:
I State x - vector of n integers x = (x1 , x2 , ..., xn ) with
xi ∈ {0, 1, 2, ..., bi }
I Initial state randomly
I State evaluation:
I f1 = S - total value of selected coins → minimisation
I If the total value of coins > S → penalisation (eg. 500
units)
I f2 = number of selected coins → maximisation
I f = f1 f2 → minimisation
I neighbourhood
I Possible moves
I Including in the sum of j copies of coin i (plus)
I Eliminating from the sum of j copies of coin i (minus)
I Tabu list retains performed moves of an iteration
I - move = the added/eliminated coin
Introduction
Tabu Search
T. Mihoc
Example
Overview and
Historical
Perspective

State space search


S = 500, penalisation = 500, n = 7

S = 500 m1 m2 m3 m4 m5 m6 m7
vi 10 50 15 20 100 35 5
bi 5 2 6 5 5 3 10

Current State Val. f tabu list Neighborhood Moves Val. f


2010021 384 ∅ 2013021 plus4,3 321
2010031 plus6,1 348
0010021 minus1,2 406
2013021 321 plus4,3 2013521 plus5,5 316
2011021 minus4,2 363
2113021 plus2,1 270
plus4,3
2113021 270 plus2,1 ...
Introduction
Tabu Search
T. Mihoc
Example
Overview and
Historical
Perspective

State space search


S = 500, penalisation = 500, n = 7

S = 50 m1 m2 m3 m4 m5 m6 m7
vi 10 50 15 20 100 35 5
bi 5 2 6 5 4 3 10

Current State Val. f tabu list Neighborhood Moves Val. f


2010021 384 ∅ 1014021 minus1,1 , plus4,4 311
2040121 plus3,3 , minus5,1 235
2010426 plus5,4 , plus7,5 450
2040121 235 plus3,3 , minus5,1 2050521 plus3,1 , plus5,4 315
5040521 plus1,3 , plus5,3 399
2240521 plus2,2 , plus5,4 739
plus3,3
2040121 235 minus5,1 ...

Final solution: 4 1 5 4 1 3 10 (f = −28)


Introduction
Tabu Search
T. Mihoc

Overview and
Historical
Perspective

State space search

I Applications
I Determination of three-dimensional structure of proteins
in amino acid sequences
I Traffic optimisation in communication networks
I Planning in production systems
I Network design in optical telecommunication
I Automatic routing of vehicles
I Graph problems (partitioning)
I Planning in audit systems

You might also like