50
Dynamic Optimization 5. Optimal Control Dr. Abebe Geletu Ilmenau University of Technology Department of Simulation and Optimal Processes (SOP) Winter Semester 2011/12 Dynamic Optimization 5. Optimal Control TU Ilmenau

Dynamic Optimization 5. Optimal Control · Dynamic Optimization 5. Optimal Control TU Ilmenau. 5.3. Classi cation of optimal control problems Standard terminologies: I t f-terminal-time

  • Upload
    others

  • View
    8

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Dynamic Optimization 5. Optimal Control · Dynamic Optimization 5. Optimal Control TU Ilmenau. 5.3. Classi cation of optimal control problems Standard terminologies: I t f-terminal-time

Dynamic Optimization5. Optimal Control

Dr. Abebe Geletu

Ilmenau University of TechnologyDepartment of Simulation and Optimal Processes (SOP)

Winter Semester 2011/12

Dynamic Optimization 5. Optimal Control

TU Ilmenau

Page 2: Dynamic Optimization 5. Optimal Control · Dynamic Optimization 5. Optimal Control TU Ilmenau. 5.3. Classi cation of optimal control problems Standard terminologies: I t f-terminal-time

5.1 Definitions

• To control a process means to guide (force) a process in order sothat the process displays a desired behavior (s).• There might be several control strategies to force a process todisplay a desired behavior.Objectives of optimal control:To find the best control strategy ( among several alternatives) toforce (guide) a process attain certain behaviors in order to achieve adesired goal.

A mathematical statement of an optimal control problem involves:• a performance criteria• a model equation the process• physical constraints

Dynamic Optimization 5. Optimal Control

TU Ilmenau

Page 3: Dynamic Optimization 5. Optimal Control · Dynamic Optimization 5. Optimal Control TU Ilmenau. 5.3. Classi cation of optimal control problems Standard terminologies: I t f-terminal-time

5.1 Definitions ...• Behaviors of a process are described through its state variables x .• The degrees of freedom to manipulate the behavior of the processare control variables u. Thus, the states (behaviors) that the processattains are determined by the control; i.e., x(t) = x(u(t)).I control variables: u = (u1(t), u2(t), . . . , um)>.I state variables: x = (x1(t), x2(t), . . . , xn)> (In general, n ≥ m).

Constraints:• Control constraints: ui ,min ≤ ui (t) ≤ ui ,max , i = 1, . . . ,m• State constraints: xj ,min ≤ xj(t) ≤ xj ,max , j = 1, . . . , n.• Considred time interval: t0 ≤ t ≤ tf (given or free)• Initial state: x(t0) = x0 (usually known)• Final or terminal state: x(tf ) = xf (given or free)• Model equation: x = f (t, x , u), 0 = g(t, x , u) (ODE or DAE).Performance function: J - is a function of u and describes acriteria according to which the best control strategy to be determined.

Dynamic Optimization 5. Optimal Control

TU Ilmenau

Page 4: Dynamic Optimization 5. Optimal Control · Dynamic Optimization 5. Optimal Control TU Ilmenau. 5.3. Classi cation of optimal control problems Standard terminologies: I t f-terminal-time

5.1. Definitions ... an optimal control problemWe consider the following optimal control problem

minu

{E (x(tf ), tf ) +

∫ tf

t0

f0(x(t), u(t), t)dt

}(1)

subject to: (2)

x = f (x , u, t), t0 ≤ t ≤ tf , (3)

0 = g(x , u, t), t0 ≤ t ≤ tf , (4)

x(t0) = x0, (5)

umin ≤ u ≤ umax , (6)

xmin ≤ x ≤ xmax . (7)

Here, the performance criteria is

J[u] = E (x(tf ), tf ) +

∫ tf

t0

f0(x(t), u(t), t)dt.

Dynamic Optimization 5. Optimal Control

TU Ilmenau

Page 5: Dynamic Optimization 5. Optimal Control · Dynamic Optimization 5. Optimal Control TU Ilmenau. 5.3. Classi cation of optimal control problems Standard terminologies: I t f-terminal-time

5.2. Optimal control problems - special forms ofthe performance criteria J• Mayer type optimal control if

J[u] = E (x(tf ), tf )

• Lagrange type optimal control if

J[u] =

∫ tf

t0

f0(u, x , t)dt.

• Bolza type optimal control if

J[u] = E (x(tf ), tf ) +

∫ tf

t0

f0(u, x , t)dt.

• The Bolza type is more general than the other two.• In general, any one of them can be equivalently transformed to theother two forms.

Dynamic Optimization 5. Optimal Control

TU Ilmenau

Page 6: Dynamic Optimization 5. Optimal Control · Dynamic Optimization 5. Optimal Control TU Ilmenau. 5.3. Classi cation of optimal control problems Standard terminologies: I t f-terminal-time

5.2. ... Linear quadratic optimal control problemsIf the performance function takes the from

J[u] = x>Mx(tf ) +

∫ tf

t0

[[x(t)]>Qx(t) + [u(t)]>Qu(t)

]dt

with the model equation being linear

x = Ax(t) + Bu(t) (8)

0 = Cx(t) + Du(t) (9)

possibly with constraints on the control and state variables

umin ≤ u ≤ umax , (10)

xmin ≤ x ≤ xmax . (11)

The resulting problem is known as linear quadratic optimal control(closely related with the linear quadratic regulator (LQR)) problem.

Dynamic Optimization 5. Optimal Control

TU Ilmenau

Page 7: Dynamic Optimization 5. Optimal Control · Dynamic Optimization 5. Optimal Control TU Ilmenau. 5.3. Classi cation of optimal control problems Standard terminologies: I t f-terminal-time

