slide1 n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Tier I: Mathematical Methods of Optimization PowerPoint Presentation
Download Presentation
Tier I: Mathematical Methods of Optimization

Loading in 2 Seconds...

play fullscreen
1 / 120

Tier I: Mathematical Methods of Optimization - PowerPoint PPT Presentation


  • 335 Views
  • Uploaded on

Tier I: Mathematical Methods of Optimization. Section 3: Nonlinear Programming. Introduction to Nonlinear Programming. We already talked about a basic aspect of nonlinear programming (NLP) in the Introduction Chapter when we considered unconstrained optimization.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Tier I: Mathematical Methods of Optimization' - starbuck


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
tier i mathematical methods of optimization
Tier I: Mathematical Methods of Optimization

Section 3:

Nonlinear Programming

introduction to nonlinear programming
Introduction to Nonlinear Programming
  • We already talked about a basic aspect of nonlinear programming (NLP) in the Introduction Chapter when we considered unconstrained optimization.
introduction to nonlinear programming1
Introduction to Nonlinear Programming
  • We optimized one-variable nonlinear functions using the 1st and 2nd derivatives.
  • We will use the same concept here extended to functions with more than one variable.
multivariable unconstrained optimization
Multivariable Unconstrained Optimization
  • For functions with one variable, we use the 1st and 2nd derivatives.
  • For functions with multiple variables, we use identical information that is the gradient and the Hessian.
  • The gradient is the first derivative with respect to all variables whereas the Hessian is the equivalent of the second derivative
the gradient
The Gradient
  • Review of the gradient ():

For a function “f”, of variables x1, x2, …, xn:

Example:

the hessian
The Hessian
  • The Hessian (2) of f(x1, x2, …, xn) is:
hessian example
Hessian Example
  • Example (from previously):
unconstrained optimization
Unconstrained Optimization

The optimization procedure for multivariable functions is:

  • Solve for the gradient of the function equal to zero to obtain candidate points.
  • Obtain the Hessian of the function and evaluate it at each of the candidate points
    • If the result is “positive definite” (defined later) then the point is a local minimum.
    • If the result is “negative definite” (defined later) then the point is a local maximum.
positive negative definite
Positive/Negative Definite
  • A matrix is “positive definite” if all of the eigenvalues of the matrix are positive (> 0)
  • A matrix is “negative definite” if all of the eigenvalues of the matrix are negative (< 0)
positive negative semi definite
Positive/Negative Semi-definite
  • A matrix is “positive semi-definite” if all of the eigenvalues are non-negative (≥ 0)
  • A matrix is “negative semi-definite” if all of the eigenvalues are non-positive (≤ 0)
example matrix
Example Matrix

Given the matrix A:

The eigenvalues of A are:

This matrix is negative definite

unconstrained nlp example
Unconstrained NLP Example

Consider the problem:

Minimize f(x1, x2, x3) = (x1)2 + x1(1 – x2) + (x2)2 – x2x3 + (x3)2 + x3

First, we find the gradient with respect to xi:

unconstrained nlp example1
Unconstrained NLP Example

Next, we set the gradient equal to zero:

So, we have a system of 3 equations and 3 unknowns. When we solve, we get:

unconstrained nlp example2
Unconstrained NLP Example

So we have only one candidate point to check.

Find the Hessian:

unconstrained nlp example3
Unconstrained NLP Example

The eigenvalues of this matrix are:

All of the eigenvalues are > 0, so the Hessian is positive definite.

So, the point is a minimum

unconstrained nlp example4
Unconstrained NLP Example

Unlike in Linear Programming, unless we know the shape of the function being minimized or can determine whether it is convex, we cannot tell whether this point is the global minimum or if there are function values smaller than it.

method of solution
Method of Solution
  • In the previous example, when we set the gradient equal to zero, we had a system of 3 linear equations & 3 unknowns.
  • For other problems, these equations could be nonlinear.
  • Thus, the problem can become trying to solve a system of nonlinear equations, which can be very difficult.
method of solution1
Method of Solution
  • To avoid this difficulty, NLP problems are usually solved numerically.
  • We will now look at examples of numerical methods used to find the optimum point for single-variable NLP problems. These and other methods may be found in any numerical methods reference.
newton s method
Newton’s Method

When solving the equation f (x) = 0 to find a minimum or maximum, one can use the iteration step:

where k is the current iteration.

Iteration is continued until |xk+1 – xk| <e where e is some specified tolerance.

newton s method diagram
Newton’s Method Diagram

