• Ingen resultater fundet

Static and Dynamic Optimization (42111)

N/A
N/A
Info
Hent
Protected

Academic year: 2022

Del "Static and Dynamic Optimization (42111)"

Copied!
36
0
0

Indlæser.... (se fuldtekst nu)

Hele teksten

(1)

Static and Dynamic Optimization (42111)

Build. 303b, room 048 Section for Dynamical Systems

Dept. of Applied Mathematics and Computer Science The Technical University of Denmark

Email: nkpo@dtu.dk phone: +45 4525 3356 mobile: +45 2890 3797

2019-11-10 20:18

Lecture 10: Pontryagins principle

1 / 36

(2)

Pontryagins Maximum Principle

Outline of lecture

Recap F9 (End Point Constraints) Free Dynamic Optimization (D+C) End Point Constraints

Constrained Control - Decisions Pontryagins Principle (D) Investment planning Pontryagins Principle (C) Orbit injection (II)

Reading guidance (DO: chapter 4)

2 / 36

(3)

Dynamic Optimization (D, free)

Find a sequenceui,i= 0, ...,N−1which takes the system

xi+1=fi(xi, ui) x0=x0 from its initial statex0 along a trajectory such that the performance index

J=φN[xN] +

N−1

X

i=0

Li(xi, ui) is optimized. Define the Hamiltonian function as:

Hi=Li(xi, ui) +λTi+1fi(xi, ui) The Euler-Lagrange equations:

xi+1=fi(xi, ui) λTi = ∂

∂xiHi 0 = ∂

∂ui

Hi

Dynamic Optimization (C, free)

Find a functionutt∈[0; T]which takes the system system

˙

x=ft(xt, ut) x0=x0 from its initial statex0 along a trajectory such that the performance index

J=φT[xT] + Z T

0

Lt(xt, ut)dt is optimized. Define the Hamilton function as:

H(x, u, λ, t) =Lt(xt, ut) +λTtft(xt, ut) The Euler-Lagrange equations:

˙

x=ft(xt, ut) −λ˙T = ∂

∂xt

Ht

0 = ∂

∂ut

Ht

3 / 36

(4)

Free DDO

with boundary conditions:

x0=x0 λTN= ∂

∂xNφN(xN)

DDO, End points constraints (EPC)

with boundary conditions:

x0=x0 ψN(xN) = 0 λTNT

∂xN

ψN(xN)+ ∂

∂xN

φN(xN)

Free CDO

with boundary conditions:

x0=x0 λTT= ∂

∂xTφT(xT)

CDO, End point constraints (EPC)

with boundary conditions:

x0=x0 ψT(xT) = 0 λTTT

∂xT

ψT(xT)+ ∂

∂xT

φT(xT)

4 / 36

(5)

End point constraints (EPC)

x0=x0 ψT(xT) = 0 λTTT

∂xTψT(xT) + ∂

∂xTφT(xT)

Simple EPC

xT=xT λTTT+ ∂

∂xTφT(xT)

Partial simple EPC

xT= x˜T

¯ xT

˜

xT= ˜xT ¯xT is free The boundary conditions becomes:

˜

xT= ˜xT ˜λTTT+ ∂

∂x˜T

φT(xT)

¯

xT is free λ¯T= ∂

∂x¯T

φT(xT)

Linear EPC

CxT =r C: p×n matrix The boundary conditions are:

CxT =r λTTTC+ ∂

∂xT

φT(xT)

5 / 36

(6)

Pontryagins Maximum principle

Constrained decisions:

ui∈ Ui Example:

|ui| ≤¯u Example:

u≤ui≤u¯ Example:

ui≤ui≤u¯i

Example:

ui∈ {−1, 0, 1}

6 / 36

(7)

Pontryagin

Lev Semenovich Pontryagin (3 September 1908 - 3 May 1988) was a Soviet Russian mathematician. He was born in Moscow and lost his eyesight in a primus stove explosion when he was 14.

He made major discoveries in a number of fields of mathematics, including the geometric parts of topology. Later in his career he worked in optimal control theory.

His maximum principle is fundamental to the modern theory of optimization.

Pontryagin was quite a controversial personality.

Source: Wikipedia

7 / 36

