Sie sind auf Seite 1von 13

Prob 1

1a) Himmelblau function : Himmelblau function is a mathematical


function with multiple minima and is used to check the performance of
optimization schemes. It is named after David Himmelblau and it is
referenced in a 1972 book named Applied Nonlinear Programming.
Mathematically, the function is defined as
2

f ( x , y ) =( x 2+ y11 ) + ( x + y 27 )

The function is usually evaluated in range


x , y (6,6)

1b) Plot Contours


For all the contour plots, the UTA_ContourPlot function was used within the
mentioned ranges
Code for contours :

Function

Plot :

Fig 1 Contour plot for HimmelBlau function


1c) Solve using fminunc 4 times :
PROCEDURE:

The function is sought to be minimized using the fminunc built in


matlab function.
The minimum function value and corresponding variable values will
depend on the initial guess provided since fminunc finds the closest
local minima.
The second step is repeated using 4 points ( 6,6) , (-6,6) , (6,-6) and (6,-6)
The values of minimum x , y and fmin are presented in a table below

The same procedure is followed for 2c and 3c for solving the respective
functions with the fminunc matlab function.

Contour

1749

1093
218.6

1093

43.75
2.215
0.2473
21.89

2.215 43.75

109.3
2.215
0.2473

43.75

-2

21.89

2.215
0.2473
21.89

-4

437.2
1093

-6
-6

-4

-2

0
x

1093
2

Fig. Contour plot with (6,6) as initial point and (3,2) as local minima

1749

1093
218.6

1093

43.75
2.215
0.2473
21.89

2.215 43.75

109.3
2.215
0.2473

43.75

-2

21.89

2.215
0.2473
21.89

-4

437.2
1093

-6
-6

-4

-2

0
x

1093
2

Fig. Contour plot with (-6,6) as starting point and (-2.8051,3.1313)


as local minima

1749

1093
218.6

1093

43.75
2.215
0.2473
21.89

2.215 43.75

109.3
2.215
0.2473

43.75

-2

21.89

2.215
0.2473
21.89

-4

437.2
1093

-6
-6

-4

-2

1093

0
x

Fig. Contour plot with ( 6,-6) as starting point and ( 3.5844, -1.8481)
as local minima

1749

1093
218.6

1093

43.75
2.215
0.2473
21.89

2.215 43.75

109.3
2.215
0.2473

43.75

-2

21.89

2.215
0.2473
21.89

-4

437.2
1093

-6
-6

-4

-2

0
x

1093
2

Fig. Plot with (-6,-) as starting point and (-3.7793,-3.2832) as local


minima
Code

1d) GENERIC ALGORITHM


A genetic algorithm (GA) is a method for solving both constrained and
unconstrained optimization problems based on a natural selection process
that mimics biological evolution1. At each step, the genetic algorithm
randomly selects individuals from the current population and uses them as
parents to produce the children for the next generation with which the
population "evolves" toward an optimal solution1.
The matlab ga optimation toolbox was used to perform the ga optimization
process for the d subsections of this homework
PROCEDURE

The objective function is created in a separate matlab file and is saved


in the working directory
The generic algorithm optimization method was chosen during
initialization of the toolbox
The function was included through the file created earlier and the
number of variables was given to be 2
The upper and lower bound ranges were provided and the algorithm
was executed
The global minimum of the function along with the respective value of
x and y were given as output.

TOOL BOX

Fig. GA toolbox output for Prob. 1

RESULTS
x=
3
1.4181678397053073E-7

y=

fmin =

Prob 2
2a) Six Hump Camel Back Function : The significance of new
optimization algorithms depends on the effectiveness of solving practical
problems. Six Hump camel back function is used to test the performance and
reliability of optimization algorithms. Six Hump Back Camel Function :
1
f ( x , y ) = 42.1 x 2 + x 4 x 2 + xy + (4 +4 y 2 ) y 2
3

Where

(3 x 3,2 y 2)

It is known that the function has six local minima, as the name of the
function suggests and has one global minimum value at two points. Because
of this, many algorithms can only find the local minima but miss the global
optimization solution.
2b) Plot Contours
code

Function

Plot

Fig.2 Contour Plots for Six Hump Camel Back Function


2c) Solve using fminunc:

2d) GENERIC ALGORITHM


x=

0.09

y=

-0.713

fmin= -1.0316284494150305

Fig : Output from Matlab GA for Prob. 2

Prob. 3
3a) Branin rcos function : It is a global optimization test function. The
function has three global optima.
Function definition :
2
5.1 2 5
1
(
)
f x , y =1 y 2 x + x6 + 10 1
cos x+ 10

8
4

Range for the function is


5 x 10,0 y 15

) (

3b) Contour plot


Code

Plot

Fig 3. Contour plot of Branin rcos function

3c) Solve using fminunc:

3d) GENERIC ALGORITHM

Fig: Matlab GA output for Prob. 3


X = 3.14

y= 2.275 Fmin=0.39788642863474166

Reference
[1] http://www.mathworks.com/discovery/genetic-algorithm.html

Das könnte Ihnen auch gefallen