Scientific Computing, Lecture Notes - Computer Science - 3, Study notes of Computer Numerical Control

Optimisation, Graphical Solution, Bisection method, convergence newton's method, Secant method, method of false position, golden section method

Typology: Study notes

2010/2011

Uploaded on 09/09/2011

jennyfromtheblock
jennyfromtheblock 🇬🇧

2.3

(3)

225 documents

1 / 23

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Optimisation
The general problem:
Want to minimise some function F(x) subject
to constraints,
ai(x) = 0, i=1,2,…,m1
bi(x) ¥0, i=1,2,…,m2
where xis a vector of length n.
F( ) is called the objective function.
•a
i( ) and bi( ) are called the constraint
functions.
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17

Partial preview of the text

Download Scientific Computing, Lecture Notes - Computer Science - 3 and more Study notes Computer Numerical Control in PDF only on Docsity!

Optimisation

  • The general problem:

Want to minimise some function F(

x

) subject

to constraints,

a

( x i^

) = 0, i=1,2,…,m

1

b

( x i^

)^

0, i=1,2,…,m

2

where

x

is a vector of length n.

  • F( ) is called the

objective function

  • a

( ) and bi

( ) are called thei

constraint

functions

Special Cases

  • If n=1 there is just one variable, and we have

the

univariate

case (as opposed to the

multivariate

case).

  • If a

(x) and bi

(x) are linear functions then wei

have

linear constraints

(as opposed to

nonlinear constraints

  • If m

=0 we have 2

equality constraints

only.

  • If m

=0 we have 1

inequality constraints

only.

  • If m

=m 1

=0 we have the 2

unconstrained

case.

Example Linear Problem

-^

An oil refinery can buy light crude at £35/barrel andheavy crude at £30/barrel.

-^

Refining one barrel of oil produces petrol, heating oil,and jet fuel as follows:

Petrol

Heating oil

Jet fuel

Light crude

Heavy crude

-^

The refinery has contracts for 0.9M barrels of petrol,0.8M barrels of heating oil and 0.5M barrels of jet fuel.

-^

How much light and heavy crude should the refinerybuy to satisfy the contracts at least cost?

Problem Specification

•^

Let x

1

and x

2

be the number of barrels (in

millions) of light and heavy crude that therefinery purchases.

-^

Cost (in millions of £): F(

x

) = 35x

1

  • 30x

2

•^

Constraints:

0.3x

1

  • 0.3x

2

0.9 (petrol)

0.2x

1

  • 0.4x

2

0.8 (heating oil)

0.3x

1

  • 0.2x

2

0.5 (jet fuel)

x

1

0, x

2

0 (non-negativity)

This is calleda “linearprogram”

Solution

(x

,x 1

F

( x

  • So minimum cost is for x

1

= 0 and x

2

Recall that:

F(

x ) = 35x

1

  • 30x

2

Unconstrained Univariate Case •^

We seek to minimise f(x).

-^

If x* minimises f(x) then:

i.^

f^

£(x*) = 0 (first order condition)

ii.

f^

≥(x*)

¥

0 (second order condition)

f(x) = (x-1)(x-1)+

Bisection Method

-^

Suppose we have already bracketed thezero in the interval [a,b]. Then:

Evaluate f at mid-point c=(a+b)/2.

If f(c) is zero then quit.

If f(a) and f(c) have the same sign then set a=c;else set b=c.

Go to Step 1.

a^

b

(a+b)/

MATLAB Example

f=@(x)(2x-4sin(x)); >> a=1; fa=f(a); >> b=2; fb=f(b); >> c=(a+b)/2;fc=f(c);if fa*fc>0 a=c; else b=c; end;c •^

Using the up arrow to repeat the last line we getvalues of c that converge to the solution off(x)=0.

f(x

)k

Newton’s Method

  • Given an estimate x

k^

of the zero a better

estimate is obtained by approximating thefunction by the tangent line at x

.k

xk

xk+

f^

£(x

) = f(xk

)/(xk

-xk^

k+

x

k+

= x

k^

  • f(x

)/fk

£ (x

)k^

Convergence of Newton’s Method

  • Error can be shown to be quadratic if initial

estimate of zero is sufficiently close to x*.

|x*-x

k+

| < M|x*-x

|k^

2

for some constant M. (Proof: Taylor seriesexpansion of f(x*) about x

.)k

Problems with Newton’s Method • Problems may arise if the initial estimate is

not “sufficiently close” to the zero.

  • Consider f(x)=ln(x).

e

1

If 0<x

<e then 1

Newton’s methodwill converge. If x

e it will fail.

Linear Interpolation Methods

-^

Newton method requires first derivative at each iteration.

-^

The bisection method doesn’t use the magnitudes of f ateach end of the interval.

-^

Suppose we use f(a

) and f(bn

) and finds a new estimaten

of the zero by approximating the function between a

n^

and

b

n^

by a straight line.

f(b

)n

b

n

a

n

xn

f(a

)n

⎞ ⎟⎟ ⎠

⎛ ⎜⎜ ⎝

− −

=^

) ( ) ( ) ( n

n

n

n

n

n

n^

a f

b f

a b a f a x

Method of False Position

•^

To avoid possible divergence problem withthe secant method we keep the zerobracketed in an interval (a,b), as in thebisection method.

(^

a

f

b

f

a b a f a c

•^

If f(c) = 0 we are finished.

-^

If f(a) and f(c) have the same sign we replacea by c; otherwise, we replace b by c.

Golden Section Method

  • A function is

unimodal

on an interval [a,b]

if it has a single local minimum on [a,b].

  • The Golden Section method can be used

to find the minimum of function F on [a,b],where F is unimodal on [a,b].

  • This method is not based on solving

F

£ (x)=0.

  • We seek to avoid unnecessary function

evaluations.