(8)

Pontryagin (D)

Find a sequenceui,i= 0, ...,N−1where ui∈ Ui which takes the system

xi+1=fi(xi, ui) x0=x0 from its initial statex0along a trajectory such that the performance index

J=φ[xN] +

N−1

X

i=0

Li(xi, ui)

is optimized (minimized or maximized). Defining the Hamiltonian function Hi=Li(xi, ui) +λTi+1fi(xi, ui) The necessary equations:

xi+1=fi(xi, ui) λTi = ∂

∂xi

Hi ui=arg min

ui∈Ui

[Hi]

with boundary conditions:

x0=x0 λTN= ∂

∂xN

φN(xN) If EPC present the last is as given in Chapter 3.

8 / 36

(9)

Example: Investment planning

Plan: During a period of time (N) to invest a amount of moneyui(limitted to max 600 Dkr) each interval to obtain a specified sum (xN).

Dynamics:

xi+1= (1 +α)xi+ui x0= 0 xN= 10.000Dkr Objective:

M in J J=

N−1

X

i=0

1 2u2i subject to:

0≤ui≤600Dkr

9 / 36

(10)

1 2 3 4 5 6 7 8 9 10 0

200 400 600 800

Input sequence

1 2 3 4 5 6 7 8 9 10 11

0 2000 4000 6000 8000 10000 12000

Saldo

10 / 36

(11)

The Hamiltonian function Hi= 1

2u2ii+1[axi+ui] a= 1 +α EL (or KKT) conditions:

xi+1 = axi+ui x0= 0 xN= 10000

λi = aλi+1 λN

ui = arg min

ui∈Ui

(Hi)

λi=νaN−i

ui=−λi+1 for u≤ui≤¯u (−u≥λi+1≥ −u)¯ or

ui=max(u, min(¯u,−νaN−i−1))

For a givenνsolve the state equation with the control inserted.

Ajustingνsuch that EPC is met

xN=xN= 10000Dkr

11 / 36

(12)

Investment planning with economical (linear) cost

What happens (?) if the objective is changed into:

M in J J=

N−1

X

i=0

ui

In that case:

H=uii+1(axi+ui) = (1 +λi+1)uii+1axi

and Pontryagins principle yields:

xi+1 = axi+ui

λi = aλi+1

ui = arg min

ui∈Ui

(Hi)

As previuos we have the costate evolution (νis a constant or a Lagrange multiplier) λi=νaN−i

The optimization gives:

ui=

u (1 +λi+1)>0 λi+1>−1

¯

u (1 +λi+1)<0 λi+1<−1

12 / 36

(13)

Pontryagin (C)

Find a functionut t∈[0; T]where

ut∈ Ut which takes the system system

˙

x=ft(xt, ut)

from its initial statex0along trajectories such that the performance index J=φT[xT] +

ZT 0

Lt(xt, ut)dt is optimized. Define the Hamilton function as:

Ht(x, u, λ) =Lt(xt, ut) +λTtft(xt, ut) Then the necessary conditions for this problem can be written as:

˙

x=ft(xt, ut) −λ˙T= ∂

∂xt

Ht ut=arg min

ut∈Ut

[Ht]

with boundary conditions:

x0=x0 λT= ∂

∂xT

φT(xT) = ∂

∂xφT

or as in Chapter 3 for EPC.

13 / 36

(14)

Orbit injection problem II

θ H

a y

u v

z

The problem is to find the specific thrust force with components,azt andayt, satisfying (azt)2+ (ayt)2=a2

such that the terminal horizontal velocity,uT, is maximized subject to the dynamics d

dt

 ut

vt

z y

=

 azt ayt ut

vt

 u0 v0

z0

y0

=

 0 0 0 0

and the terminal constraints

vT= 0 yT=H

J=uT ( φT=uT Lt= 0 )

14 / 36

(15)

The Hamilton functions (and others) are

Htutaztvtaytztutytvt φT =uT ψT= vT

yT

= 0

H

The costate equation:

−d dt

λut λvt λzt λyt

=

λzt λyt 0 0 has the boundary conditions

λvTv λyTy (fixed state, free costate) λuT = 1 λzT = 0 (free state, fixed costate) resulting in