5.3. Classification of optimal control problemsStandard terminologies:I tf -terminal-time and x(tf ) - terminal-state.

Depending on the type of application, either the terminal-time tf orthe terminal-state x(tf ) or both can be fixed or free.

Accordingly, we have the following classes of optimal control problems:(I) Fixed terminal-time, fixed terminal-state(II) Fixed terminal-time, free terminal-state(III) Free terminal-time, fixed terminal-state(IV) Free terminal-time, free terminal-state

In addition, any of the above can include a combination of thefollowing constraints:

(i) constraints on the terminal-state(ii) constraints on the control variables(iii) constraints on the state variables.

Dynamic Optimization 5. Optimal Control

TU Ilmenau

Page 8: Dynamic Optimization 5. Optimal Control · Dynamic Optimization 5. Optimal Control TU Ilmenau. 5.3. Classi cation of optimal control problems Standard terminologies: I t f-terminal-time

5.3.1 Optimality conditions• The first order optimality conditions take a special form dependingon the type (class) of the optimal control problem.(I) Fixed terminal-time, fixed terminal-state optimal control.

minu

{∫ tf

t0

f0(x(t), u(t), t)dt

}(12)

subject to:

x(t0) = x0, (13)

x(t0) = xf . (14)

Optimality condition:

Euler-Lagrange Equations:

∂f0∂x− ∂

∂t

(∂f0∂u

)= 0.

Dynamic Optimization 5. Optimal Control

TU Ilmenau

Page 9: Dynamic Optimization 5. Optimal Control · Dynamic Optimization 5. Optimal Control TU Ilmenau. 5.3. Classi cation of optimal control problems Standard terminologies: I t f-terminal-time

5.3.1 Optimality conditions...(I’) Fixed terminal-time, fixed terminal-state optimal control with aboundary condition.

minu

{∫ tf

t0

f0(x(t), u(t), t)dt

}(15)

subject to:

g(x(t),u(t),t)=0 , (16)

x(t0) = x0, (17)

x(t0) = xf . (18)

Use the Lagrange function:

L(x , u, λ, t) = f0(x(t), u(t), t) + λ(t)g(x(t), u(t), t)

where λ(t) is known costate or adjoint variable, and

Dynamic Optimization 5. Optimal Control

TU Ilmenau

Page 10: Dynamic Optimization 5. Optimal Control · Dynamic Optimization 5. Optimal Control TU Ilmenau. 5.3. Classi cation of optimal control problems Standard terminologies: I t f-terminal-time

5.3.1 Optimality conditions...

transform the problem to

minu

{∫ tf

t0

L(x(t), u(t), λ(t), t)dt

}(19)

subject to:

x(t0) = x0, (20)

x(t0) = xf . (21)

Optimality condition:

Euler-Lagrange Equations:

∂L

∂x− ∂

∂t

(∂L

∂u

)= 0.

Dynamic Optimization 5. Optimal Control

TU Ilmenau

Page 11: Dynamic Optimization 5. Optimal Control · Dynamic Optimization 5. Optimal Control TU Ilmenau. 5.3. Classi cation of optimal control problems Standard terminologies: I t f-terminal-time

5.3.1 Optimality conditions...

(II) Fixed terminal-time, free terminal-state optimal control(II-i) without a constraint on the terminal-state

minu

{φ(x(tf )) +

∫ tf

t0

f0(x(t), u(t), t)dt

}(22)

subject to:

x = f (x(t), u(t), t), (23)

x(t0) = x0. (24)

Use the Hamilton function:

H(x , u, λ, t) = f0(x(t), u(t), t) + λ(t)f (x(t), u(t), t)

with the costate or adjoint variable λ(t) so that

Dynamic Optimization 5. Optimal Control

TU Ilmenau

Page 12: Dynamic Optimization 5. Optimal Control · Dynamic Optimization 5. Optimal Control TU Ilmenau. 5.3. Classi cation of optimal control problems Standard terminologies: I t f-terminal-time

5.3.1 Optimality conditions...

minu

{φ(x(tf )) +

∫ tf

t0

{f0(x(t), u(t), t) + λ(t)> [f (x , u, t)− x ]

}dt

}subject to: x(t0) = x0.

Optimality conditions:

Hamilton’s Method

State equations: x =∂H

∂λ= f (x , u, t)

Adjoint equations: λ = −∂H∂x

Boundary conditions: x(t0) = x0, λ(tf ) =∂φ

∂x(tf )

Minimum principle (optimality condition):∂H(x∗, u∗, λ∗, t)

∂u= 0

i.e. H(x∗, u∗, λ∗, t) = maxu

H(x∗, u, λ∗, t).

Dynamic Optimization 5. Optimal Control

TU Ilmenau

Page 13: Dynamic Optimization 5. Optimal Control · Dynamic Optimization 5. Optimal Control TU Ilmenau. 5.3. Classi cation of optimal control problems Standard terminologies: I t f-terminal-time

5.3.1 Optimality conditions...(II) Fixed terminal-time, free terminal-state optimal control(II-ii) with a constraint on the terminal-state

minu

{φ(x(tf )) +

∫ tf

t0

f0(x(t), u(t), t)dt

}(25)

subject to:

x = f (x(t), u(t), t), (26)

g(x(tf ), tf ) = 0, (27)

x(t0) = x0. (28)

Use the Hamilton function:

H(x , u, λ, t) = f0(x(t), u(t), t) + λ(t)f (x(t), u(t), t)

with the costate or adjoint variable λ(t) so that

Dynamic Optimization 5. Optimal Control

TU Ilmenau

