Chap - 1 - Static Optimization - 1.1 - 2014
Chap - 1 - Static Optimization - 1.1 - 2014
Chap - 1 - Static Optimization - 1.1 - 2014
Basics + 2,3D-Plots
The goals of this course are to expose the students to the mathematical tools of
parametric and dynamic optimization and their uses in designing optimally
behaving dynamic systems. The nonlinear systems course covers the following
topics:
1. Static Optimization
2.0 Optimal Control of Discrete-Time Systems
2.1 Linear Quadratic Regulator
2.2 Steady-State Closed-loop Control of Sub-Optimal Feedback
2.3 The Tracking Problem
2.4 Regulator with Function of Final State Fixed
3.0 Optimal Control of Continuous-Time Systems
3.1 Linear Quadratic Regulator
3.2 Steady-State Closed-loop Control of Sub-Optimal Feedback
3.3 The Tracking Problem
3.4 Regulator with Function of Final State Fixed
3.5 Final-Time-Free Problem
3.6 Constrained Input Problem
4.0 Dynamic Programming
4.1 Discrete-Time
Introduction
The state feedback and observer design approach is a fundamental tool in the
control of state equation systems. However, it is not always the most useful
method. Three obvious difficulties are:
Dynamic Optimization
J* = J(x*, u*)
Functional minimization (or
maximization)
Parameter optimization
J* = J[x*(t), u*(t)]
Optimal trajectory
Optimal feedback strategy
Taylor series
is a representation of a
function as an infinite
sum of terms calculated
from the values of its
derivatives at a single
point.
Taylor series
dx
dt
Comments:
f may have many critical points. The sufficient conditions helps
us pick the maximum out of the set of all critical points.
Both conditions only establish that x* is a local max. That is,
there is no point "close to" x* that has a higher f-value. But there
may be other points not "close to" x* that do. In that case there
must be multiple points fulfilling both conditions and we simply
calculate which of these has the highest f-value.
If f is strictly concave, there is only one critical point and this
must be the global max. The reason is that f (x) < 0 everywhere
(that is what it means to be strictly concave). Thus, there can only
be one point where f (x) = 0 and that satisfies the sufficient
condition automatically.
http://en.wikipedia.org/wiki/Maxima_and_minima
Contour
When the lines
close
together
magnitude
of
gradient is large:
variation is steep.
are
the
the
the
Contour
The bottom part of the diagram shows some contour lines with a
straight line running through the location of the maximum value.
The curve at the top represents the values along that straight line
singular point:
the singular points are those at which all the partial derivatives
simultaneously vanish.
A point of an algebraic variety which is not singular is said to be
regular. An algebraic variety which has no singular point is said to
be non singular or smooth. y2=x2(x + 1)
A plot of this curve is below with the singular point at the origin.
An example of singular point is when a graph crosses over itself:
The reason for that algebraically is that
both sides of the equation show powers
higher than 1 of the variables x and y. In
terms of differential calculus, if
F(x,y) = y2 x2(x + 1), so that the curve
has equation F(x,y) = 0,
then the partial derivatives of F with
respect to both x and y vanish at (0,0).
The linear quadratic regulator (LQR) is a special case of optimal control problem that
can be analytically solved, which arises when the objective (cost) function is a quadratic
function of state x and input and u, and a LTI state equation is considered.
The quadratic performance index to minimize is:
thus, the loss function and the terminal cost function can be expressed as quadratic
forms:
It is in general assumed that the weighting matrices Q, R and S are symmetric, with Q
and S positive semi definite and R positive definite.
Qualitative idea: if the quadratic term involving the state are large compared to those of
the input (Q>>R), then the optimal solution will exhibit good regulation performance,
that is, the response will go fast to its desired value, but at the expense of large
control energy.
A square matrix M is called symmetric if it verifies: M=MT
A real squared matrix M is called positive definite if xTMx>0, for every vector x0
A real squared matrix M is called positive definite if xTMx0, for every vector x0
, described by
Example
(Appendix A.3)
If Q is symmetric
* Stationary point
Find L(1,-1) ?
Before start
section 1.2
How to draw
mesh, contours
plots
X and Y arrays for 3-D plots
For creating a table of points that satisfy the equation f (x,y) = x 2 + y2. Matlab
accomplishes this with the meshgrid command.
>> [X,Y]=meshgrid([1,2,3,4,5])
Output is easily understood if one superimposes the matrix Y onto the matrix X to obtain
a grid of ordered pairs.
The rows of the output array X are copies of the vector x and the columns of the output
array Y are copies of the vector y.
Therefore, Table contains a set of points in the plane that we will substitute into the
function f (x,y) = x2 +y2. Matlabs array smart operators make this an easy proposition.
>> [X,Y]=meshgrid([1,2,3,4,5])
>> Z=X.2+Y.2
It is now an easy task to plot the surface to which these points belong.
>> mesh(X,Y,Z)
>> x=-3:3
x = -3 -2 -1 0 1 2 3
>> y=-3:3
y = -3 -2 -1 0 1 2 3
>> [X,Y]=meshgrid(x,y)
>> Z=X.2+Y.2
>> mesh(X,Y,Z)
18
18
18
18
The plot of z = x 2 + y 2.
20
15
z-axis
>> x=-3:.2:3;
>> y=-3:.2:3;
>> [X,Y]=meshgrid(x,y);
>> Z=X.^2+Y.^2;
>> mesh(X,Y,Z)
>> xlabel(x-axis)
>> ylabel(y-axis)
>> zlabel(z-axis)
>> title(The plot of z = x^2 + y^2.)
10
5
0
4
2
0
-2
y-axis
-4
-4
-2
0
x-axis
close all
y=-1:.1:1;
z=-1:.1:1;
[yy,zz]=meshgrid(y,z);
xx=zz.^3;
mesh(xx,yy,zz);
xlabel('x-axis')
ylabel('y-axis')
zlabel('z-axis')
title('The plot of X = Z^2
view([130,40])
syms x y
f=x^3+y^3+3*x^2-3*y^2-8
fx=diff(f,x);
fy=diff(f,y);
s=solve(fx,fy);
[s.x,s.y]
Luu=0 ID
Luu<0 +D
Luu>0 -D
f(-2,0)=(-8)+0+12+0-8=-4
f(-2,2)= -8+8+12-12-8=-8
f(0,2)= 0+8+0-12-8=12
Mesh Surface
50
[x,y]=meshgrid(-3:.2:3);
z=x.^3+y.^3+3*x.^2-3*y.^2-8;
mesh(x,y,z)
Difficult to
xlabel(x-axis)
view Mesh
ylabel(y-axis)
Surface
-50
-100
4
2
0
-2
-4
-2
-4
Contour map
[x,y]=meshgrid(-3:.2:3);
z=x.^3+y.^3+3*x.^2-3*y.^2-8;
contour(x,y,z)
xlabel( x-axis )
ylabel( y-axis )
-1
-2
-3
-3
-2
-1
[x,y]=meshgrid(-3:.2:3);
z=x.^3+y.^3+3*x.^2-3*y.^2-8;
contour(x,y,z,20)
xlabel( x-axis )
ylabel( y-axis )
-1
-2
Slop ??
-3
-3
-2
-1
1
y-axis
[x,y]=meshgrid(-3:.2:3);
z=x.^3+y.^3+3*x.^2-3*y.^2-8;
[c,h]=contour(x,y,z,-14:-4);
clabel(c,h)
xlabel( x-axis )
ylabel( y-axis )
-1
-2
-3
-3
-2
-1
0
x-axis
y-axis
-1
-2
-3
-3
-2
-1
0
x-axis
Question:2 Assignment
Find the minimum value of L(x1,x2)=x12-x1x2+x22+3x1;
syms x y
f=x.^2-x*y+y.^2+3*x;
fx=diff(f,x);
fy=diff(f,y);
s=solve(fx,fy);
[s.x,s.y]
[x,y]=meshgrid(-3:.2:3);
f=x.^2-x*y+y.^2+3*x;
mesh(x,y,f)
xlabel(x-axis)
ylabel(y-axis)
let = L(x,y)=x2-xy+y2+3x
[x,y]=meshgrid(-3:.2:3);
f=x.^2-x*y+y.^2+3*x;
contour(x,y,f)
xlabel( x-axis )
ylabel( y-axis )
[x,y]=meshgrid(-3:.2:3);
f=x.^2-x*y+y.^2+3*x;;
contour(x,y,f,50)
xlabel( x-axis )
ylabel( y-axis )
[x,y]=meshgrid(-3:.2:3);
f=x.^2-x*y+y.^2+3*x;
[c,h]=contour(x,y,f,-14:-4);
clabel(c,h)
xlabel( x-axis )
ylabel( y-axis )
[x,y]=meshgrid(-3:.2:3);
f=x.^2-x*y+y.^2+3*x;;
contour(x,y,f,50)
xlabel( x-axis )
ylabel( y-axis )
ANIMATION _ JAVA
[x,y]=meshgrid(-3:.2:3);
z=x.^3+y.^3+3*x.^2-3*y.^2-8;
u = z(x,y);
quiver(x,y,u) ; grid on; axis equal
Check for quiver(x,y,u)
Between