SlideShare a Scribd company logo
1 of 55
Download to read offline
Search and Optimization Strategies
Tecniche di Programmazione – A.A. 2012/2013
Summary
A.A. 2012/2013Tecniche di programmazione2
 Definitions
 Branch & Bound
 Greedy
 Local Search
Definitions
Search and Optimization Strategies
Search vs Optimization
A.A. 2012/2013Tecniche di programmazione4
 A search algorithm is an algorithm for finding an item
with specified properties among a collection of items
 Specified properties: usually “local” properties, defined by some
“feasibility” criteria
 Collection: explicit, or virtual (implicit)
 An optimization algorithm aims ad finding the best
possible solution, according to an objective function,
among all possible feasible solutions for a given
problem
Objective function
A.A. 2012/2013Tecniche di programmazione5
 Must be computable for all feasible solutions
 May be undefined for unfeasible (or incomplete) solutions
 Maximization problems
 Objective function = value, goodness
 Must find the maximum value of objective function
 Minimization problems
 Objective function = cost
 Must find the minimum value of objective function
A.A. 2012/2013Tecniche di programmazione6
Types of problems
 Search problems: is there (at least one) feasible solution?
 Ex: magical square
 Ex: Hamiltonian cycle
 Optimization problems: what is the best solution?
 In these problems finding feasible solutions is usually easy
 Ex: Hamiltonian cycle on a complete graph (Hamiltonan bee)
 Hybrid problems (search + optimization): are there any valid
solutions? And what is the best?
 Ex: travelling salesman problem
A.A. 2012/2013Tecniche di programmazione7
Representation
S: Solutions
V:Valid (feasible) solutions
M: best solutions
s
s
s
f(s)
Objective
function
A.A. 2012/2013Tecniche di programmazione8
Classification
 Search problems
 S V
 |V| = 0 ?
 Find a s V
 Optimization problems
 S =V
 find max(f(s))
 Hybrid problems
 S V
 find max(f(s))
 such that s V
Exact techniques
A.A. 2012/2013Tecniche di programmazione9
 Exhaustive generation of all possible solutions
 Iteratively
 Recursively
 Optimizing recursive techniques
 Visit order
 Generate non-useless solutions: Branch and Bound
 Recognize equivalent sub-problems: Dynamic Programming
1 2
3 4
5 6
7 8
Approximate Tecniques
A.A. 2012/2013Tecniche di programmazione10
 Greedy
 Pseudo-random
 Hill climber
1
2
3
Approximate solutions
A.A. 2012/2013Tecniche di programmazione11
 Optimum solution: the absolute best
 Optimal solution: a solution that
 approximates the optimum one (might be coincident, but we
don’t know)
 can no longer be improved with the chosen optimization
technique
 Locally optimum solution: optimum solution in a
continuous domain
Intuitively…
A.A. 2012/2013Tecniche di programmazione12
x
f(x)
Optimum
solution
Optimal
solution
Locally
optimum
solutions
Computational Intelligence
A.A. 2012/2013Tecniche di programmazione13
 Evolutionary Algorithms
 Genetic Algorithms
 Genetic Programming
 Simulated annealing
 Tabu-Search
Branch & Bound
Search and Optimization Strategies
A.A. 2012/2013Tecniche di programmazione15
Introduction
 Branch and Bound is an exact method for exploring all
solutions based on their implicit enumeration
 All solutions are considered, but not one-by-one. In fact
B&B:
 Considers disjoints subsets of solutions (branching)
 Evaluates them according to an estimate of the objective
function (bounding), by eliminating (pruning) those subsets that
may not contain the optimum solution
A.A. 2012/2013Tecniche di programmazione16
Definition
 z*: a sub-optimal estimate of the final result
 Initialized to + for minimization problems
 Initialized to - for maximization problems
 z(r)
E : the exact solution of sub-problem P(r)
 z(r)
B: a super-optimal estimate of solutions of sub-problem
P(r)
 lower bound for minimization problems
 upper bound for maximization problems
A.A. 2012/2013Tecniche di programmazione17
General algorithm (I)
 Branch-and-bound is a divide-et-impera method:
 Divide a given problem (and its set of feasible solutions) in sub-
problems to be analyzed separately.
 Keep a list P of open sub-problems
 At each step, select one current problem P(r)
General algorithm (II)
A.A. 2012/2013Tecniche di programmazione18
 If P(r) has no feasible solutions, it is closed
 If P(r) has (at least one) solution, and may be solved up to
the optimum z(r)
E
 P(r) is closed
 Its solution, with value z(r)
E, may possibly replace z*, if it
improves it
General algorithm (III)
A.A. 2012/2013Tecniche di programmazione19
 Se P(r) has solutions, but it’s difficult to be solved up to
the optimum, we try to show that it may not yield a
better solution than the already known ones.
 We compute a super-optimal estimate z(r)
B of its solutions:
 If z(r)
B is not better than z*, all solutions in P(r) are dominated
by the best known-solution, and P(r) may be closed
 If z(r)