Page 14: Dynamic Optimization 5. Optimal Control · Dynamic Optimization 5. Optimal Control TU Ilmenau. 5.3. Classi cation of optimal control problems Standard terminologies: I t f-terminal-time

5.3.1 Optimality conditions...

the problem can be transformed to the unconstrained optimal controlproblem

minu

{φ(x(tf )) + µ>g(x(tf ), tf )+∫ tf

t0

{f0(x(t), u(t), t) + λ(t)> [f (x , u, t)− x ]

}dt

}subject to:

x(t0) = x0.

I The scalar vector µ> = (µ1, µ2, . . . , µm) represents Lagrangemultipliers corresponding to the equality constraints g(x(tf ), tf ) = 0.

Dynamic Optimization 5. Optimal Control

TU Ilmenau

Page 15: Dynamic Optimization 5. Optimal Control · Dynamic Optimization 5. Optimal Control TU Ilmenau. 5.3. Classi cation of optimal control problems Standard terminologies: I t f-terminal-time

5.3.1 Optimality conditions...

Optimality conditions:

Hamilton’s Method

State equations: x =∂H

∂λ= f (x , u, t)

Adjoint equations: λ = −∂H∂x

Boundary conditions: x(t0) = x0,

λ(tf ) =∂φ

∂x(tf )+

∂g>

∂x(tf )µ

Minimum principle (optimality condition):∂H(x∗, u∗, λ∗, t)

∂u= 0

i.e. H(x∗, u∗, λ∗, t) = maxu

H(x∗, u, λ∗, t).

Dynamic Optimization 5. Optimal Control

TU Ilmenau

Page 16: Dynamic Optimization 5. Optimal Control · Dynamic Optimization 5. Optimal Control TU Ilmenau. 5.3. Classi cation of optimal control problems Standard terminologies: I t f-terminal-time

5.3.1 Optimality conditions...

(IV) Free terminal-time, free terminal-state optimal control

minu

{φ(xtf ) +

∫ tf

t0

f0(x(t), u(t), t)dt

}(29)

subject to:

x = f (x , u, t) (30)

x(t0) = x0. (31)

(32)

Use the Hamilton function:

H(x , u, λ, t) = f0(x(t), u(t), t) + λ(t)f (x(t), u(t), t)

where λ(t) is known costate or adjoint variable, and

Dynamic Optimization 5. Optimal Control

TU Ilmenau

Page 17: Dynamic Optimization 5. Optimal Control · Dynamic Optimization 5. Optimal Control TU Ilmenau. 5.3. Classi cation of optimal control problems Standard terminologies: I t f-terminal-time

5.3.1 Optimality conditions...Optimality conditions:

Hamilton’s Method

State equations: x =∂H

∂λ= f (x , u, t),

Adjoint equations: λ = −∂H∂x

Boundary conditions: x(t0) = x0,

λ(tf ) =∂φ

∂x(tf ),

Minimum principle (optimality condition):∂H(x∗, u∗, λ∗, t)

∂u= 0,

i.e. H(x∗, u∗, λ∗, t) = maxu

H(x∗, u, λ∗, t),

Terminal condition): H(x∗, u∗, λ∗, t) = −∂φ(x∗(tf ), t∗f )

∂tf.

Dynamic Optimization 5. Optimal Control

TU Ilmenau

Page 18: Dynamic Optimization 5. Optimal Control · Dynamic Optimization 5. Optimal Control TU Ilmenau. 5.3. Classi cation of optimal control problems Standard terminologies: I t f-terminal-time

5.3.1 Optimality conditions...(IV) Free terminal-time, free terminal-state(IV +(i)+(ii)) with constraints on the terminal-state and the controls

minu

{φ(x(tf )) +

∫ tf

t0

f0(x(t), u(t), t)dt

}(33)

subject to:

x = f (x(t), u(t), t), t0 ≤ t ≤ tf , (34)

g(x(tf ), tf ) = 0, (35)

x(t0) = x0, (36)

umin ≤ u(t) ≤ umax , (37)

where u>min = (umin,1, . . . , umin,m) and u>max = (umax ,1, . . . , umax ,m) aregiven vectors.Hamilton function:H(x , u, λ, t) = f0(x(t), u(t), t) + λ(t)f (x(t), u(t), t).

Dynamic Optimization 5. Optimal Control

TU Ilmenau

Page 19: Dynamic Optimization 5. Optimal Control · Dynamic Optimization 5. Optimal Control TU Ilmenau. 5.3. Classi cation of optimal control problems Standard terminologies: I t f-terminal-time

5.3.1 Optimality conditions...

Hamilton’s Method

State equations: x =∂H

∂λ= f (x , u, t),

Adjoint equations: λ = −∂H∂x

Boundary conditions: x(t0) = x0,

λ(tf ) =∂φ

∂x(tf )+

[∂g

∂x(tf )

]>µ,

Minimum principle (optimality condition):∂H(x∗, u∗, λ∗, t)

∂u= 0,

i.e. H(x∗, u∗, λ∗, t) = minumin≤u≤umax

H(x∗, u, λ∗, t),

Terminal condition: H(x∗, u∗, λ∗, t) = −∂φ(x∗(tf ), t∗f )

∂tfIf tf is fixed: H(x∗(t), u∗(t), λ∗(t), t) = H(x∗(tf ), u∗(tf ), λ∗(tf ), tf ) = constant.

Dynamic Optimization 5. Optimal Control

TU Ilmenau

Page 20: Dynamic Optimization 5. Optimal Control · Dynamic Optimization 5. Optimal Control TU Ilmenau. 5.3. Classi cation of optimal control problems Standard terminologies: I t f-terminal-time

