tips & tricks: getting started with optimization in matlab® · tips & tricks: getting...

14
© 2008 The MathWorks, Inc. Tips & Tricks: Getting started with optimization in MATLAB® Stuart Kozola

Upload: others

Post on 24-Mar-2020

33 views

Category:

Documents


0 download

TRANSCRIPT

©20

08 T

he M

athW

orks

, Inc

.

Tips & Tricks: Getting started with optimization in MATLAB®

Stuart Kozola

2

Agenda

� Optimization: What is it, Why use it?

� Overview of MATLAB® Based Optimization Tools

� Demos: Tips, Tricks, and Best Practices

� Additional Resources

� Q&A

3

Optimization – Finding answers to problems automatically

Objectives Achieved?

NO

OptimalDesign

YESModel or Prototype

Modify DesignParameters

InitialDesign

Parameters

OPTIMIZATION PROCESS

� Finding better (optimal) designs

� Faster design evaluations

� Useful for trade-off analysis (N dimensions)

� Non-intuitive designs may be found

Optimization benefits include:Design process can be performed:

Antenna Design Using Genetic Algorithmshttp://ic.arc.nasa.gov/projects/esg/research/antenna.htm

Manually

(trial-and-error or iteratively)

Automatically

(using optimization techniques)

4

MATLAB Provides the Foundation for Optimization

The leading environment for technical computing

– Customizable – Numeric computation– Data analysis and visualization– The de facto industry-standard,

high-level programming language for algorithm development

– Toolboxes for statistics, optimization, symbolic math, signal and image processing, and other areas

– Foundation of the MathWorks product family

5

Optimization toolboxes support different problem types

�Custom data types

�More “global”

Better on � non-smooth� noisy� stochastic� highly nonlinear� ill-defined problems

�Larger Problems

�Faster

Genetic Algorithm &Direct Search Toolbox

OptimizationToolbox

Start Point

Pattern Search solution

6

Optimization Toolbox

� Graphical user interface and command line functions for:

– Linear and nonlinear programming– Quadratic programming– Nonlinear least squares and nonlinear

equations– Multi-objective optimization– Binary integer programming

� Parallel computing support in selected solvers

� Customizable algorithm options� Standard and large-scale algorithms� Output diagnostics

7

Genetic Algorithm and Direct Search Toolbox� Graphical user interface and

command line functions for:– Genetic algorithm solver

� Single objective� Multiobjective with Pareto front

– Direct search solver– Simulated annealing solver

� Useful for problems not easily addressed with Optimization Toolbox:

– Discontinuous– Highly nonlinear– Stochastic– Discrete or custom data types– Undefined derivatives

8

Demo

9

Curve Fitting Example

� MATLAB– Formulated as a linear system of equations

[ ]yEEyc

Ecc

cey

eccty

t

t

1

21

/

2

11

)(

==

=

=

+=t = [0 .3 .8 1.1 1.6 2.3]';

y = [.82 .72 .63 .60 .55 .50]';

E = [ones(size(t)) exp(-t)];

c = E\y

MATLAB Problem (linear system form)Problem Formulation

How? Least Squares Minimization(an optimization problem)

( )

2

2

2

2

2

min

0

yEc

yEc

yEc

yEc

Ecy

c−

≤−

≤−

=−=

∑ε

ε

=

50.0

55.0

60.0

63.0

72.0

82.0

1

1

1

1

1

1

2

1

1

3.2

6.1

1.1

8.0

3.0

0

e

e

e

e

e

e

c

c

Solve this overdetermined system of equations:

Can’t solve this exactly on a computer

This can be solved with acceptable error

An optimization problem!

10

Anatomy of an Optimization Problem

General Form Accepted by MATLAB SolversObjective Function

Subject to Constraints (i.e. such that)

uxl

xcbxA

xcbAx

eqeqeq

≤≤

==≤≤

0)(,

0)(,

)(min xfx

Typically a linear or nonlinear function

Linear constraints• inequalities• equalities• bounds

Nonlinear constraints• inequalities• equalities

Decision variables

11

12

Additional Resources

Upcoming webinars– TBD

Recorded webinars– Introduction to Optimization Toolbox

– Reliability Analysis and Robust Design with MATLAB products

– Genetic Algorithms in Financial Applications

13

Contact Information

� North America– Phone: 508-647-7000

– E-mail: [email protected]

� Outside North America– Contact your local MathWorks office or reseller:

www.mathworks.com/contact

©20

08 T

he M

athW

orks

, Inc

.

Questions?