B is better than z*, P(r) is broken into sub-problems that
are inserted in the list P. P(r) is closed, and the sub-problems
will be opened, eventually.
General algorithm (IV)
A.A. 2012/2013Tecniche di programmazione20
 Proceed until P is empty
 When P is empty, then z* is the exact optimum solution
for the original problem.
The solution tree
A.A. 2012/2013Tecniche di programmazione21
P0
P1 P2
P21 P22
P11 P12
P111 P112
P12
Node: sub-problem
Leaf node: closed sub-problem
Ingredients of a B&B algorithm
A.A. 2012/2013Tecniche di programmazione22
 Strategy of visit of the search tree: criteria to choose the
next sub-problem to be analyzed out of the list P
 Bounding technique: how to evaluate the super-optimal
estimate z(r)
B
 Branching rule: how to split the current problem P(r) into
smaller sub-problems.
Main features
A.A. 2012/2013Tecniche di programmazione23
 Advantages:
 Finds optimum solution
 May limit the number of visited solutions
 May give a partial (approximate) solution, if stopped earlier
 Disadvantages:
 Computation time for visiting the solution tree depends on the
strategy
 The worst case is to visit all possible nodes, anyway
 Time needed to compute z(r)
B.
Greedy
Search and Optimization Strategies
A.A. 2012/2013Tecniche di programmazione55
Introduction
 A greedy algorithm searches for a globally optimal
solution, by choosing locally optimum ones.
 The adopted technique is shortsighted:
 Every choice made at any step is never re-considered again
 No back-tracking
 Basic principle: define an “attractiveness” for every partial
solution
 Attractiveness (it: appetibilità) = estimate of how much, probably,
we are close to the optimum.
General structure (I)
A.A. 2012/2013Tecniche di programmazione56
 If the attractiveness {ai} of partial solutions are known
since the beginning, and may not be modified
Greedy ({a1, a2, …an})
S  ø
sort {ai} in decreasing attractiveness order
for each ai do
if ai may be added to S
then S  S  {ai}
return S
General structure (II)
A.A. 2012/2013Tecniche di programmazione57
 If attractiveness may be modified by the effects of
previous choices
Greedy2 ({a1, a2, …an})
S  ø
compute attractiveness of ai
while there are element to choose do
choose the most-attractive ai
if ai may be added to S
then S  S  {ai}
update the remaining ai
return S
Example
A.A. 2012/2013Tecniche di programmazione58
 Find the minimum number of coins to give change to a
customer.
 We assume we have a list of possible coin values, and
their availability is infinite
A.A. 2012/2013Tecniche di programmazione59
Example
 Available coins
 20, 10, 5, 2, 1
 Change to give
 55
A.A. 2012/2013Tecniche di programmazione60
Algorithm
 At each step, select the highest-valued coin, whose value
is less than the remaining change
Remaining change Chosen coin
55 20
35 20
15 10
5 5
A.A. 2012/2013Tecniche di programmazione61
Features
 Advantages
 Extremely simple algorithm
 Very fast computational time
 Disadvantages
 The solution is optimal, non necessarily optimum
Non-optimum solution
A.A. 2012/2013Tecniche di programmazione62
 Input:
 Coins of 6, 4, 1
 Change to give:
 9
 Greedy solution:
 4 coins: 6, 1, 1, 1
 Optimum solution :
 3 coins: 4, 4, 1
Local Search
Search and Optimization Strategies
Applicability
A.A. 2012/2013Tecniche di programmazione72
 Suitable for problems where:
 There is an underlying “structure” in the solution space
 There is a clear objective function
 The search space is too vast
 Exact algorithms are not knows
 “Similar solutions have similar cost”
Iterative improvement
A.A. 2012/2013Tecniche di programmazione73
 A family of methods
 Common basic idea
 Start from an initial (random) configuration
 Consider various possible moves starting from that configuration
 Accept or refuse such moves, depending on the objective function
 When you cannot improve anymore, start again
A.A. 2012/2013Tecniche di programmazione74
Example
Moves
A.A. 2012/2013Tecniche di programmazione75
 We must define a set of moves to lead from one
solution to another
 The set of possible moves defined the neighborhood of
a solution
 Moves are often implemented as small variations
(mutation) on the encoded solution
A.A. 2012/2013Tecniche di programmazione76
Example: TSP (I)
“2-opt”neighborhood
A.A. 2012/2013Tecniche di programmazione77
Example: TSP(II)
3-opt neighborhood
Hill Climbing (I)
A.A. 2012/2013Tecniche di programmazione78
 For every configuration, evaluate all possible moves
 (explore the whole neighborhood)
 Refuse all moves that worsen the objective function
 Accept the move that leads to the highest improvement
of the objective function
 If all moves worsen the objective function, quit.
