Sie sind auf Seite 1von 42

University of Zagreb, Croatia

Lecture 4.b
Heuristic Optimization Methods:
Metaheuristics: Basic Concepts
Slides prepared by Nina Skorin-Kapov

Academic year 2020/2021


Graduate Studies Programme
Outline
University of Zagreb, Croatia

 Metaheuristics

 Some Classifications

 Main design concepts:


Solution Representation
Evaluation function

Zavod za telekomunikacije 2
Optimization methods
University of Zagreb, Croatia

Exact Approximate
A*
methods methods
Simplex- Constraint
based for LP programming Approximation
algorithms
Heuristic
Branch and Bound, Dynamic
Cut , Price (B&B, programming algorithms
B&C, B&P)

Improvement (meta)heuristics
Constructive heuristics
• Local search
• Greedy algorithms
•Nature inspired
• Tabu search, Genetic
Hybrid methods
algorithms, Simmulated
• GRASP Annealing, Ant colony
•Problem specific
heuristics

Zavod za telekomunikacije 3
Metaheuristics
University of Zagreb, Croatia

 Usually refer to improvement heuristics


 Start from a potential solution or group of
solutions and then iteratively try to improve it,
i.e. find a better solution
 Can be run for a desired number of
iterations/generations
 No guarantee of optimality
 Increased popularity in the past 20 years

Zavod za telekomunikacije 4
Diversification vs. Intensification
University of Zagreb, Croatia

 Two contradictory criteria:


1. Diversification – exploration of search space
 Explore all regions of the search space evenly so that the
search is not confined to a small part
 Extreme case: random search
2. Intensification – exploitation of best found solutions
 Promising regions of the search space where we ‘think’
good solutions may be are explored more thoroughly
 Extreme case: basic local search

Random Population- Single-solution Local


search based MH based MH search

Diversification Intensification

Zavod za telekomunikacije 5
Some classifications…..
University of Zagreb, Croatia

Nature inspired: Non-nature inspired:

•Evolutionary algorithms •GRASP


(evolution),
•Artificial immune systems
(biology)
•Swarm intelligence (ants,
bee colonies, particle
swarm optimization)

Many metaheuristics are inspired by natural processes!

Zavod za telekomunikacije 6
Some classifications…..
University of Zagreb, Croatia

Memory usage: Memory-less:

•Tabu search • Local search


•Short term memory • GRASP
•Long term memory • Simulated Annealing

Memory usage: use of a Memory-less: no


memory that contains information extracted
information extracted during dynamically is used in the
the search search

Zavod za telekomunikacije 7
Some classifications…..
University of Zagreb, Croatia

Stochastic: Deterministic:

•Simulated annealing •Local search


•Evolutionary algorithms •Tabu search
•GRASP

Stochastic: Deterministic:
• Random rules are applied during •Solves an optimization
the search problem by making
• A different final solution can be deterministic decisions
obtained from the same initial
solution! This must be taken into •The same initial solution will
account in performance evaluation always lead to the same final
solution
Zavod za telekomunikacije 8
Some classifications…..
University of Zagreb, Croatia

Population-based: Single-solution based:

• Particle swarm • Local search


• Evolutionary algorithms • Simulated annealing
• Tabu search
• GRASP

Population-based: Single-solution based:


• A whole population is • Manipulates and transforms
evolved; a single solution;
• Exploration-oriented • Exploitation-oriented
(diversification): allows for (intensification): can intensify
better diversification of whole the search in local regions
search space

Zavod za telekomunikacije 9
Main design concepts
University of Zagreb, Croatia

 The main design concepts of


Metaheuristics are:

 Representation of potential solutions


(encoding) handled by the search algorithm

 Definition of fitness/evaluation function, i.e.


the objective function which guides the
search

Zavod za telekomunikacije 10
Solution Representation
University of Zagreb, Croatia

 Solution representation or encoding is a


critical design issue
 Significantly affects efficiency and
effectiveness of the metaheuristic
Its efficiency is related to the search operators
(e.g. neighborhood in SA and TS, recombination
in GA, etc) and the evaluation function
 Must be suitable and relevant to the problem
 Many alternative representations are usually
possible – the challenge is to design the
most efficient
Zavod za telekomunikacije 11
Solution Representation Characteristics
University of Zagreb, Croatia

 The necessary characteristics of valid solution


representations are:
 Completeness: all feasible solutions associated to
the problems can be represented
 Connexity: a search path exists between any two
solutions in the search space.
 This implies that any solution (including the/a global
optimum) can be reached no matter the initial solution.
 Efficiency: the representation is such that it can be
