Professional Documents
Culture Documents
Single-Solution Optimization Algorithms CS492
Single-Solution Optimization Algorithms CS492
CS492
02/25/2022
Single-solution Optimization Algorithms
Step 1: Define a fitness (objective) function for a given
optimization problem
Step 2: Define a function to generate solutions for the
given optimization problem
Step 3: Generate a solution (say X) using the
generation function and then evaluate its fitness using
the fitness function
Step 4: Assume X is the best solution X *
02/25/2022
Single-solution Optimization Algorithms
Step 5: Generate another solution (say Y) using the
generation function and then evaluate its fitness using
the fitness function
:Step 5: Mutate X to generate Y
Step 6: If the fitness of Y (f(Y)) is better than the
fitness of X* (f(X*)), set Y as the best solution X*
Step 7: If the stopping condition is satisfied, return
X*. Otherwise go to Step 5
02/25/2022
Sphere function
Question) Choose 4 integer numbers between -100
and 100 such that the sum of their squares is
minimized?
02/25/2022
Single-solution Optimization Algorithms
A typical candidate solution for the former sphere
function can be represented as X=<x1,x2,x3,x4>
Step 1: The fitness function is:
Step 2: Generate 4 numbers between -100 and100
X=<5,2,8,3>
Step 3: The fitness value f(X)=102
Step 4: Assume X is X*
02/25/2022
Single-solution Optimization Algorithms
Iteration 1
Step 5: Generate 4 new numbers between
-100 and 100 Y=<1,2,0,3>
Step 6: f(Y)=14 is better than f(X*)=102 so Y is the new
X*
02/25/2022
Single-solution Optimization Algorithms
Iteration 2
Step 5: Generate 4 new numbers between
-100 and100 Y=<3,1,0,0>
*
f(Y)=10 is better than f(X )=14 so Y is the new X*
etc…
02/25/2022
Sorting problem:Discrete optimization problems
02/25/2022
Discrete optimization problems: Sorting
problem
The number of digits to be sorted is 4
X=<10,5,8,4>
Step 1: The fitness function is the number of digits
sorted correctly in the solution starting from the first
number
Step 2: Generate a solution by randomly reordering
the numbers in the solution X=<5,10,8,4>
Step 3: The fitness value f(X)=2
Step 4: Assume X is X*
02/25/2022
Discrete optimization problems: Sorting
problem
Iteration 1
Step 5: generate a new solution Y by randomly
reordering the numbers in the solution X*
Y=<5,8,10,4>
Step 6: f(Y)=3 is better than f(X*)=2 so Y is the new X*
02/25/2022
Discrete optimization problems: Sorting
problem
Iteration 2
Step 5: generate a new solution Y by randomly
reordering the numbers in
Y=<5,8,4,10>
f(Y)=2 is not better than f(X*)=3 so X* will not be
changed
etc…
02/25/2022