A.A. 2012/2013Tecniche di programmazione79
Hill Climbing (II)
X = startinc configuration
E = eval(X)
do {
N = n_moves(X)
for (i=0; i<N; ++i)
Ei = eval(move(X,i))
if (all Ei  E)
return X
i* = { i | max(Ei) }
X = move(X, i*)
E = Ei*
} while(1)
Features
A.A. 2012/2013Tecniche di programmazione80
 Greedy
 Simple to implement
 No backtracking => no recursion, no memory
 Needs “clever” definition of moves
 Sometimes, the objective function may be incrementally
computed
A.A. 2012/2013Tecniche di programmazione81
Problems (I)
 Foothill: getting trapped in local maxima
Hillclimber final point
Start
Real maximum
A.A. 2012/2013Tecniche di programmazione82
Problems (II)
 Mesa: wide regions with null or negligible variation of the
objective function
 Needle in the haystack: isolated peak in a desolated
landscape
A.A. 2012/2013Tecniche di programmazione83
Variants
 First-ascent
 Accept the first move that improves the objective function
 Best-ascent
 Evaluate all moves and accept the best one
 Threshold-accept
 Accept the first move that improves the current configuration by an
amount higher that a fixed threshold
 …etc…
A.A. 2012/2013Tecniche di programmazione84
Example
111 fitness 10
011 fitness 12
101 fitness 20
110 fitness 5
First ascent
Best ascent
011 fitness 12
101 fitness 20
Neighborhood definition:
‘complement one bit’
A.A. 2012/2013Tecniche di programmazione85
Random Restart Hill Climbing
 Repeat the Hill Climbing procedure starting from many initial
starting points
X = random configuration
Best = X
do {
X’ = HillClimber(X)
if (Eval(X’) > Eval(Best))
Best = X’
X = random configuration
} while( ! Enough )
A.A. 2012/2013Tecniche di programmazione86
Simulated Annealing
 Stochastic approach for function minimization
 The name is taken from the physical process of
crystallization of a liquid into solid state
 The minimum of the cost function corresponds to the
crystal state of the substance (minimum energy)
 Simulated Annealing gradually “lowers” the “temperature”
until the system “freezes”
A.A. 2012/2013Tecniche di programmazione87
Algorithm (I)
 Start with a random solution
 Choose a solution in the neighborhood
 If the energy of the new solution is less than the current one,
accept the move
 If the energy is more than the current one, the move may be
accepted, with a probability
 The probability to accept “bad” moves depends on
 Amount of worsening (DE)
 Temperature (simulated) of the system
A.A. 2012/2013Tecniche di programmazione88
Algorithm(II)
current = start state
for time = 1 to forever do
T = schedule[time]
if T = 0 return current
next = a randomly chosen successor of current
dE = value(next) – value(current)
if dE > 0 then current = next
else current = next with probability edE/T
end for
A.A. 2012/2013Tecniche di programmazione89
Features
 The system may “jump out” of local minima by accepting
worse solutions
 At higher temperatures, worsening jumps are easier, at
lower temperature they become unlikely
 Temperature is gradually reduced
 At T=0, the algorithm converges to the locally optimum
solution (hill climbing behavior)
A.A. 2012/2013Tecniche di programmazione90
Boltzmann distribution
dE
P(accettazione)
1T=max
T=0
Other local search algorithms
A.A. 2012/2013Tecniche di programmazione91
 Tabu Search
 Ant Colony
 Genetic Algorithms
Resources
A.A. 2012/2013Tecniche di programmazione92
Licenza d’uso
A.A. 2012/2013Tecniche di programmazione93
 Queste diapositive sono distribuite con licenza Creative Commons
“Attribuzione - Non commerciale - Condividi allo stesso modo (CC
BY-NC-SA)”
 Sei libero:
 di riprodurre, distribuire, comunicare al pubblico, esporre in pubblico,
rappresentare, eseguire e recitare quest'opera
 di modificare quest'opera
 Alle seguenti condizioni:
 Attribuzione — Devi attribuire la paternità dell'opera agli autori originali
e in modo tale da non suggerire che essi avallino te o il modo in cui tu
usi l'opera.
 Non commerciale — Non puoi usare quest'opera per fini commerciali.
 Condividi allo stesso modo — Se alteri o trasformi quest'opera, o se la
usi per crearne un'altra, puoi distribuire l'opera risultante solo con una
licenza identica o equivalente a questa.
 http://creativecommons.org/licenses/by-nc-sa/3.0/

More Related Content

What's hot

352735326 rsh-qam11-tif-05-doc
352735326 rsh-qam11-tif-05-doc352735326 rsh-qam11-tif-05-doc
352735326 rsh-qam11-tif-05-docFiras Husseini
 
Nonlinear Programming: Theories and Algorithms of Some Unconstrained Optimiza...
Nonlinear Programming: Theories and Algorithms of Some Unconstrained Optimiza...Nonlinear Programming: Theories and Algorithms of Some Unconstrained Optimiza...
Nonlinear Programming: Theories and Algorithms of Some Unconstrained Optimiza...Dr. Amarjeet Singh
 
352735352 rsh-qam11-tif-09-doc
352735352 rsh-qam11-tif-09-doc352735352 rsh-qam11-tif-09-doc
352735352 rsh-qam11-tif-09-docFiras Husseini
 