λzt = 0 λyty

λut = 1 λvtvy(T−t)

15 / 36

(16)

The maximization of azt

ayt

=argmax λutaztvtaytztutytvt

subject to

(azt)2+ (ayt)2=a2 has the solution:

azt ayt

= λut

λvt

a

p(λut)2+ (λvt)2

16 / 36

(17)

The MP problem

M in bTu

st. uTu≤a2 a≥0 has the solution:

u=− a kbkb

Geometric approach

u

b J

a

17 / 36

(18)

Analytic approach

JL=bTu+λ(uTu−a2) KKT:

uTu≤a2 bT+ 2λuT= 0

u=− b

2λ λ2=bTb

4a2 u=−b a

√bTb

18 / 36

(19)

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

−1

−0.8

−0.6

−0.4

−0.2 0 0.2 0.4 0.6 0.8 1

Orbit injection problem (TDP)

time (t/T) v

u

ay ax

19 / 36

(20)

0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0

0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16 0.18 0.2

Orbit injection problem (TDP)

y in PU

x in PU

20 / 36

(21)

% --- function main2

% ---

T=1; % parameters

a=1;

H=0.2;

parm=[-2.4 4.7]’; % Initial guess on parm x0=zeros(4,1); % Initial state variable opt=optimset; % Options for fsolve opt=optimset(opt,’Display’,’iter’);

parm=fsolve(@erf,parm,opt,T,a,x0,H); % Call fsolve for finding parameters [err,time,xt]=erf(parm,T,a,x0,H); % Call erf ones more for getting the

avt=[]; % state trajectories.

for i=1:length(time), t=time(i);

la=[1; parm(1)+parm(2)*(T-t)];

av=la/sqrt(la’*la)*a; % Thrust force as vector

avt=[avt; av’]; % and stored in a matrix

end

% Here goes the plotting commands. (file: ~nkpo/02711/dist3/main2.m) plot(time,[xt(:,1:2) avt]); grid minor; % Plot

21 / 36

(22)

% --- function [err,time,xt]=erf(parm,T,a,x0,H)

% ---

% Determine the end point error (err) given the EPC Lagrange multipliers

% in parm (and the constants that specifies the problem).

Tspan=0:T;

[time,xt]=ode45(@tdpc,Tspan,x0,[],parm,T,a);

xT=xt(end,:)’;

err=[xT(2)-0;

xT(3)-H];

% --- function dx=tdpc(t,x,parm,T,a)

% ---

% System model. Determine the (time) derivative of the state vector

% given the time, state (x) and the EPC Lagrange multipliers.

u=x(1); v=x(2); z=x(3); y=x(4);

p1=parm(1); p2=parm(2);

la=[1; p1+p2*(T-t)];

av=la/sqrt(la’*la)*a; % Specific thrust force as a vector

dx=[av; % remember - a vector

u;

v];

22 / 36

(23)

Resource Allocation - investmentplanning, production

Free production

Consider a production

˙

xt=αxt x0=x0≥0 whereα >0.

Resource Allocation

Let0≤ut≤1be the fraction kept for production (reinvestment).

Then1−utwill be the fraction to be harvested.

The DO problem is:

˙

xt=αutxt x0=x0 xt≥0 and

J= Z T

0

(1−ut)xtdt MaximizeJsubject to0≤ut≤1.

Pontryagin

H=LtTtft= (1−ut)xttαutxt

=xt+ (αλt−1)xtut

˙

xt=αutxt x0=x0>0

−λ˙t= 1 + (αλt−1)ut λT = 0 ut=

( 1 (αλt−1)xt>0 0 (αλt−1)xt<0

sincext≥0:

ut=





1 λt> 1

α (P roduction) 0 λt< 1

α (Harvest)

23 / 36

(24)

Resource Allocation

Harvest

Since

λT = 0

there exist an interval[T1;T] (T1< T) where

λt< 1 α Here (in this interval):

ut= 0

˙

xt= 0 xt=xT λ˙t=−1 λt= (T−t) From this we have (λT1 =α1 =T−T1)

T1=T −1 α

Production

For0≤t < T1

ut= 1

˙

x=αxt x0=x0 λ˙t=−αλt λT1 = 1

α

xt=x0eαt xT1=x0eαT1 λt= 1

α eα(T1−t))

