IEOR E4007 G. Iyengar November 16, 2021

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

IEOR E4007

G. Iyengar November 16, 2021

Homework #6

1. Simple problem on integer programming


Consider the following optimization problem:

max x1 + 2x2 ,
s.t. x1 + x2 ≤ 8,
2x1 + x2 ≥ 2,
x1 x2 ≤ 24,
x2 ≥ 0 and integer,
x1 = 0, 1, 4, or 6.

(a) Formulate this optimization as an integer linear program and solve it. Solve this
integer linear program using EXCEL and python.
To transform variable x1 into a standard binary integer variable, we can use the
following formulation:

x1 = y1 + 4y2 + 6y3 , y1 + y2 + y3 ≤ 1, and yi ∈ {0, 1}, i = 1, 2, 3

Since objective function and the first two constraints are all linear, we just sub-
stitute x1 with y1 + 4y2 + 6y3 , but the constraint x1 x2 ≤ 4 requires more effort.
Let wi = yi x2 , i = 1, 2, 3, then we have x1 x2 = w1 + 4w2 + 6w3 . Now we need to
find a set of linear constraints that ensure that, for i = 1, 2, 3, we have
(
x2 , if yi = 1,
wi =
0, if yi = 0.

From the first linear constraint x1 + x2 ≤ 8 and x1 ≥ 0 we know that x2 ≤ 8. So


we can impose wi ≤ 8yi , wi ≤ x2 , wi ≥ 0, wi ≥ x2 − 8(1 − yi ), for i = 1, 2, 3.
Then, we have the final formulation for this integer program:

max y1 + 4y2 + 6y3 + 2x2

1
y1 + 4y2 + 6y3 + x2 ≤ 8,
2y1 + 8y2 + 12y3 + x2 ≥ 2,
w1 + 4w2 + 6w3 ≤ 4,
wi ≤ 8yi , i = 1, 2, 3,
wi ≤ x2 , i = 1, 2, 3,
wi ≥ 0, i = 1, 2, 3,
wi ≥ x2 − 8(1 − yi ), i = 1, 2, 3,
y1 + y2 + y3 ≤ 1,
yi ∈ {0, 1}, i = 1, 2, 3,
x2 ≥ 0 and integer.

(b) Suppose the objective function is changed to: max x21 + 2x2 . Formulate and solve
this as a linear integer program.
If the objective function changes to x21 + 2x2 , then the objective function of the
above integer program will change to:

max y1 + 16y2 + 36y3 + 2x2

Since with y1 + y2 + y3 ≤ 1, and yi ∈ {0, 1} we have yi2 = yi , ∀i and yi yj = 0, if


i 6= j.

2. Portfolio rebalancing with trading costs


Consider the following trading problem
µ> x − ni=1 τ (|xi |),
P
max P
subject to Pni=1 |xi | ≤ βW
n
i=1 xi = W.

where  >
µ = −1.2075 0.7172 1.6302 0.4889 1.0347 ,
n = 5, W = 10, β = 1.5 is the margin parameter and the transaction cost function is
given by 
 0 0,
τ (u) = c + λu 0<u≤B
c + λB + γλ(u − B) u > B,

with c = 0.1, λ = 0.7, B = 5, and γ = 0.25. Note that you will have to create an
appropriate upper bound for the u in the third row.
setting x =Px+ − x− , x+ ≥ 0, x− ≥ 0. Then we
Pn |x| by P
The first step is to linearize
have |x| = x + x and i=1 |xi | = ni=1 x+ + ni=1 x− . Thus, we have linearized the
+ −

absolute value of x.

2
Not the margin requirement implies that |xi | ≤ βW for all i. Thus, the function we
need to model is given by

 0 0,
τ (u) = c + λu 0<u≤B
c + λB + γλ(u − B) B < u ≤ βW.

Mapping this to the example detailed in the notes, we get


f1 = 0, f2 = c + λB, f3 = c + λB + γλ(βW − B)
`2 = B, `3 = βW
And, therefore, one can linearize the cost function as follows:
τi = f1 wi1 + f2 wi2 + f3 wi3
x+
i + x− i = `2 wi2 + `3 wi3
yi1 + yi2 = wi1 + wi2 + wi3
yi1 + yi2 ≤ 1
wi1 ≤ yi1 (1)
wi2 ≤ yi1 + yi2
wi3 ≤ yi2
wi1 , wi2 , wi3 ≥ 0
yi1 , yi2 ∈ {0, 1}
Finally, the linearized problem is:
maxx+ ,x− ,w,y,τ µ> (x+ − x− ) − 1> τ
subject to 1> (x+ + x− ) ≤ βW
1> (x+ − x− ) = W,

(τi , x+
i , xi ) satisfy (1) for all i = 1, . . . , d.

3. VaR portfolio selection portfolio


The data for this problem is in the python notebook VaRdata.ipynb.
Solve for the mean-VaR optimal portfolio with the following constraints and the ob-
jective:
(a) Portfolio constraints: x = (x1 , . . . , xd )T must satisfy
d
X d
X
xi ≤ 1, and |xi | ≤ β
i=1 i=1

2
(b) The investment xi in asset i should satisfy |xi | ≥ d
or zero.
(c) Risk constraint: VaR of the rate of the loss of the portfolio x at p = 95% must
be at most γ ∈ {0.01, . . . , 0.1}:
Varα (Lx) ≤ γ

3
(d) Objective: maximize expected rate of return on the portfolio.

Let x+ denote the long positions and x− denote the short positions. Then the portfolio
constraints in (a) can be written as:
d
X

(x+
i − xi ) ≤ 1 (2)
i=1
Xd

(x+
i + xi ) ≤ β (3)
i=1

Let yi ∈ {0, 1}, i = 1, . . . , d, denote whether or not we invest in asset i. Then (b) can
be formulated as follows: 2

y i ≤ x+
i + xi ≤ βyi . (4)
d
Let zk ∈ {0, 1} denote the binary variables that control the loss in scenario k, i.e.
we want that L> + −
k (x − x ) ≤ γ if zk = 0. We can impose this requirement by the
constraint
L> + −
k (x − x ) ≤ γ + (Mk − γ)zk (5)
where

Mk = max{L> + − > + − > + − + −


k (x − x ) : 1 (x − x ) ≤ 1, 1 (x + x ) ≤ β, x , x ≥ 0}.

Thus, the optimization problem is given by

maxx+ ,x− ,y,z µ> x,


s.t. N1 N
P
k=1 zk ≤ (1 − p),
(2), (3), (4), (5) hold,
x+ , x− ≥ 0,
yi ∈ {0, 1}, i = 1, . . . , d,
zk ∈ {0, 1}, k = 1, . . . , N.

You might also like