352735347 rsh-qam11-tif-14-doc
352735347 rsh-qam11-tif-14-doc352735347 rsh-qam11-tif-14-doc
352735347 rsh-qam11-tif-14-docFiras Husseini
 
Branch and Bound technique to solve Integer Linear Programming
Branch and Bound technique to solve Integer Linear ProgrammingBranch and Bound technique to solve Integer Linear Programming
Branch and Bound technique to solve Integer Linear ProgrammingKaivalya Shah
 
200844797 rsh-qam11-tif-01-doc
200844797 rsh-qam11-tif-01-doc200844797 rsh-qam11-tif-01-doc
200844797 rsh-qam11-tif-01-docFiras Husseini
 
A HYBRID COA/ε-CONSTRAINT METHOD FOR SOLVING MULTI-OBJECTIVE PROBLEMS
A HYBRID COA/ε-CONSTRAINT METHOD FOR SOLVING MULTI-OBJECTIVE PROBLEMSA HYBRID COA/ε-CONSTRAINT METHOD FOR SOLVING MULTI-OBJECTIVE PROBLEMS
A HYBRID COA/ε-CONSTRAINT METHOD FOR SOLVING MULTI-OBJECTIVE PROBLEMSijfcstjournal
 
imple and new optimization algorithm for solving constrained and unconstraine...
imple and new optimization algorithm for solving constrained and unconstraine...imple and new optimization algorithm for solving constrained and unconstraine...
imple and new optimization algorithm for solving constrained and unconstraine...salam_a
 
Cuckoo Search: Recent Advances and Applications
Cuckoo Search: Recent Advances and ApplicationsCuckoo Search: Recent Advances and Applications
Cuckoo Search: Recent Advances and ApplicationsXin-She Yang
 
Memetic search in differential evolution algorithm
Memetic search in differential evolution algorithmMemetic search in differential evolution algorithm
Memetic search in differential evolution algorithmDr Sandeep Kumar Poonia
 
Mcqs linear prog
Mcqs linear progMcqs linear prog
Mcqs linear progHanna Elise
 

What's hot (16)

352735326 rsh-qam11-tif-05-doc
352735326 rsh-qam11-tif-05-doc352735326 rsh-qam11-tif-05-doc
352735326 rsh-qam11-tif-05-doc
 
Nonlinear Programming: Theories and Algorithms of Some Unconstrained Optimiza...
Nonlinear Programming: Theories and Algorithms of Some Unconstrained Optimiza...Nonlinear Programming: Theories and Algorithms of Some Unconstrained Optimiza...
Nonlinear Programming: Theories and Algorithms of Some Unconstrained Optimiza...
 
Linear Programming Quiz
Linear Programming QuizLinear Programming Quiz
Linear Programming Quiz
 
352735352 rsh-qam11-tif-09-doc
352735352 rsh-qam11-tif-09-doc352735352 rsh-qam11-tif-09-doc
352735352 rsh-qam11-tif-09-doc
 
352735347 rsh-qam11-tif-14-doc
352735347 rsh-qam11-tif-14-doc352735347 rsh-qam11-tif-14-doc
352735347 rsh-qam11-tif-14-doc
 
Chapter one
Chapter oneChapter one
Chapter one
 
Linear programming
Linear programmingLinear programming
Linear programming
 
Branch and Bound technique to solve Integer Linear Programming
Branch and Bound technique to solve Integer Linear ProgrammingBranch and Bound technique to solve Integer Linear Programming
Branch and Bound technique to solve Integer Linear Programming
 
200844797 rsh-qam11-tif-01-doc
200844797 rsh-qam11-tif-01-doc200844797 rsh-qam11-tif-01-doc
200844797 rsh-qam11-tif-01-doc
 
A HYBRID COA/ε-CONSTRAINT METHOD FOR SOLVING MULTI-OBJECTIVE PROBLEMS
A HYBRID COA/ε-CONSTRAINT METHOD FOR SOLVING MULTI-OBJECTIVE PROBLEMSA HYBRID COA/ε-CONSTRAINT METHOD FOR SOLVING MULTI-OBJECTIVE PROBLEMS
A HYBRID COA/ε-CONSTRAINT METHOD FOR SOLVING MULTI-OBJECTIVE PROBLEMS
 
imple and new optimization algorithm for solving constrained and unconstraine...
imple and new optimization algorithm for solving constrained and unconstraine...imple and new optimization algorithm for solving constrained and unconstraine...
imple and new optimization algorithm for solving constrained and unconstraine...
 
Linear Programming
Linear  ProgrammingLinear  Programming
Linear Programming
 
Cuckoo Search: Recent Advances and Applications
Cuckoo Search: Recent Advances and ApplicationsCuckoo Search: Recent Advances and Applications
Cuckoo Search: Recent Advances and Applications
 
Memetic search in differential evolution algorithm
Memetic search in differential evolution algorithmMemetic search in differential evolution algorithm
Memetic search in differential evolution algorithm
 
