讲解Optimal operation、辅导Java/Python程序设计、辅导CS/python, C/C++

- 首页 >> Python编程

Homework 5

1. Optimal operation of a two-state chemical reactor. Consider a chemical reactor containing

n compounds, labeled 1, . . . , n. Let xi(t) be the amount of compound i in the reactor

at time t. The chemical reactor has two modes of operation, labeled 1 and 2. (For example,

the first mode may be operating the reactor at a low temperature, and the second mode may

be operating the reactor at a high temperature.) For simplicity we assume that the mode of

operation can be changed instantaneously. When we operate the reactor in mode j, the vector

of compound amounts evolves according to the equation

x˙(t) = Ajx(t).

We are given the vector x(0) ∈ R

n of initial compound amounts, and the dynamics matrices

A1 and A2. Our objective is to maximize the amount of compound k at time T, where

k ∈ {1, . . . , n} and T > 0 are given.

a) Suppose the reactor operates in mode 1 for 0 ≤ t ≤ T0, and mode 2 for T0 < t ≤ T.

Explain how to choose the time T0 in order to maximize the amount of compound k at

time T. Your answer only needs to be accurate to two decimal digits.

b) Apply your method to the data given in chemical_reactor_data.m. Report the optimal

value of T0 and the corresponding amount of compound k at time T; submit a plot

showing all of the components of x(t) as functions of time on a single set of axes.

c) Suppose the reactor operates in mode 1 for 0 ≤ t ≤ T1 and T2 < t ≤ T, and mode 2

for T1 < t ≤ T2. Explain how to choose the times T1 and T2 in order to maximize the

amount of compound k at time T. Your answers for T1 and T2 only need to be accurate

to two decimal digits.

d) Apply your method to the data given in chemical_reactor_data.m. Report the optimal

values of T1 and T2 and the corresponding amount of compound k at time T; submit a

plot showing all of the components of x(t) as functions of time on a single set of axes.

2. The smoothest input that takes the state to zero. We consider the discrete-time linear

dynamical system x(t + 1) = Ax(t) + Bu(t), with

1

The goal is to choose an input sequence u(0), u(1), . . . , u(19) that yields x(20) = 0. Among the

input sequences that yield x(20) = 0, we want the one that is smoothest, i.e., that minimizes

Jsmooth =120X19t=0

(u(t)  u(t1))2

!1/2

,

where we take u(?1) = 0 in this formula. Explain how to solve this problem. Plot the

smoothest input usmooth, and give the associated value of Jsmooth.

3. Portfolio selection with sector neutrality constraints. We consider the problem of

selecting a portfolio composed of n assets. We let xi ∈ R denote the investment (say, in

dollars) in asset i, with xi < 0 meaning that we hold a short position in asset i. We normalize

our total portfolio as 1

Tx = 1, where 1 is the vector with all entries 1. (With normalization,

the xi are sometimes called portfolio weights.)

The portfolio (mean) return is given by r = μ

Tx, where μ ∈ R

n

is a vector of asset (mean)

returns. We want to choose x so that r is large, while avoiding risk exposure, which we explain

next.

First we explain the idea of sector exposure. We have a list of k economic sectors (such as

manufacturing, energy, transportation, defense, . . . ). A matrix F ∈ R

k×n

, called the factor

loading matrix, relates the portfolio x to the factor exposures, given as Rfact = F x ∈ Rk. The

number Rfacti

is the portfolio risk exposure to the ith economic sector. If Rfact

is large (in

magnitude) our portfolio is exposed to risk from changes in that sector; if it is small, we are

less exposed to risk from that sector. If Rfact

i = 0, we say that the portfolio is neutral with

respect to sector i.

Another type of risk exposure is due to fluctations in the returns of the individual assets.

The idiosyncratic risk is given by

where σi > 0 are the standard deviations of the asset returns. (You can take the formula

above as a definition; you do not need to understand the statistical interpretation.)

We will choose the portfolio weights x so as to maximize r ? λRid, which is called the

risk-adjusted return, subject to neutrality with respect to all sectors, i.e., Rfact = 0. Of course

we also have the normalization constraint 1

Tx = 1. The parameter λ, which is positive, is

called the risk aversion parameter. The (known) data in this problem are μ ∈ Rn, F ∈ R