Newton’s Method approximates f(x) as a straight line at xkand obtains a new point (xk+1), which is used to approximate the function at the next iteration. This is carried on until the new point is sufficiently close to x*.

Tangent of f(x) at xk

x

x*

xk

xk+1

f(x)

newton s method comments
Newton’s Method Comments
  • One must ensure that f (xk+1) < f (xk) for finding a minimum and f (xk+1) > f (xk) for finding a maximum.
  • Disadvantages:
    • Both the first and second derivatives must be calculated
    • The initial guess is very important – if it is not close enough to the solution, the method may not converge
regula falsi method
Regula-Falsi Method

This method requires two points, xa & xb that bracket the solution to the equation f (x) = 0.

where xc will be between xa & xb. The next interval will be xc and either xa or xb, whichever has the sign opposite of xc.

regula falsi diagram
Regula-Falsi Diagram

The Regula-Falsi method approximates the function f(x) as a straight line and interpolates to find the root.

f(x)

xc

xa

x

x*

xb

regula falsi comments
Regula-Falsi Comments
  • This method requires initial knowledge of two points bounding the solution
  • However, it does not require the calculation of the second derivative
  • The Regula-Falsi Method requires slightly more iterations to converge than the Newton’s Method
multivariable optimization
Multivariable Optimization
  • Now we will consider unconstrained multivariable optimization
  • Nearly all multivariable optimization methods do the following:
    • Choose a search direction dk
    • Minimize along that direction to find a new point:

where k is the current iteration number and ak is a positive scalar called the step size.

the step size
The Step Size
  • The step size, ak, is calculated in the following way:
  • We want to minimize the function f(xk+1) = f(xk +akdk) where the only variable is ak because xk & dk are known.
  • We set and solve for ak using a single-variable solution method such as the ones shown previously.
steepest descent method
Steepest Descent Method
  • This method is very simple – it uses the gradient (for maximization) or the negative gradient (for minimization) as the search direction:

for

So,

steepest descent method1
Steepest Descent Method
  • Because the gradient is the rate of change of the function at that point, using the gradient (or negative gradient) as the search direction helps reduce the number of iterations needed

x2

f(x) = 5

-f(xk)

f(x) = 20

f(xk)

xk

f(x) = 25

x1

steepest descent method steps
Steepest Descent Method Steps

So the steps of the Steepest Descent Method are:

  • Choose an initial point x0
  • Calculate the gradient f(xk) where k is the iteration number
  • Calculate the search vector:
  • Calculate the next x:Use a single-variable optimization method to determine ak.
steepest descent method steps1
Steepest Descent Method Steps
  • To determine convergence, either use some given tolerance e1 and evaluate:for convergence

Or, use another tolerance e2 and evaluate:for convergence

convergence
Convergence
  • These two criteria can be used for any of the multivariable optimization methods discussed here

Recall: The norm of a vector, ||x|| is given by:

steepest descent example
Steepest Descent Example

Let’s solve the earlier problem with the Steepest Descent Method:

Minimize f(x1, x2, x3) = (x1)2 + x1(1 – x2) + (x2)2 – x2x3 + (x3)2 + x3

Let’s pick

steepest descent example1
Steepest Descent Example

Now, we need to determine a0

steepest descent example2
Steepest Descent Example

Now, set equal to zero and solve:

steepest descent example4
Steepest Descent Example

Take the negative gradient to find the next search direction:

steepest descent example5
Steepest Descent Example

Update the iteration formula:

steepest descent example6
Steepest Descent Example

Insert into the original function & take the derivative so that we can find a1:

steepest descent example7
Steepest Descent Example

Now we can set the derivative equal to zero and solve for a1:

steepest descent example8
Steepest Descent Example

Now, calculate x2:

steepest descent example10
Steepest Descent Example

Find a2:

Set the derivative equal to zero and solve:

steepest descent example12
Steepest Descent Example

Find the next search direction:

steepest descent example15
Steepest Descent Example

The next search direction:

steepest descent example18
Steepest Descent Example

Let’s check to see if the convergence criteria is satisfied

Evaluate ||f(x5)||:

steepest descent example19
Steepest Descent Example

So, ||f(x5)|| = 0.0786, which is very small and we can take it to be close enough to zero for our example

Notice that the answer of

is very close to the value of that we obtained analytically

quadratic functions
Quadratic Functions
  • Quadratic functions are important for the next method we will look at
  • A quadratic function can be written in the form: xTQx where x is the vector of variables and Q is a matrix of coefficients