efficiently manipulated by the search operators
 The complexity (time and space) of the operators (e.g.
calculating the neighborhood and the size of the
neighborhood/search space) should be reduced

Zavod za telekomunikacije 12
Solution Representation classes
University of Zagreb, Croatia

 2 main solution representation classes:


 Linear: Strings of symbols of a given
alphabet
Classical representatins: binary vectors, vectors
of discrete variables, vector of real values,
permutation vectors

 Nonlinear: in general more complex


structures
e.g. graph structures
 Tree structures – used for hierarchial structured
optimization problems
Zavod za telekomunikacije 13
Example: binary vector
University of Zagreb, Croatia

 Any problem involving decision variables


representing presence/absence, i.e. yes/no
decisions
1, object oi is packed
 Knapsack problems: xi = 
 SAT problems 0, otherwise
 BIP problems i = 1,..., n

1 0 1 1 1 1 0 0 0 1 0 1 0 1

Solution: vector of binary numerals

Zavod za telekomunikacije 14
Example: vector of discrete values
University of Zagreb, Croatia

 Generalization of a binary encoding where the


decision variables are from a set of discrete
values
 Used mostly for combinatorial decision
problems where there is a finite set of possible
values
 Location problems:
xi = j, i = 1,..., n, j = 1,..., m
 Assignment problems Task i is assigned to agent j
 IP problems Note: assignment
problems can also be
4 6 1 7 7 1 9 3 0 3 6 2 2 1 represented using
binary encoding
Solution: vector of discrete values
Zavod za telekomunikacije 15
Example assignment problem
University of Zagreb, Croatia

 Problem: There are 20 airline flights and 15


available flight crews and associated costs. Assign
to each flight a crew subject to certain constraints
minimizing the cost.
 Binary representation:
1, flight i is assigned crew j
xi , j = , i = 1,...,20, j = 1,...,15
0, flight i is not assigned crew j
 Many variables but may be easier to manipulate the
solutions (B&B)
 Integer representation:
xi = j, i = 1,...,20, j = 1,...,15, flight i is assigned crew j
 Fewer variables
Zavod za telekomunikacije 16
Example: vector of real values
University of Zagreb, Croatia

 Used for problems where the decision variables


are continuous
 Continuous optimization
 Parameter identification – finding the best
parameters in desgning a given component
 Can be mixed continuous and discrete
variables/parameters

4.23 6.56 1.87 7.38 7.10 1.89 9.00

Solution: vector of real values

Zavod za telekomunikacije 17
Example: permutation vector
University of Zagreb, Croatia

 Used when the solution can be represented as


a permutation of a given set of values
 Each element should appear exactly once
 Sequencing problems
 Routing problems
 Travelling Salesman Problem
 Scheduling problems

9 6 8 7 5 1 4 3 2 0

Solution: a permutation of a given set of values

Zavod za telekomunikacije 18
Example: N-Queens problem
University of Zagreb, Croatia

 N-Queens puzzle: arrange N chess


queens on an NxN chessboard such that
no queen can attack any other assuming
standard chess attacking moves
 8-Queens problem – originally defined by Max
Bezzel (chess player), 1848

Zavod za telekomunikacije 19
Example: 8-Queens problem
University of Zagreb, Croatia

Zavod za telekomunikacije 20
Representation space variations
University of Zagreb, Croatia

 Encoding with a vector of 8 Cartesian positions:


P = [ p1 p2  p8 ], pi = ( xi , yi ), i = 1,,8
 Search space → 648 (over 4 billion possible solutions)
 Encoding prohibiting more than one queen per
row, i.e. each queen assigned a fixed row,
decision variables are columns
P = [ p1 p2  p8 ], pi = ( xi , ), i = 1,,8
 Search space →88 (over 16 million possible solutions)
 Encoding prohibiting more than one queen per row
and per column: encoding is a permutation vector
 Search space → 8! (40,320 possible solutions)
Zavod za telekomunikacije 21
Some non-classical representations
University of Zagreb, Croatia

 Random-key encoding: uses real values to represent


permutations
 Messy representations: the value associated with the variable is
independent of the position (each element in the representation is
the variable and its value). Enables encodings of variable length.
 Non-coding regions: introduces non-coding regions which are
part of the representation that provide no contribution to the
evaluation function
 Diploid representations: Include multiple values for each position
of the encoding; requires decoding to determine which value will
be associated to the position
 Quantum representations: uses qubits (can be the superpostion
of 2 values simultaneously) n qubits→ can represent 2n states at
the same time

Zavod za telekomunikacije 22
Random Key encoding
University of Zagreb, Croatia

 Uses real values to represent permutations


 Used to encode permutation representations for
