Graphics Programs Reference
In-Depth Information
EXAMPLE 10.1
Use goldSearch to find x that minimizes
6 x 3
3 x 2
f ( x )
=
1
.
+
2 x
subject to the constraint x
0.Compare the result with the analytical solution.
Solution This is a constrained minimizationproblem. Either the minimum of f ( x ) is
a stationary point in x
0, orit is locatedat the constraint boundary x
=
0.Wehandle
x )] 2 .
the constraint with the penalty functionmethod by minimizing f ( x )
+ λ
[min(0
,
1 for the first step size in goldBracket (both
choices being rather arbitrary), we arrive at the following program:
Starting at x
=
1 and choosing h
=
0
.
% Example 10.1 (golden section minimization)
x=1.0;h=0.1;
[a,b] = goldBracket(@fex10
1,x,h);
[xMin,fMin] = goldSearch(@fex10
_
_
1,a,b)
The function to be minimizedis
functiony=fex10
1(x)
% Function used in Example 10.1.
lam = 1.0; % Penalty function multiplier
c = min(0.0,x); % Constraint penalty equation
y = 1.6*xˆ3 + 3.0*xˆ2 - 2.0*x + lam*cˆ2;
_
The outputfrom the program is
>> xMin =
0.2735
fMin =
-0.2899
Since the minimum wasfound to be a stationary point, the constraint was not
active. Therefore, the penalty functionwassuperfluous, but we did not know that at
the beginning.
The locationsofstationary points areobtained analyticallybysolving
f ( x )
8 x 2
=
4
.
+
6 x
2
=
0
The positive root of thisequationis x
=
0
.
273 494.Asthis is the onlypositive root,
there are no other stationary points in x
0that we must check out. The only other
possible location of a minimum is the constraint boundary x
=
0.Buthere f (0)
=
0
Search WWH ::




Custom Search