View
2
Download
0
Category
Preview:
Citation preview
1www.esi-group.com
Copyright ยฉ ESI Group, 2017. All rights reserved.Copyright ยฉ ESI Group, 2017. All rights reserved.
www.esi-group.com
SCILAB WORKSHOP
Optimization in SCILAB
SCILAB TEAM
17th, October 2019
2www.esi-group.com
Copyright ยฉ ESI Group, 2017. All rights reserved.
Advanced post-processingAirfoil shape optimization
3www.esi-group.com
Copyright ยฉ ESI Group, 2017. All rights reserved.
Quick introduction to Numerical Optimization
4www.esi-group.com
Copyright ยฉ ESI Group, 2017. All rights reserved.
Optimization problem
max๐ฅโ๐
๐ ๐ฅ
3 Steps:
1/ Identification of the decision variables: x
2/ Set-up of constraints associated to the variables: X
3/ Definition of a cost/objective function: f
5www.esi-group.com
Copyright ยฉ ESI Group, 2017. All rights reserved.
Two formulations, One problem
Solving the problem
min๐ฅโ๐
๐(๐ฅ)
Corresponds to solve the problem
max๐ฅโ๐
โ๐ ๐ฅ
Minimize or Maximize a function?
6www.esi-group.com
Copyright ยฉ ESI Group, 2017. All rights reserved.
Numerical optimization
Initialization
Evaluation of cost
function
Choice of direction
New element
Optimal element
!
7www.esi-group.com
Copyright ยฉ ESI Group, 2017. All rights reserved.
1/ Initial approximationโ Influence convergence
2/ Number of iterationsโ Recursive process
3/ Convergence speed
4/ Stopping criteria
โข Maximum number of iterations, โฆ
โข Cost function value under a given threshold, โฆ
๐(๐ฅ๐) < ๐1
โข Difference between two consecutive approximations under a giventhreshold, โฆ
๐ฅ๐+1 โ ๐ฅ๐ < ๐2
Classical set-up parameters for optimization solvers
8www.esi-group.com
Copyright ยฉ ESI Group, 2017. All rights reserved.
General remarks
โข Local extrema are easy to find!
โข Some algorithm are performinglocal search only!
Take care on initial
approximation!
WARNING : Different types of extrema
9www.esi-group.com
Copyright ยฉ ESI Group, 2017. All rights reserved.
Direct search
Search for an optimal position usingcost function evaluations, without anycomputation of the function exact orapproximate derivatives.
Interior Points method, simplex
Maximum search methods
Derivatives computation
Search for an optimal position usingcost function derivatives (Jacobian forsteepest ascent direction, Hessian forcritical point type) exact or approximatecomputation.
Gradient method, Newton method
How to make design space exploration?
10www.esi-group.com
Copyright ยฉ ESI Group, 2017. All rights reserved.
Optimization problem typology
11www.esi-group.com
Copyright ยฉ ESI Group, 2017. All rights reserved.
Travelling salesman problem
Continuous vs Discrete
DISCRETE (Combinatorial Analysis)
Variables are taking values in a finite setor states (IN, ON/OFF, โฆ).
Classical examples: Travelling salesmanproblem which consists in finding theshortest path binding a given set of cities.
12www.esi-group.com
Copyright ยฉ ESI Group, 2017. All rights reserved.
Mono vs Multi objective
MULTI OBJECTIVE
min๐ฅโ๐
(๐1 ๐ฅ , ๐2 ๐ฅ ,โฆ , ๐๐ ๐ฅ )
Several cost, potentially conflicting,functions minimization.
Found solution is therefore not unique.The complete set of solutions is calledPareto Front.
Choice is about trade-offAn example would be to ensuremaximum efficiency, and minimuminvestment at the same time.
13www.esi-group.com
Copyright ยฉ ESI Group, 2017. All rights reserved.
Constrained vs Non Constrained
CONSTRAINTS
Constraints are referring to the limit of the design space we impose
โข Linear
๐ถ๐ฅ = ๐
โข Non Linear
๐ฅ๐๐ถ๐ฅ = ๐
โข Equalities๐ถ๐ฅ = ๐
โข Inequalities๐ถ๐ฅ โฅ ๐
โข Lower and Upper bounds๐1 โค ๐ฅ โค ๐2
14www.esi-group.com
Copyright ยฉ ESI Group, 2017. All rights reserved.
Problem size
Let n be the number of design variables
โข n < 10 : Small problem (s)
โข 10 < n < 100 : Medium problem (m)
โข 100 < n < 1000 : Large problem (l)
Solver speed and memory needsare depending on the problem size
15www.esi-group.com
Copyright ยฉ ESI Group, 2017. All rights reserved.
Optimization solvers in SCILAB
16www.esi-group.com
Copyright ยฉ ESI Group, 2017. All rights reserved.
How to choose SCILAB optimization solver
Convex
SemidefiniteLeast squares
Quadratic
Linear
Objective Constraints
[Bnds, Eq, Ineq]
Size Gradient Solver
Linear Y Y Y m karmarkar
Quadratic Y Y Y L qpsolve
SemiDef N Y Y L lmisolver
SemiDef Y N Y L semidef
N.L.S. N N N L optional Leastsq /
lsqrsolve
Non-linear Y N N L Y optim
Non-linear N N N s fminsearch
Objective Single
Objective
Multi
Objective
Use
Continuous/
Differentiable
Fminsearch
Non Smooth optim
Discrete Optim_sa,
optim_ga
Optim_moga
Optim_nsga2
17www.esi-group.com
Copyright ยฉ ESI Group, 2017. All rights reserved.
Linear problemmin๐ฅ
๐ ๐ฅ = ๐๐๐ฅ
Linear constraints
โข Equalities๐ถ1๐๐ฅ = ๐1
โข Inequalities๐ถ2๐๐ฅ โฅ ๐2
Linear optimization
18www.esi-group.com
Copyright ยฉ ESI Group, 2017. All rights reserved.
Interior Points Method
ยซ Affine Scaling ยป
Solve suite of optimization problems onellipsoid.
Ellipsoids size are decreasing at eachiteration by a given scale factor (between 0and 1).
Caracteristic:
โข Polynomial time O(๐๐)
โข Direct search
โข (In)Equalities and bounds constraints
Linear optimization - karmarkar
19www.esi-group.com
Copyright ยฉ ESI Group, 2017. All rights reserved.
Quadratic problem
minx๐ ๐ฅ =
1
2๐ฅ๐๐๐ฅ + ๐๐๐ฅ
With Q la ยซ hessian ยป and c ยซ gradient ยป
of a virtual energy function
Linear constraints
โข Equalities๐ถ1๐๐ฅ = ๐1
โข Inequalities๐ถ2๐๐ฅ โฅ ๐2
Quadratic optimization
Concave shape, convex problem
20www.esi-group.com
Copyright ยฉ ESI Group, 2017. All rights reserved.
Quadratic optimization - qpsolve
Goldfarb-Idnani solver
ยซ Feasible active set method ยป
Find non-constrained global optimum,then add non-respected constraints oneafter the other (activation)
Caracteristics :
โข Strictly convex problems
โข (In)Equalities and bounds constraints
โข Polynomial time O(๐๐)
โข Direct search
21www.esi-group.com
Copyright ยฉ ESI Group, 2017. All rights reserved.
Least squares problem
min๐ฅ
๐ ๐ฅ 2
๐: ๐ผ๐ ๐ โ ๐ผ๐ ๐
๐ number of unknonw, ๐ nb of points
๐ non necessarily linear or differentiable
Linear regression (QUADRATIC)
Minimize distance between measurements (๐ = 2) and an unknown line (๐ = 1)
1
2๐๐ฅ โ ๐ 2 =
1
2(๐ฅ๐๐๐๐๐ฅ โ 2๐ฅ๐๐๐๐ + ๐๐๐)
Non Linear Least Squares
22www.esi-group.com
Copyright ยฉ ESI Group, 2017. All rights reserved.
Non Linear Least Squares - lsqrsolve
Levenberg-Marquardt algorithm
To find a new direction:
โข Gradient method (green) to provide steepestdescent direction. Efficient when far from theoptimal position.
โข Gauss-Newton (red), approximate the problem aslocally quadratic and solve it to find new position.Efficient when close to the optimal position.
Caracteristics
โข Polynomial time
23www.esi-group.com
Copyright ยฉ ESI Group, 2017. All rights reserved.
Non Linear optimization - fminsearch
Nelder-Mead Simplex
Simplex manipulation
Caracteristics
โข Non constrained
โข High complexityBetter suited for small problem
โข Direct search
3D Simplex
24www.esi-group.com
Copyright ยฉ ESI Group, 2017. All rights reserved.
Quasi-Newton method
Quasi-Newton statement๐ฅ๐+1 โ ๐ฅ๐ = ๐ต๐ ๐ ๐ฅ๐+1 โ ๐ ๐ฅ๐
โ ๐ฅ๐+1 โ ๐ฅ๐ โ ฯ๐๐ต๐๐(๐ฅ๐)
โข Broyden-Fletcher-Goldfarbapproximation for pour Hessian ๐ต๐
โข ฯ๐ pour control convergence
Caracteristics
โข High memory need to store ๐ต๐ : O(nยฒ)(O(n) in case of limited method)
โข Gradient info must be provided
โข Polinomial time O(nยฒ) but not accurate
Non Linear optimization - optim
Nota
โข Fsolve (alternative)
โข Datafit / leastsq (built upon optim)
25www.esi-group.com
Copyright ยฉ ESI Group, 2017. All rights reserved.
GA Theory
- Natural selection -
Probabilistics and non deterministics transitons:
Selection, Cross-over et Mutation
Caracteristics
โข Bounds constraints
โข Non Linear, Non Convex
Remarks
optim_ga /optim_moga: Single/Multi objective
pareto_filter: Non-dominated sorting
Genetic Algorithms
26www.esi-group.com
Copyright ยฉ ESI Group, 2017. All rights reserved.
Simulated Annealing
Simulated Annealing optim_sa
Empirical method based on metallurgicalprocess
Alternate slow cooling cycles with heatingcycles (annealing) in order to minimize materialinternal energy (strongest configuration)
Metropolis-Hastings Algorithm
Starting at a given state, we modify systemtowards another state. Either it get better(energy decrease) or it get worse.
Drawbacks:
โข Empirical set-up
โข Bounds constraints only
Benefits:
โข Global optimum
โข Discrete optimization
Recommended