Example:

conjugate gradient method
Conjugate Gradient Method
  • The Conjugate Gradient Method has the property that if f(x) is quadratic, it will take exactly n iterations to converge, where n is the number of variables in the x vector
  • Although it works especially well with quadratic functions, this method will work with non-quadratic functions also
conjugate gradient steps
Conjugate Gradient Steps
  • Choose a starting point x0 and calculate f(x0). Let d0 = -f(x0)
  • Calculate x1 using:Find a0 by performing a single-variable optimization on f(x0 +a0d0) using the methods discussed earlier. (See illustration after algorithm explanation)
conjugate gradient steps1
Conjugate Gradient Steps
  • Calculate f(x1) and f(x1). The new search direction is calculated using the equation:

This can be generalized for the kth iteration:

conjugate gradient steps2
Conjugate Gradient Steps
  • Use either of the two methods discussed earlier to determine tolerance:

Or,

number of iterations
Number of Iterations
  • For quadratic functions, this method will converge in n iterations (k = n)
  • For non-quadratic functions, after n iterations, the algorithm cycles again with dn+1 becoming d0.
step size for quadratic functions
Step Size for Quadratic Functions
  • When optimizing the step size, we can approximate the function to be optimized in the following manner:
  • For a quadratic function, this is not an approximation – it is exact
step size for quadratic functions1
Step Size for Quadratic Functions

We take the derivative of that function with respect to a and set it equal to zero:

The solution to this equation is:

step size for quadratic functions2
Step Size for Quadratic Functions
  • So, for the problem of optimizing a quadratic function,

is the optimum step size.

  • For a non-quadratic function, this is an approximation of the optimum step size.
multivariable newton s method
Multivariable Newton’s Method

We can approximate the gradient of f at a point x0 by:

We can set the right-hand side equal to zero and rearrange to give:

multivariable newton s method1
Multivariable Newton’s Method

We can generalize this equation to give an iterative expression for the Newton’s Method:

where k is the iteration number

newton s method steps
Newton’s Method Steps
  • Choose a starting point, x0
  • Calculate f(xk)and 2f(xk)
  • Calculate the next x using the equation
  • Use either of the convergence criteria discussed earlier to determine convergence. If it hasn’t converged, return to step 2.
comments on newton s method
Comments on Newton’s Method
  • We can see that unlike the previous two methods, Newton’s Method uses both the gradient and the Hessian
  • This usually reduces the number of iterations needed, but increases the computation needed for each iteration
  • So, for very complex functions, a simpler method is usually faster
newton s method example
Newton’s Method Example

For an example, we will use the same problem as before:

Minimize f(x1, x2, x3) = (x1)2 + x1(1 – x2) + (x2)2 – x2x3 + (x3)2 + x3

newton s method example1
Newton’s Method Example

The Hessian is:

And we will need the inverse of the Hessian:

newton s method example2
Newton’s Method Example

So, pick

Calculate the gradient for the 1st iteration:

newton s method example3
Newton’s Method Example

So, the new x is:

newton s method example4
Newton’s Method Example

Now calculate the new gradient:

Since the gradient is zero, the method has converged

comments on example
Comments on Example
  • Because it uses the 2nd derivative, Newton’s Method models quadratic functions exactly and can find the optimum point in one iteration.
  • If the function had been a higher order, the Hessian would not have been constant and it would have been much more work to calculate the Hessian and take the inverse for each iteration.
constrained nonlinear optimization
Constrained Nonlinear Optimization
  • Previously in this chapter, we solved NLP problems that only had objective functions, with no constraints.
  • Now we will look at methods on how to solve problems that include constraints.
nlp with equality constraints
NLP with Equality Constraints
  • First, we will look at problems that only contain equality constraints:

Minimize f(x) x = [x1 x2 … xn]

Subject to: hi(x) = bii = 1, 2, …, m

illustration
Illustration

Consider the problem:

Minimize x1 + x2

Subject to: (x1)2 + (x2)2 – 1 = 0

The feasible region is a circle with a radius of one. The possible objective function curves are lines with a slope of -1. The minimum will be the point where the lowest line still touches the circle.

graph of illustration
Graph of Illustration

Feasible region

The gradient of f points in the direction of increasing f

f(x) = 1

f(x) = 0

f(x) = -1.414

more on the graph
More on the Graph
  • Since the objective function lines are straight parallel lines, the gradient of f is a straight line pointing toward the direction of increasing f, which is to the upper right
  • The gradient of h will be pointing out from the circle and so its direction will depend on the point at which the gradient is evaluated.