evolutionary algorithms where operators, e.g.
crossover, present feasibility problems

 Each element is assigned a random number


generated U[0,1].
 Decoding: elements are visited in increasing
order defining the permutation

Zavod za telekomunikacije 23
Random Key encoding example
University of Zagreb, Croatia

Initial rank: 1 2 3 4 5 6 7

Random Key: 0.23 0.56 0.87 0.38 0.10 0.89 0.00

Increasing order: 0.00 0.10 0.23 0.38 0.56 0.87 0.89

Permutation: 7 5 1 4 2 3 6

Zavod za telekomunikacije 24
Representation-Solution mapping
University of Zagreb, Croatia

 One2One: a solution is represented by a single


encoding and each encoding corresponds to a unique
solution; classical representations
 No redundancy or search space reduction
 Sometimes difficult for heavily constrained problems
 One2Many: one solution can be represented by
multiple encodings
 Enlarges the search space and may affect efficiency
 E.g. graph coloring
 Many2One: multiple solutions are represented by the
same encoding
 Eliminate details, some information is not given explicitly
→reduces search space
 Also called indirect encoding
Zavod za telekomunikacije 25
Indirect encoding
University of Zagreb, Croatia

 When the encoding is not the complete solution


 A decoder is needed (deterministic or
nondeterministic) to get the complete solution
 Used often on heavily constrained problems
such as scheduling
 the problem constraints are handled by the decoder
to guarantee a feasable solution
 Multiple solutions can be represented by the
same encoding, but not neccessarily

Zavod za telekomunikacije 26
Example: Job-shop scheduling
University of Zagreb, Croatia

 Given is a set of J jobs, each composed of a chain of M


operations to be realized on M machines.
 Each operation needs to be processed during an
uninterrupted period of a given length on a given machine
 Each job has an operation that must be performed on
each machine.

 The objective is to schedule all operations on the


machines in such a way as to minimize total completion
time.
 Has earned a reputation for being notoriously difficult to
solve

Zavod za telekomunikacije 27
Example direct encoding of JSP
University of Zagreb, Croatia

Op 1 Op M
Op11 Op21 OpM1
M3(5-8) M6(9-16) M1(21-40)
Job 1
Op12 Op22
M3(1-4) M1(13-20)

Job J Op1J Op2J OpMJ


M5(7-8) M3(9-34) M4(55-78)

Zavod za telekomunikacije 28
Example indirect encoding of JSP
University of Zagreb, Croatia

Example 1: A permutation of the jobs indicating priority,


J! possibilities

1 J
Job i … Job k

•A decoder derives a solution: e.g.: creates a schedule by


always giving precedence to operations of higher priority
jobs
•Various decoders could be used with a variable degree of
stochasticity.

Zavod za telekomunikacije 29
Example indirect encoding of JSP
University of Zagreb, Croatia

Example 2: A permutation of the jobs where each job


appears exactly M times (JxM entries), i.e. once for each
operation
1 JxM
Job Job Job Job Job Job Job Job Job Job
… …
1 3 1 2 2 1 3 3 2 1

A decoder derives a schedule in the specified order


by scheduling as soon as possible the next not-yet-
scheduled operation of the job currently considered

Zavod za telekomunikacije 30
Main design concepts
University of Zagreb, Croatia

 The main design concepts of


Metaheuristics are:

 Representation of potential solutions


(encoding) handled by the search algorithm

 Definition of fitness/evaluation function, i.e.


the objective function which guides the
search

Zavod za telekomunikacije 31
Fitness/Evaluation function
University of Zagreb, Croatia

 Evaluation or fitness function f : S → 


 Describes the quality/fitness of each solution of
the search space
 Enables us to order (rank) all solutions of the
search space.
 IMPORTANT!
 The fitness function guides the search toward
“good” solutions of the search space
 A badly defined fitness function can lead to
poor solutions no matter what heuristic is used.

Zavod za telekomunikacije 32
Straightforward fitness functions
University of Zagreb, Croatia

 Sometimes, it can be very easy:


 Use the objective function of the original
problem formulation as the fitness function

Example: knapsack problem


n
max  vi xi
i =1
n
s.t.  ci xi  C
i =1
xi , binary

Zavod za telekomunikacije 33
Guiding fitness functions
University of Zagreb, Croatia

 The straightforward fitness function may not


guide the search efficiently through the solution
space
 e.g. when many solutions are infeasible and thus
have the same fitness
 SAT

 Solution→ the objective function has to be


transformed to obtain the fitness function for
better convergence of the metaheuristic.