Introduction to optimization Problems
Introduction to optimization ProblemsIntroduction to optimization Problems
Introduction to optimization Problems
 
Mcqs linear prog
Mcqs linear progMcqs linear prog
Mcqs linear prog
 

Similar to Search and Optimization Strategies

Multi Objective Optimization and Pareto Multi Objective Optimization with cas...
Multi Objective Optimization and Pareto Multi Objective Optimization with cas...Multi Objective Optimization and Pareto Multi Objective Optimization with cas...
Multi Objective Optimization and Pareto Multi Objective Optimization with cas...Aditya Deshpande
 
Algorithms Design Patterns
Algorithms Design PatternsAlgorithms Design Patterns
Algorithms Design PatternsAshwin Shiv
 
Types of Algorithms.ppt
Types of Algorithms.pptTypes of Algorithms.ppt
Types of Algorithms.pptALIZAIB KHAN
 
CH-1.1 Introduction (1).pptx
CH-1.1 Introduction (1).pptxCH-1.1 Introduction (1).pptx
CH-1.1 Introduction (1).pptxsatvikkushwaha1
 
Smooth-and-Dive Accelerator: A Pre-MILP Primal Heuristic applied to Scheduling
Smooth-and-Dive Accelerator: A Pre-MILP Primal Heuristic applied to SchedulingSmooth-and-Dive Accelerator: A Pre-MILP Primal Heuristic applied to Scheduling
Smooth-and-Dive Accelerator: A Pre-MILP Primal Heuristic applied to SchedulingAlkis Vazacopoulos
 
Analysis and Design of Algorithms notes
Analysis and Design of Algorithms  notesAnalysis and Design of Algorithms  notes
Analysis and Design of Algorithms notesProf. Dr. K. Adisesha
 
Multiobjective optimization and trade offs using pareto optimality
Multiobjective optimization and trade offs using pareto optimalityMultiobjective optimization and trade offs using pareto optimality
Multiobjective optimization and trade offs using pareto optimalityAmogh Mundhekar
 
Our presentation on algorithm design
Our presentation on algorithm designOur presentation on algorithm design
Our presentation on algorithm designNahid Hasan
 
Kk20503 1 introduction
Kk20503 1 introductionKk20503 1 introduction
Kk20503 1 introductionLow Ying Hao
 
Dynamic programming, Branch and bound algorithm & Greedy algorithms
Dynamic programming, Branch and bound algorithm & Greedy algorithms Dynamic programming, Branch and bound algorithm & Greedy algorithms
Dynamic programming, Branch and bound algorithm & Greedy algorithms SURBHI SAROHA
 
csce411-set7.ppt
csce411-set7.pptcsce411-set7.ppt
csce411-set7.pptJoshCasas1
 

Similar to Search and Optimization Strategies (20)

Multi Objective Optimization and Pareto Multi Objective Optimization with cas...
Multi Objective Optimization and Pareto Multi Objective Optimization with cas...Multi Objective Optimization and Pareto Multi Objective Optimization with cas...
Multi Objective Optimization and Pareto Multi Objective Optimization with cas...
 
Greedymethod
GreedymethodGreedymethod
Greedymethod
 
Recursion in Java
Recursion in JavaRecursion in Java
Recursion in Java
 
Algorithms Design Patterns
Algorithms Design PatternsAlgorithms Design Patterns
Algorithms Design Patterns
 
Greedy algorithm
Greedy algorithmGreedy algorithm
Greedy algorithm
 
Types of Algorithms.ppt
Types of Algorithms.pptTypes of Algorithms.ppt
Types of Algorithms.ppt
 
CH-1.1 Introduction (1).pptx
CH-1.1 Introduction (1).pptxCH-1.1 Introduction (1).pptx
CH-1.1 Introduction (1).pptx
 
DAA-Module-5.pptx
DAA-Module-5.pptxDAA-Module-5.pptx
DAA-Module-5.pptx
 
Smooth-and-Dive Accelerator: A Pre-MILP Primal Heuristic applied to Scheduling
Smooth-and-Dive Accelerator: A Pre-MILP Primal Heuristic applied to SchedulingSmooth-and-Dive Accelerator: A Pre-MILP Primal Heuristic applied to Scheduling
Smooth-and-Dive Accelerator: A Pre-MILP Primal Heuristic applied to Scheduling
 
AI: Logic in AI 2
AI: Logic in AI 2AI: Logic in AI 2
AI: Logic in AI 2
 
AI: Logic in AI 2
AI: Logic in AI 2AI: Logic in AI 2
AI: Logic in AI 2
 
Analysis and Design of Algorithms notes
Analysis and Design of Algorithms  notesAnalysis and Design of Algorithms  notes
Analysis and Design of Algorithms notes
 
Greedymethod
GreedymethodGreedymethod
Greedymethod
 
Multiobjective optimization and trade offs using pareto optimality
Multiobjective optimization and trade offs using pareto optimalityMultiobjective optimization and trade offs using pareto optimality
Multiobjective optimization and trade offs using pareto optimality
 