further details
Further Details

x2

Tangent Plane

Feasible region

x1

f(x) = 1

f(x) = 0

f(x) = -1.414

conclusions
Conclusions
  • At the optimum point, f(x) is perpendicular to h(x)
  • As we can see at point x1, f(x) is not perpendicular to h(x) and we can move (down) to improve the objective function
  • We can say that at a max or min, f(x) must be perpendicular to h(x)
    • Otherwise, we could improve the objective function by changing position
first order necessary conditions
First Order Necessary Conditions

So, in order for a point to be a minimum (or maximum), it must satisfy the following equation:

This equation means that f(x*) and h(x*) must be in exactly opposite directions at a minimum or maximum point

the lagrangian function
The Lagrangian Function

To help in using this fact, we introduce the Lagrangian Function, L(x,l):

Review: The notation xf(x,y) means the gradient of f with respect to x.

So,

first order necessary conditions1

and to ensure feasibility.

First Order Necessary Conditions
  • So, using the new notation to express the First Order Necessary Conditions (FONC), if x* is a minimum (or maximum) then
first order necessary conditions2
First Order Necessary Conditions
  • Another way to think about it is that the one Lagrangian function includes all information about our problem
  • So, we can treat the Lagrangian as an unconstrained optimization problem with variables x1, x2, …, xnandl1, l2, …, lm.

We can solve it by solving the equations

using the fonc
Using the FONC

Using the FONC for the previous example,

And the first FONC equation is:

fonc example
FONC Example

This becomes:

&

The feasibility equation is:

or,

fonc example1
FONC Example

So, we have three equations and three unknowns.

When they are solved simultaneously, we obtain

We can see from the graph that positive x1 & x2 corresponds to a maximum while negative x1 & x2 corresponds to the minimum.

fonc observations
FONC Observations
  • If you go back to the LP Chapter and look at the mathematical definition of the KKT conditions, you may notice that they look just like our FONC that we just used
  • This is because it is the same concept
  • We simply used a slightly different derivation this time but obtained the same result
limitations of fonc
Limitations of FONC
  • The FONC do not guarantee that the solution(s) will be minimums/maximums.
  • As in the case of unconstrained optimization, they only provide us with candidate points that need to be verified by the second order conditions.
  • Only if the problem is convex do the FONC guarantee the solutions will be extreme points.
second order necessary conditions sonc
Second Order Necessary Conditions (SONC)

For where

and for y where

If x* is a local minimum, then

second order sufficient conditions sosc
Second Order Sufficient Conditions (SOSC)
  • y can be thought of as being a tangent plane as in the graphical example shown previously
    • Jh is just the gradients of each h(x) equation and we saw in the example that the tangent plane must be perpendicular to h(x) and that is why
the y vector
The y Vector

x3

The tangent plane is the location of all y vectors and intersects with x*

It must be orthogonal (perpendicular) to h(x)

x2

Tangent Plane(all possible y vectors)

x1

maximization problems
Maximization Problems
  • The previous definitions of the SONC & SOSC were for minimization problems
  • For maximization problems, the sense of the inequality sign will be reversed

For maximization problems:

SONC:

SOSC:

necessary sufficient
Necessary & Sufficient
  • The necessary conditions are required for a point to be an extremum but even if they are satisfied, they do not guarantee that the point is an extremum.
  • If the sufficient conditions are true, then the point is guaranteed to be an extremum. But if they are not satisfied, this does not mean that the point is not an extremum.
procedure
Procedure
  • Solve the FONC to obtain candidate points.
  • Test the candidate points with the SONC
    • Eliminate any points that do not satisfy the SONC
  • Test the remaining points with the SOSC
    • The points that satisfy them are min/max’s
    • For the points that do not satisfy, we cannot say whether they are extreme points or not
problems with inequality constraints
Problems with Inequality Constraints

We will consider problems such as:

Minimize f(x)

Subject to: hi(x) = 0 i = 1, …, m

&gj(x) ≤ 0 j = 1, …, p

An inequality constraint, gj(x) ≤ 0 is called “active” at x*ifgj(x*) = 0.

Let the set I(x*) contain all the indices of the active constraints at x*:

for all j in set I(x*)

lagrangian for equality inequality constraint problems
Lagrangian for Equality & Inequality Constraint Problems

The Lagrangian is written:

We use l’s for the equalities & m’s for the inequalities.

