Optimasi Single Variable
Contoh fungsi single variable
(i) a discrete function
(ii) a discontinuous function
100
6 80
5
60
4
3 40
2
20
1
0
0
0 0.5 1 1.5 2 2.5 3 -20
-40
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
(iii) a continuous function
x
Fungsi unimodal kontinyus
f(x)
Contoh fungsi single var
Dalam suatu pabrik kimia, ongkos dari pemipaan, fitting dan pumping adalah
ongkos investasi yang memegang peran penting. Perhatikan desain suatu
pipa dengan panjang L yang harus membawa cairan (fluid) dengan rate Q
gpm. Pemilihan diameter diameter pipa yang ekonomis D (dalam inchi)
didasarkan pada minimasi biaya tahunan dari pipa, pompa dan pemompaan.
Misalkan ongkos tahunan dari dari suatu jaringan pipa dengan pipa baja
carbon standard dan pompa centrifugal dengan digerakkan suatu motor dapat
dinyatakan dengan persamaan fungsi berikut
f 0.245 LD1.5 325(hp)1 / 2 61.6(hp)0.925 102
8 LQ 3 9 LQ
2.68
dimana hp 4.4 x 10 5
1.92 x 10
D D 4.68
Tentukan formulasi problem optimasi single variable untuk mendesain pipa
dengan panjang 1000 ft dengan fluid rate 20 gpm. Diameter pipa harus terletak
antara 0.25 sampai 6 inchi. Fungsi diatas adalah fungsi dengan single
variable.
Grafik persoalan penentuan
diameter pipa
biaya
diameter
Prinsip-prinsip dasar Metoda kalkulus
Single-variable optimization
f(x)
A 1 , A 2 , A 3 : Relative maxima
.
A2 A 2 : Global maximum
B 1 , B 2 : Relative minima
B 1 : Global minimum
.
A1
.
A3
.
B2
.
B1
x
a b
Gambar 2.1 titik Local and global optimum pada fungsi multimodal 6
Single-variable optimization
f(x)
global maximum
inflection point
local minimum
global minimum
Gambar 2.2. Stationary points.
7
Single-variable optimization
Kriteria optimalitas
Theorem 1: syarat perlu
Syarat perlu untuk x* untuk menjadi local minimum atau
maximum suatu fungsi f(x) pada interval (a, b) adalah
f '(x*) 0 (2.1)
Jika persamaan. (2.1) dipenuhi, maka x* adalah stationary
point dari f(x), yang bisa diklasifikasikan sebagai suatu
minimum, maximum atau suatu inflection point. Suatu
titik yang menjadi kandidat optimum harus memenuhi
syarat perlu
8
Contoh saddle point f(x)=x3
80
60
x=0, adalah stationary point
40
yang menjadi saddle point
20 atau inflection point bukan
local optimum
f(x)=x3
-20
-40
-60
-80
0
x
Single-variable optimization
Theorem 2: Syarat Cukup.
Misalkan semua turunan suatu fungsi sampai dengan order (n-1) sama
dengan nol dan turunan order ke n tidak sama dengan nol:
f '(x*) f ''(x*) ... f (n 1) (x*) 0 f (n) (x*) 0 (2.2)
(n) d n f (x)
dimana f (x) (2.3)
dx n
Jika n ganjil maka x* adalah saddle point atau inflection
point.
Jika n genap, maka x* adalah local optimum. Yaitu:
(n)
Jika f (x*) 0 , maka x* adalah a local minimum.
Jika f (n) (x*) 0 maka x* adalah a local maximum. 10
Catatan
Syarat perlu dan syarat cukup, mensyaratkan
bahwa fungsi yang dievaluasi harus twice
differentiable.
Jika fungsi tersebut tidak differentiable maka
syarat cukup dan perlu tadi tidak bisa
diterapkan, dan perlu digunakan metoda lain
(bukan kalkulus) untuk menyelesaikannya.
contoh
3
f(x) x
df
0, x 0
dx
d2 f
2
0, x 0
dx
d3 f
3
6
dx
Karena n=3, ganjil, maka x=0 adalah titik infleksi.
Contoh
6 165 4 5
f(x) 5 x 36 x x 60 x 3 36
2
df
30 x 5 180 x 4 330 x 3 180 x 2 30 x 2 ( x 1)( x 2)( x 3)
dx
Turunan pertama ini bernilai 0 pada x=0, 1, 2, 3.
Sehingga titik-titik ini diklasifikasikan sebagai titik stasioner.
d2 f 4 3 2
2
150 x 720 x 990 x 360 x
dx
Pada x=0, didapat
d3 f 3 2
3
600 x 2160 x 1980 x 360 360
dx
Sehingga x=0 adalah titik infleksi.
lanjutan
x f(x) d2f/dx2
0 36 0
1 27.5 60
2 44 -120
3 -4.5 540
Pada x=1,3 fungsi mencapai local minima
dan pada x=2, fungsi mencapai local maximum.
Fungsi Convex
Suatu fungsi dengan n variabel f(x)
didefinisikan dalam set convex D dikatakan
Convex jika dan hanya jika untuk sembarang
dua titik x(1) dan x(2) dalam D dan 01,
f( x(1) + (1 - ) x(2)) f(x(1))+ (1- )f(x(2))
Properti fungsi convex
Garis yang menghubungkan dua titik sembarang yang terletak
dalam kurva selalu berada pada atau di atas kurva diantara dua
titik tersebut.
Slope atau turunan pertama dari f(x) increasing atau tidak
decreasing ketika x increase.
Turunan kedua dari f(x) selalu nonnegative untuk semua x
dalam interval
Linear approximation dari f(x) pada sembarang titik di dalam
interval tersebut selalu underestimate nilai fungsi aslinya.
Untuk suatu fungsi convex, suatu local minimum selalu
sekaligus menjadi global minimum
Fungsi convex
f(x1)+(1-)f(x2) f(x2)
f(x)
f(x1)
f[x1+(1-)x2]
x1 x1+(1-)x2 x2
Garis yang menghubungkan dua titik sembarang yang terletak
dalam kurva selalu berada pada atau di atas kurva diantara dua
titik tersebut.
f(x)
f(x)
f(x0)
f(x0)+ f(x0)(x-x0)
x0 x
Linear approximation dari f(x) pada sembarang titik
di dalam interval tersebut selalu underestimate nilai
fungsi aslinya.
Contoh: Polynomial Problem
misal: max f ( x) x 3 3x 2 9 x 10
pada interval of [-2,4].
df
x x* 3 x 2 6 x 9 0 x* 3,1
dx
40
and f(3)=37, f(-1)=5 35
3 adalah optimum point.
30
f(x) 25
20
15
10
5
-2 -1 0 1 2 3 4
x x*
The MATLAB Code contoh desain
pipa
d=linspace(0.25,6);
l=1000;q=20;
for i=1:100
hp=4.4e-8*(l*q^3)/d(i)^5
+ 1.92e-9*(l*q^2.68)
/(d(i)^4.68);
cost
f(i)=0.45*l+0.245*l*d(i)^
1.5+3.25*hp^0.5+61.6*h
p^0.925+102;
end
diameter
2. Example- Continued
Carilah nilai minimum dari f(x)=3x2+12/x-5
df/dx=6x-12/x2=0
Solutions Methods (1) Analytical
Approach
Problem:
min f x
x
s.t. a x b
Algorithm
Step 1: Set df/dx=0 and solve all stationary points.
Step 2: Select all stationary point x1, x2,…,xN in [a,b].
Step 3: Compare function values f(x1), f(x2),…,f(xN)
and find global minimum.
Example: Polynomial Problem
Example: max f ( x) x 3 3x 2 9 x 10
In the interval of [-2,4].
df
x x* 3 x 2 6 x 9 0 x* 3,1
dx
40
and f(3)=37, f(-1)=5 35
3 is the optimum point.
30
f(x) 25
20
15
10
5
-2 -1 0 1 2 3 4
x x*
Contoh Inventory Control
(Ravindran example 2.4)
Inventory quantity each time =Q units
Set up cost or ordering cost =$K
Acquisition cost =$C/unit
Storing cost per unit =$h/year
Demand (constant)= units/time unit, this
implies ordering period =T=Q/
Question: What is optimum ordering amount
Q?
Solution Cost per ordering cycle K CQ QhT / 2
Inventroy
control
Time
Objective function =Total cost per year
1 year K Qh
f(Q)=Cost per cycle* c
T year / cycle Q 2
K h 2K Q* 2K
f ' Q Q* 0 or T *
Q2 2 h h
Problems
Cost function harus dinyatakan secara
eksplisit
Turunan dari fungsi ongkos harus dituliskan
secara eksplisit
Selesaiakn persamaan turunan
Dalam banyak kasus persamaan turunan
tidak diselesaikan secara analitik tetapi
secara numerik, misalnya menggunakan
metoda Newton’s yang lebih mudah
dibanding menggunakan cara analitik
Problems - Continued
x*
a
b
Location of global
minimum
Metoda Search single variable
Min f(x), st a ≤ x ≤ b
Masalah yang sering kita hadapi
Untuk sembarang titik x mungkin f’(x) tidak eksis
jadi kita tidak bisa menggunakan metoda kalkulus. Perlu suatu
metoda yang tidak memerlukan f’(x).
f’(x)=0, sulit dicari solusinya
Untuk fungsi tertentu, kadang-kadang f’(x) = 0 tidak mudah
dicari solusinya. Apalagi kalau f’(x) mempunyai pangkat
pecahan. Untuk itu perlu dicari cara bagaimana menemukan
titik optimal yang tidak memakai turunan.
Metodanya antara lain: Interval halving, Golden section
Interval halving (tidak memakai gradien)
Kita asumsikan fungsi f(x) adalah fungsi
minimasi unimodal dalam selang [a,b]. Dalam
interval halving kita bagi interval pencarian
menjadi empat bagian yang sama dan dalam
setiap iterasi kita kurangi intervalnya menjadi
separuh dari interval semula.
Interval Halving
f(x) Minimum terletak antara (a,x2)
f2
f1
fm
x
a x1 xm x2 b
Situasi dimana f(x1)<f(x2)
Interval Halving
f(x) Minimum terletak antara (x1,b)
f1
f2
fm
x
a x1 xm x2 b
Situasi dimana f(x1)>f(x2)
Algoritma Interval halving
Ulangi sampai kriteria penghentian dipenuhi
L=b-a;
xm=(a+b)/2;
x1=a+L/4;
x2=b-L/4;
Hitung f(x1), f(x2) dan f(xm)
Jika f(x1)<= f(xm)
maka eliminasi (xm,b) dan set b=xm;
jika f(x2)<= f(xm)
maka eliminasi (a,xm) dan set a=xm;
jika f(xm) ≤ f(x1) dan f(xm) ≤ f(x2)
maka eliminasi (a,x1) dan set a=x1;
eliminasi (x2,b) dan set b=x2;
Selesai
contoh
Carilah minimum dari f(x)=(100-x)2,
60 ≤x ≤ 150, dengan interval halving
a=60, b=150, L=150-60=90
xm=0.5(60+150)=105
x1=60+(1/4) 90=82.5, x2=150-(1/4)90=127.5
f(x1)=(100-82.5)2=306.5, f(xm)=25
f(x2)=(100-127.5)2=756.25, bandingkan
Karena f(x1)>f(xm) dan f(x2)>f(xm) maka
a=82.5, b=127.5 xm=105; dst
Golden Section
Golden section search, salah satu metoda untuk
mencari titik optimal pada single variabel jika
diketahui interval awal b-a
f(x) Golden section ratio:
1 5
τ 0,61803...
2
(1-τ)L 0 τL 0 1-τ
τL 0 (1-τ)L 0
a x3 x1 x2 b x τ
τ2L 0
L0
35
Ide dasar
(untuk kasus minimasi fungsi)
Kita ambil 2 titik x1 < x2 dalam L=[a,b], bandingkan f(x1) dan f(x2),
jika
kasus 1
Dalam kasus minimasi jika f(x1) < f(x2) maka kita eliminasi area
x > x2 sehingga x*[a,x2].
kasus 2
f(x1) = f(x2) maka eliminasi area x < x1 dan x > x2 , sehingga
x*[x1,x2].
kasus 3
f(x1) > f(x2) maka eliminasi area x < x1 sehingga x*[x1,b]
L1
a x1 x2 b
L2
L3 L4
b x2 x1 a
Dalam hal ini berlaku prinsip L1=L2+L3
L2=L3+L4 dan
jika L2 = rL1 dan L3= rL2 = r2L1 ,
dimasukkan ke dalam L1=L2+L3, maka akan
didapat
L1= rL1+ r2L1 r+r2-1=0
Dengan menyelesaikan persamaan kuadrat
ini ditemukan r=0.618.
Golden section search
Panjang interval awal mencakup titik optimal:
L0 = b – a
Fungsi f(x) dievaluasi pada 2 titik:
x1 a (1 )L 0
x 2 a L 0
jika f(x1) < f(x2), maka x* terletak dalam interval (a, x2).
jika f(x1) ≥ f(x2), maka x terletak dalam interval (x1, b).
Panjang interval baru: L1 x 2 a b x1 = τ L 0
39
Golden section search
panjang dari interval of uncertainty setelah N iterasi:
L N τ N L0
jumlah iterasi yang diperlukan untuk suatu interval of uncertainty, LN:
n L N L 0
N
n τ
Convergence criteria:
(i) N N max
(ii) L N ε1
(iii)
f x N 1 f x N ε2 40
Algoritma: Golden-Search
Tentukan a, b
Lakukan sampai stopping criteria tercapai (jumlah
iterasi)
r=0.618;
x1= a+(1-r)*(b-a);
x2= a-r*(b-a);
jika f(x1) > f(x2), a=x1;
jika f(x1)=f(x2), a=x1,b=x2;
Untuk lainnya (f(x1)<f(x2))
b=x2;
end
Contoh f(x)=(100-x)2 ,
60<=x<=150
Gunakan a=60, b=150, r=0.618
x1=60+(1-0.618)(150-60)=
x2=60+0.618(90)=
Bandingkan f(x1) dan f(x2)
PR
buku Eng Optimization (Ravindran) exercise
2.1,2.2,2.3,2.4,2.6,2.7
Tulis tangan
Jika 2 orang sama, nilai dibagi 2.
MATLAB CODING – The Golden
Search
function al_opt=goldsec(op2_func,tol,x0,d)
b=1;a=0;l=b-a;
tau=0.61803;
x2=a+tau*l;
x1=a+(1-tau)*l;
while l>tol
xx1=x0+x1*d;xx2=x0+x2*d;
y1=feval(op2_func,xx1);y2=feval(op2_func,xx2);
jika(y1>=y2) a=x1;x1=x2;l=b-a;x2=a+tau*l;
else
b=x2;x2=x1;l=b-a;x1=a+(1-tau)*l;
end
end
al_opt=b;
Example : The Piping Problem
x0=0.25;d=6-0.25;tol=1.e-6;
al_opt=goldsec('obj_piping',tol,x0,d);
D=x0+al_opt*d;
function y=obj_piping(D)
%D(in)
L=1000;%ft
Q=20;%gpm
hp=4.4e-8*(L*Q^3)/(D^5)+1.92e-9*(L*Q^2.68)/(D^4.68);
y=0.45*L+0.245*L*D^1.5+3.25*(hp)^0.5+61.6*(hp)^0.925+102;
al_opt =0.1000
D =0.8250
fun_call =29
Remarks
Setiap tahap, hanya satu function evaluation
yang diperlukan.
panjang interval pencarian mengecil dengan
r pada tiap iterasi L L 0.618...
N 1
N
Newton – Raphson method
f xk
Series of trial points: xk 1 xk (5.23)
f x k
f'(x)
x1 x*
x3 x2 x
Newton – Raphson method (convergence). 47
Newton – Raphson method
Convergence criteria:
(i)
f x k 1 ε1
(ii) xk 1 xk ε2
(iii)
f x k 1 f x k ε3
48
Newton – Raphson method
f'(x)
x* x0 x1 x2 x3 x
Fig. 5.6. Divergence of Newton – Raphson method.
49
The Importance of One-dimensional Problem
- The Iterative Optimization Procedure
Optimization is basically performed in a fashion of
iterative optimization. We give an initial point x0,
and a direction s, and then perform the following
line search:
x1 x 0 * s
where * is the optimal point for the objective function
and satisfies all the constraints. Then we start from
x1 and find the other direction s’, and perform a
new line search until the optimum is reached.
The Importance of One-dimensional Problem
- The Iterative Optimization Procedure -
Continued
Consider a objective
function Min f(X)=
x12+x22, with an initial
point X0=(-4,-1) and
a direction (1,0), what
is the optimum at this
direction, i.e. X1=X0
+*(1,0). This is a one
-dimensional search for
.
The Importance of One-dimensional Problem
- The Iterative Optimization Procedure -
Continued
The problem can be converted into:
min f 4 1 17 8 2
2 2
df
8 2 0
d
4 QED
The new point is at
(0,-1) as shown
Solution Methods (2) – Numerical
Approaches: (i) Numerical Solution to Optimality
Condition
Example: Determine the
minimum of
f(x)=(10x3+3x2+x+5)2
The optimality criteria
leads:
2(10x3+3x2+x+5)
(30x2+6x+1)=0
Problem: What is the root
of the above equation?
Newton’s Method
Consider a equation to be solved:
f(x)=0;
Step 1: give an initial point x0
Step 2: xn+1=xn-f(xn)/f’(xn)
Step 3: is f(xn) small enough? If not go back
to step 2
Step 4: stop
Newton’s Method (example)
MATLAB code
x0=10;fx=100;iter=0;ff=[];xx=[];
while abs(fx)>1.e-5
fx=2*(10*x0^3+3*x0^2+5)*(30*x0^2+6*x0+1);
ff=[ff;fx];
fxp=2*((30*x0^2+6*x0+1)*(30*x0^2+6*x0+1)+(10*x0^3+3*x0^2+
5)*(60*x0+6));
x0=x0-fx/fxp;
xx=[xx;x0];
iter=iter+1;
end
fx = -1.6983e-006
iter = 53
x0 = -0.9073
A Numerical Differentiation Approach
Problem: Find df/dx at a point xk
Approach:
Define xk
Find f(xk)
Find f(xk+ xk )
Approximate df/dx=[(f(xk+ xk )- f(xk))/ xk ]
A Numerical Differentiation
Approach-MATLAB code
x0=10;fx=100;iter=0;ff=[];xx=[];dx=0.001;
while abs(fx)>1.e-5
fx=2*(10*x0^3+3*x0^2+5)*(30*x0^2+6*x0+1);
ff=[ff;fx];
xp=x0+dx;
ffp=2*(10*xp^3+3*xp^2+5)*(30*xp^2+6*xp+1);
fxp=(ffp-fx)/dx;
x0=x0-fx/fxp;
xx=[xx;x0];
iter=iter+1;
end
fx = -4.4285e-008
iter = 38
x0 = -0.9073
Remarks (Numerical Solution to
Optimality Condition)
Difficult to formulate the optimality condition
Difficult to solve (multi-solutions, complex
number solutions)
Derivative may be very difficult to solve
numerically
Function calls are not saved in most cases
New Frontier: Can we simply implement
objective function instead of its derivative?
Solution Methods (2) – Numerical Approaches (ii)
Reginal Elimination Methods
Thorem: Suppose f is uni-model on the
interval a xb, with a minimum at x* (not
necessary a stationary point), let x1, x2[a,b]
such that a< x1< x2<b, then:
If f(x1)> f(x2) x*[x1,b]
If f(x1)< f(x2) x*[a, x2]
Two Phase Approach
Phase I. Bounding Phase: An initial course
search that will bound or bracket the optimum
Phase II. Interval Refinement Phase: A finite
sequence of interval reductions or
refinements to reduce the initial search
interval to desired accuracy.
Phase II- Interval Refinement Phase
- Interval Halving
Algorithm ab
xm
Step 1: Let , L= b-a, 2find f(xm)
Step 2: Set x1=a+L/4, x2=b-L/4.
Step 3: Find f(x1), if f(x1)<f(xm), then bxm,
go to step 1.
if f(x1)>f(xm), continue
Step 4: Find f(x2)
If f(x2)<f(xm), then axm, go to step 1.
If f(x2)>f(xm), then ax1, bx2, go to step 1.
Example:y=(10*x^3+3*x^2+x+5)^2;
a=-3;b=3;l=b-a;xm=(a+b)/2;x1=(a+xm)/2;x2=(xm+b)/2; fm=inter_hal_obj(xm);
iter=1;
while l>1.e-8
f1=inter_hal_obj(x1);
if f1<=fm
b=xm;
else
f2=inter_hal_obj(x2);
if f2<=fm
a=xm;
else
a=x1;
b=x2;
end
end
xm=(a+b)/2;x1=(a+xm)/2;x2=(xm+b)/2; fm=inter_hal_obj(xm);
l=b-a;
iter=iter+1;
end
b =-0.8599
iter = 31
fun_call =82
Remarks
At each stage of the algorithm, exactly half
of the search is deleted.
At most two function evaluations are
necessary at each iteration.
After n iterations, the initial search interval
n
will be reduced to 1
2
According to Krefer, the three point search
is most efficient among all equal-interval
searches.
Remarks - Continued
LN
Define , N = number of experiments, or
FR
L1
function evaluations.
0.5 N / 2 for interval halving
FR N 1
0.618 for golden search
Let E = FR(N)
2 ln E
N for interval halving
ln 0.5
ln E
N 1 for gold search
ln 0.618
Method E=0.1 E=0.05 E=0.01 E=0.001
I.H. 7 9 14 20
G.S. 6 8 11 16
Solution Methods (2) – Numerical Approaches
(iii) Polynomial Approximation Methods –
Powell’s Method
Powell’s method is to approximate an
objective function by a quadratic function
such as f(x)=ax2+bx+c, then it can be shown
the optimum is located at x*=-b/2a.
Given the above equation we need to do
three experiments (function calls) to fit a
quadratic function, let the three experiments
(function calls) located at: f(x1), f(x2), f(x3) and
let’s rewrite the quadratic equation based on
the new notation: qx a0 a1 x x1 a 2 x x1 x x 2
Powell’s Method- Continued
The parameters in the previous slide can be
found using three experiments:
f x1 f1 a0
f 2 f1
f x2 f 2 a0 a1 x2 x1 a1
x2 x1
11 f 3 f1 f 2 f1
f x3 f 3 a0 a1 x3 x1 a2 x3 x1 x3 x2 a2
x3 x2 x3 x1 x2 x1
At the optimum point, it can be derived based
on the above three experiments, such that
dq
0 a1 a 2 x * x 2 a 2 x * x1 or x*
x 2 x1 a
1
dx 2 2a 2
Algorithm (Powell’s Method)
Step 1: Given x0, x, x1=x0+x, ,
Step 2: Evaluate f(x0), f(x1)
If f(x1)> f(x0), then x2=x0-x
If f(x1)< f(x0), then x2=x0+2x
Step 3: find f(x2)
Step 4: Find Fmin=min (f(x0), f(x1), f(x2))
Xmin= x0, x1, x2, such that f(xmin)= Fmin, i=0,1,2.
Step 5: Get a1, a2
Step 6: Get x*, find f(x*).
Step 7: Check if (i) Fmin f ( x*) or (ii) x * x min Yes, stop.
No, continue
Step 8: set x2x*, x1xmin, x0one of x0, x1, x2 not xmin
Go to step 4.
Powell’s Method – MATLAB code
function alopt=one_dim_pw(xx,s,op2_func)
dela=0.005;
alp0=0.01;
alpha(1)=alp0;alpha(2)=alpha(1)+dela;
al=alpha(1);x1=xx+al*s;
y(1)=feval(op2_func,x1);
al=alpha(2);x2=xx+s*alpha(2);
y(2)=feval(op2_func,x2);
if(y(2)>=y(1)) alpha(3)=alpha(1)-dela;
else alpha(3)=alpha(1)+2*dela;
end
eps=100;
delta=100;
while eps>0.001|delta>0.001
x3=xx+s*alpha(3);
y(3)=feval(op2_func,x3);
fmin=min(y);
Powell’s Method – MATLAB code
-Continued
if(fmin==y(1)) almin=alpha(1);i=1;
else if(fmin==y(2)) almin=alpha(2);i=2;
else almin=alpha(3);i=3;
end
end
a0=y(1);a1=(y(2)-y(1))/(alpha(2)-alpha(1));
a2=1/(alpha(3)-alpha(2))*((y(3)-y(1))/(alpha(3)-alpha(1))-(y(2)-y(1))/(alpha(2)-alpha(1)));
alopt=(alpha(2)+alpha(1))/2-a1/(2*a2);
xxopt=xx+alopt*s;
yopt=feval(op2_func,xxopt);
eps=abs(fmin-yopt);
delta=abs(alopt-almin);
for j=1:3
if(j~=i) alpha(1)=alpha(j);
end
end
alpha(3)=alopt;alpha(2)=almin;
x1=xx+s*alpha(1);x2=xx+s*alpha(2);
y(1)=feval(op2_func,x1);y(2)=feval(op2_func,x2);
end
Example: Piping Design
global fun_call
x0=0.25;x_end=6;l=x_end-x0;
al_opt=one_dim_pw(x0,l,'obj_piping')
D=x0+al_opt*l
fun_call
al_opt = 0.1000
D =0.8250
fun_call =61
Comparison – Interval_halving
(tol=1.e-6)
l=
6.8545e-007
b=
0.8250
a=
0.8250
iter =
24
fun_call =
63