5.4. Orthogonal Collocation of Optimal ControlproblemsConsider the optimal control problem (fixed terminal time)

(OPtCtrl) minu

{∫ tf

t0

f0(x(t), u(t), t)dt

}subject to:

x = f (x , u, t), t0 ≤ t ≤ tf , x(t0) = x0,

0 = g(x , u, t), t0 ≤ t ≤ tf ,

umin ≤ u ≤ umax ,

xmin ≤ x ≤ xmax .Objective:• To approximate the states x(t) and the controls u(t) throughLagrange interpolating polynomials.• The Lagrange polynomials are defined using collocation points.• Then the problem is discretized (transcribed) into a nonlinearoptimization problem (NLP).Dynamic Optimization 5. Optimal Control

TU Ilmenau

Page 21: Dynamic Optimization 5. Optimal Control · Dynamic Optimization 5. Optimal Control TU Ilmenau. 5.3. Classi cation of optimal control problems Standard terminologies: I t f-terminal-time

5.4. Orthogonal Collocation of Optimal Controlproblems...We assume that we have n state and m control variables so that

x(t) =

x1(t)x2(t)

...xn(t)

, f (x(t), u(t), t) =

f1(x(t), u(t), t)f2(x(t), u(t), t)

...fn(x(t), u(t), t)

,

u(t) =

u1(t)u2(t)

...um

, g(x(t), u(t), t) =

g1(x(t), u(t), t)g2(x(t), u(t), t)

...gm(x(t), u(t), t)

.

Two types of collocations:(A) Global orthogonal collocation on [t0, tf ](B) Orthogonal collocation on finite elements [t0, tf ].

Dynamic Optimization 5. Optimal Control

TU Ilmenau

Page 22: Dynamic Optimization 5. Optimal Control · Dynamic Optimization 5. Optimal Control TU Ilmenau. 5.3. Classi cation of optimal control problems Standard terminologies: I t f-terminal-time

5.4.1. Global orthogonal collocation• Determine collocation points from the whole interval [t0, tf ].Since x(t0) = x0 is given and tf is given , t0 and tf should belong to the collocation

points. Such collocation points are called Lobatto collocation points = generation of

collocation points (quadrature nodes) fixing the end-points of the interval [t0, tf ].

Figure: Collocation points t0, t1, . . . , tN = tf .

• Corresponding to each state xi (t) and control variable uj(t), definethe interpolating polynomials:

xi (t) =N∑

k=0

x(i)k Lk(t), i = 1, . . . , n; uj(t) =

N∑k=0

u(j)k Lk(t), j = 1, . . . ,m

whereDynamic Optimization 5. Optimal Control

TU Ilmenau

Page 23: Dynamic Optimization 5. Optimal Control · Dynamic Optimization 5. Optimal Control TU Ilmenau. 5.3. Classi cation of optimal control problems Standard terminologies: I t f-terminal-time

5.4.1. Global orthogonal collocation...

where Lk(t) represents the polynomial

Lk(t) =N∏

l = 0l 6= k

[t − tltk − tl

]

which is the N-th degree Lagrange polynomial. The polynomial have

the property that Lk(tl) =