k×n,σ = (σ1, . . . , σn) ∈ Rn, and λ ∈ R.

a) Explain how to find x, using methods from the course. You are welcome (even encouraged)

to express your solution in terms of block matrices, formed from the given

data.

b) Using the data given in sector_neutral_portfolio_data.m, find the optimal portfolio.

Report the associated values of r (the return), and Rid (the idiosyncratic risk). Verify

that 1

Tx = 1 (or very close) and Rfact = 0 (or very small).

2

4. Controlling a system using the initial conditions. Consider the mechanical system

shown below:

k1 k2

m1 m2

q1 q2

Here qi give the displacements of the masses, mi are the values of the masses, and ki are the

spring stiffnesses, respectively. The dynamics of this system are


where the state is given by

Immediately before t = 0, you are able to apply a strong impulsive force αi to mass i, which

results in initial condition

(i.e., each mass starts with zero position and a velocity determined by the impulsive forces.)

This problem concerns selection of the impulsive forces α1 and α2. For parts a–c below, the

parameter values are

m1 = m2 = 1, k1 = k2 = 1.

Consider the following specifications:

a) q2(10) = 2

b) q1(10) = 1, q2(10) = 2

c) q1(10) = 1, q2(10) = 2, q˙1(10) = 0, q˙2(10) = 0

d) q2(10) = 2 when the parameters have the values used above (i.e., m1 = m2 = 1,

k1 = k2 = 1), and also, q2(10) = 2 when the parameters have the values m1 = 1,

m2 = 1.3, k1 = k2 = 1.

Determine whether each of these specifications is feasible or not (i.e., whether there exist

α1, α2 ∈ R that make the specification hold). If the specification is feasible, find the particular

α1, α2 that satisfy the specification and minimize α

2

1+α

2

2

. If the specification is infeasible, find

the particular α1, α2 that come closest, in a least-squares sense, to satisfying the specification.

(For example, if you cannot find α1, α2 that satisfy q1(10) = 1, q2(10) = 2, then find αi that

minimize (q1(10)1)2 + (q2(10)2)2

.) Be sure to be very clear about which alternative holds

for each specification.

3

5. Linear system with one-bit quantized output. We consider the system

x˙ = Ax, y(t) = sign (cx(t))

where

and the sign function is defined as

sign(a) =1 if a < 0

0 if a = 0

Rougly speaking, the output of this autonomous linear system is quantized to one-bit precision.

The following outputs are observed:

y(0.4) = +1, y(1.2) = 1, y(2.3) = 1, y(3.8) = +1

What can you say (if anything) about the following:

y(0.7), y(1.8), and y(3.7)?

Your response might be, for example: “y(0.7) is definitely +1, and y(1.8) is definitely 1, but

y(3.7) can be anything (i.e., 1, 0, or 1)”. Of course you must fully explain how you arrive

at your conclusions. (What we mean by “y(0.7) is definitely +1” is: for any trajectory of the

system for which y(0.4) = +1, y(1.2) = 1, y(2.3) = 1, and y(3.8) = +1, we also have

y(0.7) = +1.)

6. Some basic properties of eigenvalues. Show the following:

a) The eigenvalues of A and AT are the same.

b) A is invertible if and only if A does not have a zero eigenvalue.

c) If the eigenvalues of A are λ1, . . . , λn and A is invertible, then the eigenvalues of A?1

are 1/λ1, . . . , 1/λn.

d) The eigenvalues of A and T

1AT are the same.

Hint: you’ll need to use the facts that det A = det(AT), det(AB) = det A det B, and, if A is

invertible, det A?1 = 1/ det A.

7. Characteristic polynomial. Consider the characteristic polynomial X (s) = det(sI A)

of the matrix A ∈ R

n×n

.

a) Show that X is monic, which means that its leading coefficient is one: X (s) = s

n + · · · .

b) Show that the s

n1

coefficient of X is given by trace A. (trace X is the trace of a

matrix: trace X =

Pn

i=1 Xii.)

4

c) Show that the constant coefficient of X is given by det(A).

d) Let λ1, . . . , λn denote the eigenvalues of A, so that

X (s) = s

n + an 1s

n1 + · · · + a1s + a0 = (s λ1)(s λ2)· · ·(s λn).

By equating coefficients show that an1 =

Pn

i=1 λi and a0 =

Qn

i=1(λi).


站长地图