24 / 36

(25)

Resource allocation

Solution summary

T1=T −1 α Then:

ut=

1 for 0≤t < T1

0 for T1< t≤T xt=

x0 eαt for 0≤t≤T1

x0 eαT1 for T1≤t≤T λt=

1

α eα(T1−t)) for 0≤t≤T1 T−t for T1≤t≤T

t

0 0.5 1 1.5 2

xt

0 1 2 3 4 5 6 7

xt

0 0.5 1 1.5 2

λt

0 1 2 3 4 5 6 7

25 / 36

(26)

Resource allocation

t

0 0.5 1 1.5 2

xt

0 1 2 3 4 5 6 7

26 / 36

(27)

Resource allocation

xt

0 0.5 1 1.5 2

λt

0 1 2 3 4 5 6 7

27 / 36

(28)

Road construction

28 / 36

(29)

Road construction

t

-1 0 1 2 3 4 5 6 7

altitue and slope

-2.5 -2 -1.5 -1 -0.5 0 0.5 1 1.5 2

2.5 The Terraine and its slope

29 / 36

(30)

Road construction

Objective: Find road level,xt, such that J=

ZT t=0

1

2(xt−zt)2dt is minimized. Herezt is the level of terrain.

The dynamic is:

˙

xt=u x0=x0 where

|ut| ≤a

30 / 36

(31)

Road construction

Ht=1

2(xt−zt)2tut φ(xT) = 0

˙

xt=u x0=x0

−λ˙t=xt−zt λT= 0

ut=arg min

|ut|≤a

n1

2(xt−zt)2tut

o

31 / 36

(32)

λt= Z t

0

(zt−xt)dt Notice:λt= 0forxt=zt.

ut=

a forλ <0

? forλ= 0

−a forλ >0

Optimal trajectories are obtained by concatenation of three types of arcs

Regular arcs whereλt>0andut=−a(maximum downhill slope ars).

Regular arcs whereλt<0andut=a(maximum uphill slope ars).

Singular arcs whereλt= 0and where|ut|< acan take any value.

In that intervalλ˙t= 0and thenxt=zt. Sincex˙=uwe haveu= ˙z.

32 / 36

(33)

Assume|z˙|< a

t

-1 0 1 2 3 4 5 6 7

altitue and slope

-2.5 -2 -1.5 -1 -0.5 0 0.5 1 1.5 2

2.5 The Terraine and its slope

then

xt=zt ut= ˙zt λt= 0

33 / 36

(34)

Road construction

34 / 36

(35)

Road construction

λ > 0

ut=−a xt=zt1−a(t−t1) λt=

Z t t1

(zt−xt)dt

t

1

< t < t

2

ut=−a xt2=zt1−a(t2−t1) λt2=

Z t2 t1

(zt−xt)dt

λ

t

= 0

ut= ˙zt

xt=zt

λt= 0

For determination oft1andt2: Z t2

t1

(zt−xt)dt= 0 zt2=zt1−a(t2−t1)

35 / 36

(36)

Reading guidance

DO: Chapter 4

36 / 36

Referencer

RELATEREDE DOKUMENTER

Stochastics (Random variable) Stochastic Dynamic Programming Booking profiles..

Count Jacopo Francesco Riccati Born: 28 May 1676, Venice Dead: 15 April 1754, Treviso University of Padua Source: Wikipedia...

Theorem 5 : Consider the dynamic optimization problem of bringing the system (3.17) from the initial state to a terminal state such that the end point constraints in (3.19) is met

You will be able to formulate and solve operations research and technical-economic models, and to appreciate the interplay between optimization models and the real-life

These decisions are made on the basis of what is known as the principle of universalism concerning “equality before the law and equal political status for all citizens” (la Cour

Section 4.3 shows how the static and dynamic constructs have to be instan- tiated in each case. For the GE-instantiation, all base types become Exp ; static and dynamic constants

Future research can also design studies that investigate risk- seeking behavior in situations of loss, an important principle of prospect theory observed in organizational IT

The legislative alternative to the COT principle is the country-of origin principle (COO). Under the COO principle copyright acts are deemed to occur in the territory from where