fonc for equality inequality constraints
FONC for Equality & Inequality Constraints

For the general Lagrangian, the FONC become

and the complementary slackness condition:

sonc for equality inequality constraints
SONC for Equality & Inequality Constraints

The SONC (for a minimization problem) are:

where as before.

This time, J(x*) is the matrix of the gradients of all the equality constraints and only the inequality constraints that are active at x*.

sosc for equality inequality constraints
SOSC for Equality & Inequality Constraints
  • The SOSC for a minimization problem with equality & inequality constraints are:
generalized lagrangian example
Generalized Lagrangian Example
  • Solve the problem:

Minimize f(x) = (x1 – 1)2 + (x2)2

Subject to: h(x) = (x1)2 + (x2)2 + x1 + x2 = 0

g(x) = x1 – (x2)2≤ 0

The Lagrangian for this problem is:

generalized lagrangian example1
Generalized Lagrangian Example
  • The first order necessary conditions:
generalized lagrangian example2
Generalized Lagrangian Example

Solving the 4 FONC equations, we get 2 solutions:

1)

and

2)

generalized lagrangian example3
Generalized Lagrangian Example

Now try the SONC at the 1st solution:

Both h(x) & g(x) are active at this point (they both equal zero). So, the Jacobian is the gradient of both functions evaluated at x(1):

generalized lagrangian example4
Generalized Lagrangian Example

The only solution to the equation:

is:

And the Hessian of the Lagrangian is:

generalized lagrangian example5
Generalized Lagrangian Example

So, the SONC equation is:

This inequality is true, so the SONC is satisfied for x(1) and it is still a candidate point.

generalized lagrangian example6
Generalized Lagrangian Example

The SOSC equation is:

And we just calculated the left-hand side of the equation to be the zero matrix. So, in our case for x2:

So, the SOSC are not satisfied.

generalized lagrangian example7
Generalized Lagrangian Example

For the second solution:

Again, both h(x) & g(x) are active at this point. So, the Jacobian is:

generalized lagrangian example8
Generalized Lagrangian Example

The only solution to the equation:

is:

And the Hessian of the Lagrangian is:

generalized lagrangian example9
Generalized Lagrangian Example

So, the SONC equation is:

This inequality is true, so the SONC is satisfied for x(2) and it is still a candidate point

generalized lagrangian example10
Generalized Lagrangian Example

The SOSC equation is:

And we just calculated the left-hand side of the equation to be the zero matrix. So, in our case for x2:

So, the SOSC are not satisfied.

example conclusions
Example Conclusions
  • So, we can say that both x(1)& x(2) may be local minimums, but we cannot be sure because the SOSC are not satisfied for either point.
numerical methods
Numerical Methods
  • As you can see from this example, the most difficult step is to solve a system of nonlinear equations to obtain the candidate points.
  • Instead of taking gradients of functions, automated NLP solvers use various methods to change a general NLP into an easier optimization problem.
excel example
Excel Example

Let’s solve the previous example with Excel:

Minimize f(x) = (x1 – 1)2 + (x2)2

Subject to: h(x) = (x1)2 + (x2)2 + x1 + x2 = 0

g(x) = x1 – (x2)2≤ 0

excel example1
Excel Example

We enter the objective function and constraint equations into the spreadsheet:

excel example2
Excel Example

Now, open the solver dialog box under the Tools menu and specify the objective function value as the target cell and choose the Min option. As it is written, A3 & B3 are the variable cells. And the constraints should be added – the equality constraint and the ≤ constraint.

excel example3
Excel Example

The solver box should look like the following:

excel example4
Excel Example
  • This is a nonlinear model, so unlike the examples in the last chapter, we won’t choose the “Assume Linear Model” in the options menu
  • Also, x1 & x2 are not specified to be positive, so we don’t check the “Assume Non-negative” box
  • If desired, the tolerance may be decreased to 0.1%
excel example5
Excel Example
  • When we solve the problem, the spreadsheet doesn’t change because our initial guess of x1 = 0 & x2 = 0 is an optimum solution, as we found when we solved the problem analytically.
excel example6
Excel Example

However, if we choose initial values of both x1 & x2 as -1, we get the following solution

conclusions1
Conclusions
  • So, by varying the initial values, we can get both of the candidate points we found previously
  • However, the NLP solver tells us that they are both local minimum points
references
References

Material for this chapter has been taken from:

  • Optimization of Chemical Processes 2nd Ed.; Edgar, Thomas; David Himmelblau; & Leon Lasdon.