Zavod za telekomunikacije 34
Guiding fitness functions
University of Zagreb, Croatia

Function F is composed of clauses with k


Example: k-SAT Boolean variables, where each clause is a
problem disjunction. The objective is to find an
assignment of the Boolean variables such as
the value of the function F is true.

Straightforward fitness
function: 
1, if F is TRUE
Fitness and objective functions are the same f =
Poor differentiation between solutions→ 
0, otherwise
almost all solutions have f value 0
Guiding fitness function:
The fitness is number of satisfied clauses f (s) = number of clauses
in the solution → max fitness guides the in F satisfiedby solutions
search procedure (MAX-SAT model)

Zavod za telekomunikacije 35
Fitness functions with representation decoding
University of Zagreb, Croatia

 Representation and fitness function can be


interrelated
 With indirect encoding, the representation
(genotype) needs to be decoded to generate
the (best) solution (phenotype) corresponding
to that representation
 In such cases, the search must include a
decoder function which generates the best
solution from a given representation according
to the fitness function

Zavod za telekomunikacije 36
Example - the minimum Steiner tree problem
University of Zagreb, Croatia

• Steiner tree: Given a graph G=(V,E) and a subset of


nodes D in V, a Steiner tree is a connected and acyclic
subgraph of G which spans all nodes in D
• A minimum Steiner tree is such a subgraph of minimum
weight in a wieghted graph
• NP-hard; example application: multicast routing

• Steiner nodes: nodes S included in the tree but not in D


(non-terminal nodes)
• The problem reduces to finding the set of Steiner
nodes. For a given set D and the set of Steiner nodes S,
the minimum spanning tree of of the subgraph of G
obtained by removing all nodes in V/{S union D}
Zavod za telekomunikacije 37
Example - the minimum Steiner tree problem
University of Zagreb, Croatia

Representation: set of Steiner nodes S represented by a


binary vector of size |V/D|
Decoder function: find an MST (Minimum Spanning Tree) of
sub-graph G composed only of nodes S and D
Fitness function: size of the found MST

Non-terminal nodes: [a d e f g]
(3) e
Representation (genotype): b
s = [0 1 0 1 1] (4)
(3) (1) (3)
h
Solution (phenotype): d (2) f
a
the MST shown
(1) (2)
Fitness function: (4) (1) (2)
f(s)=8 c
(4)
g

Zavod za telekomunikacije 38
Interactive fitness function
University of Zagreb, Croatia

 Human intervention during algorithm execution


 Motivation:
 To guide the search procedure:
 Users can dynamically introduce user knowledge causing the
search algorithm to converge faster toward better regions
 e.g., used in multicriteria decision making
 To evaluate a solution:
 If the fitness function requires subjective human evaluation
according to preference (e.g., visual appearance) it cannot be
formulated analytically – needs user interaction
 May involve many users.
 e.g., used in art design (music, images, forms, etc.)
 Due to scalability issues, speed and cost, a minimal
number of interventions should be used
Zavod za telekomunikacije 39
Relative or Competitive fitness functions
University of Zagreb, Croatia

 Sometimes, finding a fitness function which maps each


solution to an absolute value is difficult
 e.g., in game theory it can be that strategy A may be better than B,
B better than C, and C better than A.
 Relative fitness: associates a rank with the individual in the
population.
 Competitive fitness: a competition is applied over a
subpopulation of solutions.
 Three types of competition : bipartite (2), tournament, and full (all).
 In population-based metaheuristics, selection strategies
only need the relative or competitive fitness (and not the
absolute quality of a solution) to guide the search
procedure or evolution

Zavod za telekomunikacije 40
Meta-modeling (1/2)
University of Zagreb, Croatia

 Computation or evaluation of the fitness/objective function


may be time-consuming or
 an analytical fitness function may not be available.

 Meta-modeling: to reduce this complexity we can


approximate the original fitness function and use the
approximation to guide the search
 If the fitness func. is an optimization problem, we can use bounds
 A non-analytical fitness function can be approximated using a
sample of solutions generated by physical experiments or
simulations.
 Approximation of extremely expensive fitness functions with
neural networks, machine learning, etc.

Zavod za telekomunikacije 41
Meta-modeling (2/2)
University of Zagreb, Croatia

 Model selection:
A trade-off between the complexity of the model or
approximation and its accuracy
 Beneficial to use multiple models
 Can use multiple local models instead of a
global model can also be beneficial

 The meta-model can be used in conjunction


with the original fitness/objective function.
 e.g. alternative use of the original and approximate
model
Zavod za telekomunikacije 42

Das könnte Ihnen auch gefallen