DAA UNIT 3
DAA UNIT 3DAA UNIT 3
DAA UNIT 3
 
Our presentation on algorithm design
Our presentation on algorithm designOur presentation on algorithm design
Our presentation on algorithm design
 
Kk20503 1 introduction
Kk20503 1 introductionKk20503 1 introduction
Kk20503 1 introduction
 
Dynamic programming, Branch and bound algorithm & Greedy algorithms
Dynamic programming, Branch and bound algorithm & Greedy algorithms Dynamic programming, Branch and bound algorithm & Greedy algorithms
Dynamic programming, Branch and bound algorithm & Greedy algorithms
 
algo classification.pptx
algo classification.pptxalgo classification.pptx
algo classification.pptx
 
csce411-set7.ppt
csce411-set7.pptcsce411-set7.ppt
csce411-set7.ppt
 

Recently uploaded

How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxDr.Ibrahim Hassaan
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxMaryGraceBautista27
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4MiaBumagat1
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxCarlos105
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 

Recently uploaded (20)

How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptx
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptx
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 

Search and Optimization Strategies

  • 1. Search and Optimization Strategies Tecniche di Programmazione – A.A. 2012/2013
  • 2. Summary A.A. 2012/2013Tecniche di programmazione2  Definitions  Branch & Bound  Greedy  Local Search
  • 4. Search vs Optimization A.A. 2012/2013Tecniche di programmazione4  A search algorithm is an algorithm for finding an item with specified properties among a collection of items  Specified properties: usually “local” properties, defined by some “feasibility” criteria  Collection: explicit, or virtual (implicit)  An optimization algorithm aims ad finding the best possible solution, according to an objective function, among all possible feasible solutions for a given problem
  • 5. Objective function A.A. 2012/2013Tecniche di programmazione5  Must be computable for all feasible solutions  May be undefined for unfeasible (or incomplete) solutions  Maximization problems  Objective function = value, goodness  Must find the maximum value of objective function  Minimization problems  Objective function = cost  Must find the minimum value of objective function
  • 6. A.A. 2012/2013Tecniche di programmazione6 Types of problems  Search problems: is there (at least one) feasible solution?  Ex: magical square  Ex: Hamiltonian cycle  Optimization problems: what is the best solution?  In these problems finding feasible solutions is usually easy  Ex: Hamiltonian cycle on a complete graph (Hamiltonan bee)  Hybrid problems (search + optimization): are there any valid solutions? And what is the best?  Ex: travelling salesman problem
  • 7. A.A. 2012/2013Tecniche di programmazione7 Representation S: Solutions V:Valid (feasible) solutions M: best solutions s s s f(s) Objective function
  • 8. A.A. 2012/2013Tecniche di programmazione8 Classification  Search problems  S V  |V| = 0 ?  Find a s V  Optimization problems  S =V  find max(f(s))  Hybrid problems  S V  find max(f(s))  such that s V
  • 9. Exact techniques A.A. 2012/2013Tecniche di programmazione9  Exhaustive generation of all possible solutions  Iteratively  Recursively  Optimizing recursive techniques  Visit order  Generate non-useless solutions: Branch and Bound  Recognize equivalent sub-problems: Dynamic Programming 1 2 3 4 5 6 7 8
  • 10. Approximate Tecniques A.A. 2012/2013Tecniche di programmazione10  Greedy  Pseudo-random  Hill climber 1 2 3
  • 11. Approximate solutions A.A. 2012/2013Tecniche di programmazione11  Optimum solution: the absolute best  Optimal solution: a solution that  approximates the optimum one (might be coincident, but we don’t know)  can no longer be improved with the chosen optimization technique  Locally optimum solution: optimum solution in a continuous domain
  • 12. Intuitively… A.A. 2012/2013Tecniche di programmazione12 x f(x) Optimum solution Optimal solution Locally optimum solutions
  • 13. Computational Intelligence A.A. 2012/2013Tecniche di programmazione13  Evolutionary Algorithms  Genetic Algorithms  Genetic Programming  Simulated annealing  Tabu-Search
  • 14. Branch & Bound Search and Optimization Strategies
  • 15. A.A. 2012/2013Tecniche di programmazione15 Introduction  Branch and Bound is an exact method for exploring all solutions based on their implicit enumeration  All solutions are considered, but not one-by-one. In fact B&B:  Considers disjoints subsets of solutions (branching)  Evaluates them according to an estimate of the objective function (bounding), by eliminating (pruning) those subsets that may not contain the optimum solution
  • 16. A.A. 2012/2013Tecniche di programmazione16 Definition  z*: a sub-optimal estimate of the final result  Initialized to + for minimization problems  Initialized to - for maximization problems  z(r) E : the exact solution of sub-problem P(r)  z(r) B: a super-optimal estimate of solutions of sub-problem P(r)  lower bound for minimization problems  upper bound for maximization problems
  • 17. A.A. 2012/2013Tecniche di programmazione17 General algorithm (I)  Branch-and-bound is a divide-et-impera method:  Divide a given problem (and its set of feasible solutions) in sub- problems to be analyzed separately.  Keep a list P of open sub-problems  At each step, select one current problem P(r)
  • 18. General algorithm (II) A.A. 2012/2013Tecniche di programmazione18  If P(r) has no feasible solutions, it is closed  If P(r) has (at least one) solution, and may be solved up to the optimum z(r) E  P(r) is closed  Its solution, with value z(r) E, may possibly replace z*, if it improves it
  • 19. General algorithm (III) A.A. 2012/2013Tecniche di programmazione19  Se P(r) has solutions, but it’s difficult to be solved up to the optimum, we try to show that it may not yield a better solution than the already known ones.  We compute a super-optimal estimate z(r) B of its solutions:  If z(r) B is not better than z*, all solutions in P(r) are dominated by the best known-solution, and P(r) may be closed  If z(r) B is better than z*, P(r) is broken into sub-problems that are inserted in the list P. P(r) is closed, and the sub-problems will be opened, eventually.
  • 20. General algorithm (IV) A.A. 2012/2013Tecniche di programmazione20  Proceed until P is empty  When P is empty, then z* is the exact optimum solution for the original problem.
  • 21. The solution tree A.A. 2012/2013Tecniche di programmazione21 P0 P1 P2 P21 P22 P11 P12 P111 P112 P12 Node: sub-problem Leaf node: closed sub-problem
  • 22. Ingredients of a B&B algorithm A.A. 2012/2013Tecniche di programmazione22  Strategy of visit of the search tree: criteria to choose the next sub-problem to be analyzed out of the list P  Bounding technique: how to evaluate the super-optimal estimate z(r) B  Branching rule: how to split the current problem P(r) into smaller sub-problems.
  • 23. Main features A.A. 2012/2013Tecniche di programmazione23  Advantages:  Finds optimum solution  May limit the number of visited solutions  May give a partial (approximate) solution, if stopped earlier  Disadvantages:  Computation time for visiting the solution tree depends on the strategy  The worst case is to visit all possible nodes, anyway  Time needed to compute z(r) B.
  • 25. A.A. 2012/2013Tecniche di programmazione55 Introduction  A greedy algorithm searches for a globally optimal solution, by choosing locally optimum ones.  The adopted technique is shortsighted:  Every choice made at any step is never re-considered again  No back-tracking  Basic principle: define an “attractiveness” for every partial solution  Attractiveness (it: appetibilità) = estimate of how much, probably, we are close to the optimum.
  • 26. General structure (I) A.A. 2012/2013Tecniche di programmazione56  If the attractiveness {ai} of partial solutions are known since the beginning, and may not be modified Greedy ({a1, a2, …an}) S  ø sort {ai} in decreasing attractiveness order for each ai do if ai may be added to S then S  S  {ai} return S
  • 27. General structure (II) A.A. 2012/2013Tecniche di programmazione57  If attractiveness may be modified by the effects of previous choices Greedy2 ({a1, a2, …an}) S  ø compute attractiveness of ai while there are element to choose do choose the most-attractive ai if ai may be added to S then S  S  {ai} update the remaining ai return S
  • 28. Example A.A. 2012/2013Tecniche di programmazione58  Find the minimum number of coins to give change to a customer.  We assume we have a list of possible coin values, and their availability is infinite
  • 29. A.A. 2012/2013Tecniche di programmazione59 Example  Available coins  20, 10, 5, 2, 1  Change to give  55
  • 30. A.A. 2012/2013Tecniche di programmazione60 Algorithm  At each step, select the highest-valued coin, whose value is less than the remaining change Remaining change Chosen coin 55 20 35 20 15 10 5 5
  • 31. A.A. 2012/2013Tecniche di programmazione61 Features  Advantages  Extremely simple algorithm  Very fast computational time  Disadvantages  The solution is optimal, non necessarily optimum
  • 32. Non-optimum solution A.A. 2012/2013Tecniche di programmazione62  Input:  Coins of 6, 4, 1  Change to give:  9  Greedy solution:  4 coins: 6, 1, 1, 1  Optimum solution :  3 coins: 4, 4, 1
  • 33. Local Search Search and Optimization Strategies
  • 34. Applicability A.A. 2012/2013Tecniche di programmazione72  Suitable for problems where:  There is an underlying “structure” in the solution space  There is a clear objective function  The search space is too vast  Exact algorithms are not knows  “Similar solutions have similar cost”
  • 35. Iterative improvement A.A. 2012/2013Tecniche di programmazione73  A family of methods  Common basic idea  Start from an initial (random) configuration  Consider various possible moves starting from that configuration  Accept or refuse such moves, depending on the objective function  When you cannot improve anymore, start again
  • 36. A.A. 2012/2013Tecniche di programmazione74 Example
  • 37. Moves A.A. 2012/2013Tecniche di programmazione75  We must define a set of moves to lead from one solution to another  The set of possible moves defined the neighborhood of a solution  Moves are often implemented as small variations (mutation) on the encoded solution
  • 38. A.A. 2012/2013Tecniche di programmazione76 Example: TSP (I) “2-opt”neighborhood
  • 39. A.A. 2012/2013Tecniche di programmazione77 Example: TSP(II) 3-opt neighborhood
  • 40. Hill Climbing (I) A.A. 2012/2013Tecniche di programmazione78  For every configuration, evaluate all possible moves  (explore the whole neighborhood)  Refuse all moves that worsen the objective function  Accept the move that leads to the highest improvement of the objective function  If all moves worsen the objective function, quit.
  • 41. A.A. 2012/2013Tecniche di programmazione79 Hill Climbing (II) X = startinc configuration E = eval(X) do { N = n_moves(X) for (i=0; i<N; ++i) Ei = eval(move(X,i)) if (all Ei  E) return X i* = { i | max(Ei) } X = move(X, i*) E = Ei* } while(1)
  • 42. Features A.A. 2012/2013Tecniche di programmazione80  Greedy  Simple to implement  No backtracking => no recursion, no memory  Needs “clever” definition of moves  Sometimes, the objective function may be incrementally computed
  • 43. A.A. 2012/2013Tecniche di programmazione81 Problems (I)  Foothill: getting trapped in local maxima Hillclimber final point Start Real maximum
  • 44. A.A. 2012/2013Tecniche di programmazione82 Problems (II)  Mesa: wide regions with null or negligible variation of the objective function  Needle in the haystack: isolated peak in a desolated landscape
  • 45. A.A. 2012/2013Tecniche di programmazione83 Variants  First-ascent  Accept the first move that improves the objective function  Best-ascent  Evaluate all moves and accept the best one  Threshold-accept  Accept the first move that improves the current configuration by an amount higher that a fixed threshold  …etc…
  • 46. A.A. 2012/2013Tecniche di programmazione84 Example 111 fitness 10 011 fitness 12 101 fitness 20 110 fitness 5 First ascent Best ascent 011 fitness 12 101 fitness 20 Neighborhood definition: ‘complement one bit’
  • 47. A.A. 2012/2013Tecniche di programmazione85 Random Restart Hill Climbing  Repeat the Hill Climbing procedure starting from many initial starting points X = random configuration Best = X do { X’ = HillClimber(X) if (Eval(X’) > Eval(Best)) Best = X’ X = random configuration } while( ! Enough )
  • 48. A.A. 2012/2013Tecniche di programmazione86 Simulated Annealing  Stochastic approach for function minimization  The name is taken from the physical process of crystallization of a liquid into solid state  The minimum of the cost function corresponds to the crystal state of the substance (minimum energy)  Simulated Annealing gradually “lowers” the “temperature” until the system “freezes”
  • 49. A.A. 2012/2013Tecniche di programmazione87 Algorithm (I)  Start with a random solution  Choose a solution in the neighborhood  If the energy of the new solution is less than the current one, accept the move  If the energy is more than the current one, the move may be accepted, with a probability  The probability to accept “bad” moves depends on  Amount of worsening (DE)  Temperature (simulated) of the system
  • 50. A.A. 2012/2013Tecniche di programmazione88 Algorithm(II) current = start state for time = 1 to forever do T = schedule[time] if T = 0 return current next = a randomly chosen successor of current dE = value(next) – value(current) if dE > 0 then current = next else current = next with probability edE/T end for
  • 51. A.A. 2012/2013Tecniche di programmazione89 Features  The system may “jump out” of local minima by accepting worse solutions  At higher temperatures, worsening jumps are easier, at lower temperature they become unlikely  Temperature is gradually reduced  At T=0, the algorithm converges to the locally optimum solution (hill climbing behavior)
  • 52. A.A. 2012/2013Tecniche di programmazione90 Boltzmann distribution dE P(accettazione) 1T=max T=0
  • 53. Other local search algorithms A.A. 2012/2013Tecniche di programmazione91  Tabu Search  Ant Colony  Genetic Algorithms
  • 55. Licenza d’uso A.A. 2012/2013Tecniche di programmazione93  Queste diapositive sono distribuite con licenza Creative Commons “Attribuzione - Non commerciale - Condividi allo stesso modo (CC BY-NC-SA)”  Sei libero:  di riprodurre, distribuire, comunicare al pubblico, esporre in pubblico, rappresentare, eseguire e recitare quest'opera  di modificare quest'opera  Alle seguenti condizioni:  Attribuzione — Devi attribuire la paternità dell'opera agli autori originali e in modo tale da non suggerire che essi avallino te o il modo in cui tu usi l'opera.  Non commerciale — Non puoi usare quest'opera per fini commerciali.  Condividi allo stesso modo — Se alteri o trasformi quest'opera, o se la usi per crearne un'altra, puoi distribuire l'opera risultante solo con una licenza identica o equivalente a questa.  http://creativecommons.org/licenses/by-nc-sa/3.0/