{1, if l = k0, if l 6= k

.

• We would like to approximate xi (t) by xi (t) and uj(t) by uj(t).

Dynamic Optimization 5. Optimal Control

TU Ilmenau

Page 24: Dynamic Optimization 5. Optimal Control · Dynamic Optimization 5. Optimal Control TU Ilmenau. 5.3. Classi cation of optimal control problems Standard terminologies: I t f-terminal-time

5.4.1. Global orthogonal collocation...(I) Discretization of the model equationsFirst, let’s see how we can discretize the dynamic equationsx = f (x , u, t) by writing

˙x1(t) = f1 ((x1(t), x2(t), . . . , xn(t)), (u1(t), u2(t), . . . , um(t)), t) ,...

˙x2(t) = f2 ((x1(t), x2(t), . . . , xn(t)), (u1(t), u2(t), . . . , um(t)), t) ,

˙xn(t) = fn ((x1(t), x2(t), . . . , xn(t)), (u1(t), u2(t), . . . , um(t)), t) .

Observer, for each k = 0, 1, . . . ,N, that

xi (tk) =N∑

k=0

xikLk(tk) = xik , i = 1, . . . , n (38)

uj(tk) =N∑

k=0

ujkLk(tk) = ujk , j = 1, . . . ,m. (39)

(40)Dynamic Optimization 5. Optimal Control

TU Ilmenau

Page 25: Dynamic Optimization 5. Optimal Control · Dynamic Optimization 5. Optimal Control TU Ilmenau. 5.3. Classi cation of optimal control problems Standard terminologies: I t f-terminal-time

5.4.1. Global orthogonal collocation...

Hence, discretization of the dynamic system at the collocation pointst0, t1, . . . , tN leads to the system

N∑k=0

x1k Lk(tl) = f1 ((x1(tl), . . . , xn(tl)), (u1(tl), . . . , um(tl)), tl) ,

N∑k=0

x2k Lk(tl) = f2 ((x1(tl), . . . , xn(tl)), (u1(tl), . . . , um(tl)), tl) ,

...N∑

k=0

xnk Ll(tl) = fn ((x1(tl), . . . , xn(tl)), (u1(tl), . . . , um(tl)), tl) ,

l = 0, 1, . . . ,N.

Dynamic Optimization 5. Optimal Control

TU Ilmenau

Page 26: Dynamic Optimization 5. Optimal Control · Dynamic Optimization 5. Optimal Control TU Ilmenau. 5.3. Classi cation of optimal control problems Standard terminologies: I t f-terminal-time

5.4.1. Global orthogonal collocation...Define

Fi =

fi ((x10, . . . , xn0), (u10, . . . , um0))fi ((x11, . . . , xn1), (u11, . . . , um1))

...fi ((x1N , . . . , xnN), (u1N , . . . , umN))

; xi =

xi0xi1...

xiN

i = 1, . . . , n.

and, sometimes, we can put all vectors xi into one matrix as rowvectors as

X =

x1,0 x1,1 . . . x1,N

x2,0 x2,1 . . . x2,N...

... . . ....

xn,0 xn,1 . . . xn,N

.Dynamic Optimization 5. Optimal Control

TU Ilmenau

Page 27: Dynamic Optimization 5. Optimal Control · Dynamic Optimization 5. Optimal Control TU Ilmenau. 5.3. Classi cation of optimal control problems Standard terminologies: I t f-terminal-time

5.4.1. Global orthogonal collocation...Observe that the k-th column of the matrix X :• is vector of length n; and• corresponds to the value of the state vector x(t) attk , k = 0, 1, . . . ,N.Thus, in matlab notation we write X (:, k) to refer to column k .

L =

L0(t0) L1(t0) . . . LN(t0)

L0(t1) L1(t1) . . . LN(t1)...

... . . ....

L0(tN) L1(tN) . . . LN(tN)

uj =

xj0uj1...

ujN

, j = 1, . . . ,m.

• We can also define an m × (N + 1) matrix U whose rows are theuj’s. And U(:, k) corresponds to the value of the control vectors u(t)at t = tk .

Dynamic Optimization 5. Optimal Control

TU Ilmenau

Page 28: Dynamic Optimization 5. Optimal Control · Dynamic Optimization 5. Optimal Control TU Ilmenau. 5.3. Classi cation of optimal control problems Standard terminologies: I t f-terminal-time

5.4.1. Global orthogonal collocation...Using the above notations, we can now write the discretized modelequations as

Lxi = Fi ((x1, . . . , xn), (u1, . . . ,um)), i = 1, . . . , n.

Similarly, for the algebraic equation 0 = g(x , u, t) we can write

0 = Gj((x1, . . . , xn), (u1, . . . ,um)), j = 1, . . . ,m.

(II) Discretization of the performance functionThe performance criteria J[u] =

∫ tft0

f0(x(t), u(t), t)dt can beapproximated by the sum

J =N∑

k=0

f0(X (:, k),U(:, k), tk).

Dynamic Optimization 5. Optimal Control

TU Ilmenau

Page 29: Dynamic Optimization 5. Optimal Control · Dynamic Optimization 5. Optimal Control TU Ilmenau. 5.3. Classi cation of optimal control problems Standard terminologies: I t f-terminal-time

5.4.1. Global orthogonal collocation...(III) Discretization of control and state constraints

umin ≤ U(:, k) ≤ umax , k = 1, . . . ,Numin ≤ X (: k) ≤ umax , k = 1, . . . ,N.

Finally we obtained the nonlinear optimization problem

(NLP) minu0,u1,...,un

N∑k=0

f0(X (1 : k),U(1 : k), tk)

subject to:

Lxi = Fi ((x1, . . . , xn), (u1, . . . ,um)),

i = 1, . . . , n., x0 given

0 = Gj((x1, . . . , xn), (u1, . . . ,um)),

j = 1, . . . ,m.

umin ≤ uk ≤ umax , k = 0, 1, . . . ,N

xmin ≤ xk ≤ xmax , k = 0, 1, . . . ,N.Dynamic Optimization 5. Optimal Control

TU Ilmenau

Page 30: Dynamic Optimization 5. Optimal Control · Dynamic Optimization 5. Optimal Control TU Ilmenau. 5.3. Classi cation of optimal control problems Standard terminologies: I t f-terminal-time

5.4.1. Global orthogonal collocation...

The problem NLP is a discretization of the optimal control problemOptCtrl at the collocation points.In the problem NLP:

the vectors x1, . . . , xn and u0,u1, . . . ,um unknown (recall that x0

is already given so it is known). Hence, there are nN + m(N + 1)unknown variables;

and n(N + 1) + m(N + 1) equality constraints.

Thus, depending on the number of collocation points and themodel equations in the original problem OptCtrl, the problemNLP can be very large.

In general, such an optimization problem requires a large-scalenonlinear optimization solver.

Dynamic Optimization 5. Optimal Control

TU Ilmenau

Page 31: Dynamic Optimization 5. Optimal Control · Dynamic Optimization 5. Optimal Control TU Ilmenau. 5.3. Classi cation of optimal control problems Standard terminologies: I t f-terminal-time

5.4.1. Global orthogonal collocation...Helpful hint on implementation:When implementing the problem NLP:

put all the unknown vectors x1, . . . , xn into one long vector x aswell as the unknown vectors u1, . . . ,um into a vector u as

x =

x1

. . ..... . .xn

, u =

u1

. . ..... . .um

.Now, the vector x has length n(N + 1) where as u of lengthm(N + 1) .

To retrieve back the xk from x, use the matlab like assignment

xi = x(i(N + 1) + 1 : (i + 1)(N + 1)) for each i = 0, . . . , n − 1.

Dynamic Optimization 5. Optimal Control

TU Ilmenau

Page 32: Dynamic Optimization 5. Optimal Control · Dynamic Optimization 5. Optimal Control TU Ilmenau. 5.3. Classi cation of optimal control problems Standard terminologies: I t f-terminal-time

5.4.1. Global orthogonal collocation.. ExampleConsider the optimal control problem:

minu(t)

1

2

∫ 2

0[u(t)]2 dt (41)

subject to: (42)

x1(t) = x2(t)x2(t) = u(t)

0 ≤ t ≤ 2, (43)

x1(0) = 2, x2(0) = 1 (44)

x1(2) = 0, x2(2) = 0. (45)

(46)

Solution:(i) Generate collocation points from the interval [t0, tf ] = [0, 2].

tk = t0 + τk(tf − t0), k = 0, 1, . . . ,N.

= t0 + τk(2− 0), k = 0, 1, . . . ,N.Dynamic Optimization 5. Optimal Control

TU Ilmenau

Page 33: Dynamic Optimization 5. Optimal Control · Dynamic Optimization 5. Optimal Control TU Ilmenau. 5.3. Classi cation of optimal control problems Standard terminologies: I t f-terminal-time

5.4.1. Global orthogonal collocation.. Example...whereτk ∈ {0, 0.0582, 0.1713, 0.3249, 0.5, 0.6751, 0.8287, 0.9418, 1} areGauss-Legendre-Lobatto collocation points (since both t0 = 0 andtf = 2 are fixed we take the interior collocation points asGauss-Legendre-Lobatto). Thus, the collocation points from [0, 2] are

{t0, t1, . . . , t7, t8} =

{0.0000, 0.1165, 0.3426, 0.6498, 1, 1.3502, 1.6574, 1.8835, 2}.

(ii) Define Lagrange polynomials

Lk(τ) =8∏

l = 0k 6= l

[t − tltk − tl

], k = 0, 1, . . . , 8.

Dynamic Optimization 5. Optimal Control

TU Ilmenau

Page 34: Dynamic Optimization 5. Optimal Control · Dynamic Optimization 5. Optimal Control TU Ilmenau. 5.3. Classi cation of optimal control problems Standard terminologies: I t f-terminal-time

5.4.1. Global orthogonal collocation.. Example...(iii) Define collocation polynomials for the states x1(t),x2(t) and thecontrol variable u(t).

x1(t) =8∑

k=0

x1kLk(t), x2(t) =8∑

k=0

x2kLk(t), (47)

u(t) =8∑

k=0

ukLk(t). (48)

(iv) Discretization of the model equations using the collocationspoints:

8∑k=0

x1k Lk(tl) = x2l , l = 0, 1, . . . ,N. (49)

8∑k=0

x2k Lk(tl) = ul , l = 0, 1, . . . ,N. (50)

Dynamic Optimization 5. Optimal Control

TU Ilmenau

Page 35: Dynamic Optimization 5. Optimal Control · Dynamic Optimization 5. Optimal Control TU Ilmenau. 5.3. Classi cation of optimal control problems Standard terminologies: I t f-terminal-time

5.4.1. Global orthogonal collocation.. Example...

Now, define the matrix (8 + 1)× (8 + 1) matrix

D =

L0(t0) L1(t0) . . . LN(t0)

L0(t1) L1(t1) . . . LN(t1)...

. . ....

L0(t8) L1(t8) . . . LN(t8)

in short D =(Lk(tl)

)0 ≤ k ≤ 80 ≤ l ≤ 8.

Using this, equations (49) and (50) can be written compactly as

Dx1 = x2 (51)

Dx2 = u. (52)

where x1> = (x10, x11, . . . , x18), x2

> = (x20, x21, . . . , x28) andu> = (u0, u1, . . . , u8).

Dynamic Optimization 5. Optimal Control

TU Ilmenau

Page 36: Dynamic Optimization 5. Optimal Control · Dynamic Optimization 5. Optimal Control TU Ilmenau. 5.3. Classi cation of optimal control problems Standard terminologies: I t f-terminal-time

5.4.1. Global orthogonal collocation.. Example...(v) Discretization of the performance criteria

J(u) =1

2

8∑k=0

u2k

(vi) The discretization leads to the nonlinear optimization problem

(NLP) minu

1

2

8∑k=0

u2k (53)

subject to (54)

Dx1 = x2 (55)

Dx2 = u (56)

x10 = 2, x18 = 0, (57)

x20 = 1, x28 = 0. (58)

This a quadratic optimization problem.Dynamic Optimization 5. Optimal Control

TU Ilmenau

Page 37: Dynamic Optimization 5. Optimal Control · Dynamic Optimization 5. Optimal Control TU Ilmenau. 5.3. Classi cation of optimal control problems Standard terminologies: I t f-terminal-time

5.4.1. Global orthogonal collocation.. Example...

Matlab program

Dynamic Optimization 5. Optimal Control

TU Ilmenau

Page 38: Dynamic Optimization 5. Optimal Control · Dynamic Optimization 5. Optimal Control TU Ilmenau. 5.3. Classi cation of optimal control problems Standard terminologies: I t f-terminal-time

5.4.1. Global Collocation...Advanateges/Disadvantages

Advantages:

The problem NLP can be solved using a nonlinear optimizationsolver.

The collocation provides smooth polynomial approximation of thestate variables on the whole of [t0, tf ].

Disadvantages:

Optimal control problems with stiff DAEs may require a largenumber of collocation points; which may lead to a large NLP.

Collocation of control variables provides smooth polynomialapproximations. But, it may not be necessary to have smoothcontrols on the whole of [t0, tf ].

Dynamic Optimization 5. Optimal Control

TU Ilmenau

Page 39: Dynamic Optimization 5. Optimal Control · Dynamic Optimization 5. Optimal Control TU Ilmenau. 5.3. Classi cation of optimal control problems Standard terminologies: I t f-terminal-time

5.4.1. Global collocation ... ResourcesReferences:• Rao, A. V., etal : Algorithm 902: GPOPS, A MATLAB Software forSolving Multiple-Phase Optimal Control Problems Using The GaussPseudospectral Method. ACM Trans. Math. Soft., V. 37, No. 2,2010, No. 22, pp. 1-39.• Benson, D. A., Huntington, G. T., Thorvaldsen, T. P., and Rao, A.V.: Direct Trajectory Optimization and Costate Estimation via anOrthogonal Collocation Method. Journal of Guidance, Control, andDynamics, Vol. 29, No. 6, 2006, pp. 1435-1440.• Garg, D., Advances in Global Pseudospectral Methods for OptimalControl, Ph.D. Thesis, Department of Mechanical and AerospaceEngineering, University of Florida, August 2011.• Huntington, G.T.; Rao, A.V.:A Comparison between Global andLocal Orthogonal Collocation Methods for Solving Optimal ControlProblems. American Control Conference (2007).

Dynamic Optimization 5. Optimal Control

TU Ilmenau

Page 40: Dynamic Optimization 5. Optimal Control · Dynamic Optimization 5. Optimal Control TU Ilmenau. 5.3. Classi cation of optimal control problems Standard terminologies: I t f-terminal-time

5.4.1. Global collocation ... Resources..

Open source Software:GPOPS=General Pseudospectral OPtimal Control Software• This is a Matlab based toolbox.• It has an interface to the NLP solvers SNOPT and IpOpt.• Optimal control problems on a time interval [t0, tf ] are firsttransformed to stadard time interval [−1, 1] and then after collocated.• GPOPS also provides estimates for the costates of an optimalcontrol problem.

Dynamic Optimization 5. Optimal Control

TU Ilmenau

Page 41: Dynamic Optimization 5. Optimal Control · Dynamic Optimization 5. Optimal Control TU Ilmenau. 5.3. Classi cation of optimal control problems Standard terminologies: I t f-terminal-time

5.4.2. Orthogonal collocation on finite elements(OCF) = local collocationOrthogonal collocation on finite elements (OCF) = local collocation.• Divide the interval [t0, tf ] into subintervals known as elementsusing t1, t2, . . . , tM = tf selected from [t0, tf ].

In general, the length of all the elements ∆tl = tl+1 − tl ,l = 0, 1, . . . ,M, should not be necessarily equal.• Select collocation points 0 = τ0 < τ1 < τ2 < . . . τN ≤ 1 to definecollocation points:

tlk = tl + τk(tl+1 − tl), k = 0, 1, . . . ,N, l = 0, 1, . . . ,M − 1.

on the subintervals [tl , tl+1], l = 0, 1, . . . ,M − 1.Dynamic Optimization 5. Optimal Control

TU Ilmenau

Page 42: Dynamic Optimization 5. Optimal Control · Dynamic Optimization 5. Optimal Control TU Ilmenau. 5.3. Classi cation of optimal control problems Standard terminologies: I t f-terminal-time

5.4.2. Orthogonal collocation on finite elements...• Define a collocation polynomial for xi (t), i = 1, . . . , n, anduj(t), j = 1, . . . ,m, on [tk , tk+1] so that

x(l)i (t) =

N∑k=0

x(l)ik Llk(t), i = 1, . . . , n; and (59)

u(l)j (t) =

N∑k=0

u(l)jk Llk(t), j = 1, . . . ,m. (60)

where

Llk(t) =N∏

ν = 0ν 6= kl

[t − tνtlk − tν

]

for l = 0, 1, . . . ,M − 1.Dynamic Optimization 5. Optimal Control

TU Ilmenau

Page 43: Dynamic Optimization 5. Optimal Control · Dynamic Optimization 5. Optimal Control TU Ilmenau. 5.3. Classi cation of optimal control problems Standard terminologies: I t f-terminal-time

5.4.2. Orthogonal collocation on finite elements...

Requirements:

The approximation of the state variables should becontinuous on [t0, tf ]. Hence

x li (tl+1) = x l+1i (tl+1), l = 0, 1, . . . ,M − 2. (61)

This implies that, the polynomial x li (t) on [tl , tl+1] and thepolynomial x l+1

i (t) on [tl+1, tl+2] should have same value at thecommon boundary tl+1 of the intervals; i.e. these equalitiesshould hold at each of the interior points t1, t2, . . . , tM−1 of theinterval [t0, tf ].

The control variables can be discontinuous at the boundariesof the subintervals.

Dynamic Optimization 5. Optimal Control

TU Ilmenau

Page 44: Dynamic Optimization 5. Optimal Control · Dynamic Optimization 5. Optimal Control TU Ilmenau. 5.3. Classi cation of optimal control problems Standard terminologies: I t f-terminal-time

5.4.2. Orthogonal collocation on finite elements...

Analogous to global collocation, for the collocation on the interval[tl , tl+1] we define

Dl =

L0l(t0l) L1l(t0l) . . . LNl(t0l)

L0l(t1l) L1l(t1l) . . . LNl(t1l)...

... . . ....

L0l(tNl) L1l(tNl) . . . LNl(tNl)

, l = 0, 1, . . . ,M;

xli =

x li0x li1...

x liN

, i = 1, . . . , n, l = 0, 1, . . . ,M.

The vectors ulj, j = 1, . . . ,m, l = 0, 1, . . . ,M. are also defined in a like

manner.

Dynamic Optimization 5. Optimal Control

TU Ilmenau

Page 45: Dynamic Optimization 5. Optimal Control · Dynamic Optimization 5. Optimal Control TU Ilmenau. 5.3. Classi cation of optimal control problems Standard terminologies: I t f-terminal-time

5.4.2. Orthogonal collocation on finite elements...

Note that the discretization of x = f (x , u, t)on the intervals [tl , tl+1] can be written as

Dlxli = Fil

((xl

1, xl2, . . . , x

ln), (ul

1,ul2, . . . ,u

lm)), (62)

i = 1, . . . , n; l = 0, 1, . . . ,N. (63)

Similarly, the algebraic equations 0 = g(x , u, t) can be discretized as

0 = Gjl

((xl

1, xl2, . . . , x

ln), (ul

1,ul2, . . . ,u

lm)), (64)

j = 1, . . . ,m; l = 0, 1, . . . ,N. (65)

Dynamic Optimization 5. Optimal Control

TU Ilmenau

Page 46: Dynamic Optimization 5. Optimal Control · Dynamic Optimization 5. Optimal Control TU Ilmenau. 5.3. Classi cation of optimal control problems Standard terminologies: I t f-terminal-time

5.4.2. Orthogonal collocation on finite elements...With these conventions, the orthogonal collocation of the problemOptCtrl on finite elements can be written as the nonlinearoptimization problem

(NLP) minul

j

0 ≤ l ≤ M1 ≤ j ≤ m

M∑l=0

N∑k=0

f0(

(xl1, x

l2, . . . , x

ln), (ul

1,ul2, . . . ,u

lm), tlk

)

subject to

Dlxli − Fil = 0, i = 1, . . . , n;

Gjl = 0, j = 1, . . . ,m;

umin,j ≤ uljk ≤ umax ,j , , j = 1, . . . ,m, k = 0, 1, 2 . . . ,N,

xmin,i ≤ xlik ≤ xmax ,i , i = 1, . . . , n, k = 0, 1, 2 . . . ,N,

l = 0, 1, . . . ,M − 1,Dynamic Optimization 5. Optimal Control

TU Ilmenau

Page 47: Dynamic Optimization 5. Optimal Control · Dynamic Optimization 5. Optimal Control TU Ilmenau. 5.3. Classi cation of optimal control problems Standard terminologies: I t f-terminal-time

5.4.2. Orthogonal collocation on finite elements...

with the additional continuity constraints

x liN − x l+1i0 = 0, i = 1, . . . , n, l = 0, 1, . . . ,M − 2.

In the discussion above:

the number M and the position of t1, t2, . . . , tM−1 in [t0, tf ] ispredetermined. It is also possible to take t1, t2, . . . , tM−1 asvariables in the optimization problem above. This leads to anadaptive orthogonal collocation on finite elements. However, theproblem becomes more complicated and computationallyexpensive.

In general, it is advisable to use lower degree polynomials forthe collocations on each of the intervals [tl , tl+1]; i.e. use a fewnumber of collocation points on each [tl , tl+1].

Dynamic Optimization 5. Optimal Control

TU Ilmenau

Page 48: Dynamic Optimization 5. Optimal Control · Dynamic Optimization 5. Optimal Control TU Ilmenau. 5.3. Classi cation of optimal control problems Standard terminologies: I t f-terminal-time

5.4.2....Advantages/DisadvantagesAdvantages:

The problem NLP can be solved using state-of-the-art large-scalenonlinear optimization solvers.

OCF is more accurate than the global collocation.

Control problems with stiff DAEs are better approximated usingthe OCF approach.

Allows to consider problems with discontinues controls.

Disadvantages:

Commonly, the OCF approach leads to a very large problem;therefore, computationally intensive.

Fixing the number and position of the points t1, t2, . . . , tM−1 in[t0, tf ] may not provide accurate optimal controls.

Guarantees only a piecewise smooth polynomial approximation forthe state variables on [t0, tf ]; while the global collocation providesa smooth polynomial approximation on the whole of [t0, tf ].

Dynamic Optimization 5. Optimal Control

TU Ilmenau

Page 49: Dynamic Optimization 5. Optimal Control · Dynamic Optimization 5. Optimal Control TU Ilmenau. 5.3. Classi cation of optimal control problems Standard terminologies: I t f-terminal-time

5.4.2....Resources

Literature:• J.E. Cuthrell, L.T. Biegler: On the optimization ofdifferential-algebraic process systems. AIChe Jounral, V. 33, 1257 –1270, 1987.• L.T. Biegler. Solution of dynamic optimization problems bysuccessive quadratic programming and orthogonal collocation.Computers and Chemical Engineering, V. 8, 243 – 248, 1984.• L.T. Biegler. An overview of simultaneous strategies for dynamicoptimization. Chemical Engineering and Processing, V. 46, 1043 –1053, 2007.• L. Biegler, A. Cervantes, A. Wachter, Advances in simultaneousstrategies for dynamic optimization, Chemical Engineering Science V.57, 575–593, 2002.

Dynamic Optimization 5. Optimal Control

TU Ilmenau

Page 50: Dynamic Optimization 5. Optimal Control · Dynamic Optimization 5. Optimal Control TU Ilmenau. 5.3. Classi cation of optimal control problems Standard terminologies: I t f-terminal-time

5.4.2...Resources

Software:• JModelica: http://www.jmodelica.org/• Dyopt: DYNAMIC OPTIMISATION CODE FOR MATLAB.http://www.kirp.chtf.stuba.sk/ fikar/research/dynopt/dynopt.htm.See M. Cizniar, D. Salhi, M. Fikar, and M.A. Latifi: A MATLABPackage for Orthogonal Collocations on Finite Elements in DynamicOptimisation. Proceedings of the 15th Int. Conference ProcessControl ’05, Strbske Pleso, June 7-10, 2005, Slovakia.

Dynamic Optimization 5. Optimal Control

TU Ilmenau