Solutions
Solutions
Haotian Pang
Spring 2016
Exercise 2.15
You can use the pivot tool to see that from this dictionary, it cannot get to the dictionary
in which the x1 and x2 are non-basic variables. Hence w1 and w2 cannot be initial slack
variables.
To prove it rigorously, there are two arguments you can use:
1. Note that w1 cannot be expressed as a linear combination of x1 and x2 alone, hence x1
and x2 cannot be non-basic variables for any dictionary;
2. In this optimal solution, write the first constraint as x1 = 3 + w1 + 2x2 . Note you can
let w1 enter and x1 leave, and the resulting dictionary has x1 and x2 as non-basic variables.
Now let approach 0, the coefficients blow up to infinity. Hence such dictionary does not
exist.
Exercise 4.3
The problem is given by
1
Smallest index rule has two pivots in this case:
2
Exercise 4.3
3
4
Exercise 4.10
Since in the optimal dictionary, there are k nonbasic variables that are original slack variables,
hence the optimal solutions cannot be arrived in less than k pivots. Now we need to prove
that the optimal solution can be arrived in exactly k pivots. We know that there are k x
variables that are basic in the optimal solution. It suffices to prove that in each pivot, we can
let one w variable leave and one x variable enter. As we can ignore feasibility preservation,
the only problem that keeps us from doing this is when the pivot coefficient is zero. We
look at the problem backwards: from the optimal dictionary, we want to show that we can
get back to the initial dictionary in exactly k pivots. Suppose we are at optimal dictionary.
There must exist a non-zero coefficient for w1 , ... ,wk so that we can perform a valid pivot,
5
otherwise we cannot got back to the initial dictionary, by the same argument as Q2.15. We
let one of w1 , ..., wk to enter, and now we have k − 1 nonbasic slack variables. We repeat
the process until all slack variables are basic. This can be done in exactly k pivots.
Exercise 5.1
There are 4 variables and 3 constraints in the primal, so there will be 3 variables and 4
constraints in the dual. Table 5.1 tells that an equality constraint corresponds to a free
variables and an inequality constraint corresponds to a nonnegative variable. Therefore y3
is free and y1 and y2 are nonnegative. x1 and x4 are free variables so that means the first
and the fourth constraints will be equality and the other two will be inequality. Now it is
easy to write down the dual as:
min 3y2 + y3
−y1 + 4y2 −y3 = 1
−2y1 + 3y2 −y3 ≥−2
y1 + 4y2 +2y3 ≥ 0
−y1 − 2y2 +y3 = 0
y1 ≥ 0
y2 ≥ 0
Exercise 5.2
The primal problem is
6
The optimal solution is found to be x1 = 0, x2 = 3.5 and x3 = 0. The dual problem is
Exercise 5.5
(a)
7
(d)
AMPL Expercise
a) Since we want to minimize the risk subject to a lower bound on reward, the problem
becomes:
T
1X
min yt
T t=1
X
−yt ≤ xj (Rj (t) − rewardj ) ≤ yt
j
T
1 XX
xj Rj (t) ≥ µ
T t=1 j
X
xj = 1
j
xj ≥ 0.
We have the AMPL code as the following:
reset;
set A; # asset categories
set T; # dates
param n := card(T);
8
param reward;
param R {T,A};
param mean {j in A} := ( sum{i in T} R[i,j] )/n;
param Rtilde {i in T, j in A} := R[i,j] - mean[j];
var x{A} >=0;
var y{T} >= 0;
minimize risk: sum{i in T} y[i];
s.t. reward_bound: sum{j in A} mean[j]*x[j] >= reward;
s.t. tot_mass: sum{j in A} x[j] = 1;
s.t. y_lo_bnd {i in T}: -y[i] <= sum{j in A} Rtilde[i,j]*x[j];
s.t. y_up_bnd {i in T}: sum{j in A} Rtilde[i,j]*x[j] <= y[i];
data;
set A := HairProducts Cosmetics Cash;
set T := 2007-01 2007-02 2007-03 2007-04;
param R: HairProducts Cosmetics Cash:=
2007-01 0.5 2.0 1.0
2007-02 2.0 0.5 1.0
2007-03 2.0 2.0 1.0
2007-04 1.0 2.0 1.0;
The result is
HairProducts 0.400
Cosmetics 0.400
Cash 0.200
Reward: 1.4000000
Risk: 0.20000.
9
b) We change the mean-absolute-deviation back into mean-square-deviation and got the
following problem:
T
1XX
min ( xj (Rj (t) − rewardj ))2
T t=1 j
T
1 XX
xj Rj (t) ≥ µ
T t=1 j
X
xj = 1
j
xj ≥ 0.
reset;
set A; # asset categories
set T; # dates
param n := card(T);
param reward;
param R {T,A};
param mean {j in A} := ( sum{i in T} R[i,j] )/n;
param Rtilde {i in T, j in A} := R[i,j] - mean[j];
var x{A} >=0;
var y{T} >= 0;
minimize risk: sum{i in T} (sum{j in A} Rtilde[i,j]*x[j])^2;
s.t. reward_bound: sum{j in A} mean[j]*x[j] >= reward;
s.t. tot_mass: sum{j in A} x[j] = 1;
data;
set A := HairProducts Cosmetics Cash;
set T := 2007-01 2007-02 2007-03 2007-04;
param R: HairProducts Cosmetics Cash:=
2007-01 0.5 2.0 1.0
2007-02 2.0 0.5 1.0
2007-03 2.0 2.0 1.0
2007-04 1.0 2.0 1.0;
10
solve;
printf {j in A: x[j] > 0.001}: "%45s %6.3f \n", j, x[j];
printf: "Reward: %10.7f\n",
sum{j in A} mean[j]*x[j];
printf: "Risk: %10.5f\n",
sum{i in T} y[i]/n;
The result is
HairProducts 0.365
Cosmetics 0.421
Cash 0.214
Reward: 1.4000000
Risk: 0.05895.
11