Stoch 1
Stoch 1
1 Farmer’s Problem
Consider a farmer, who has 500 acres of land, and raise grain, corn and sugar beet. In winter he wants
to decide how much land he should devote for each crop in order to get maximal profit in the next
autumn.
The farmer need 200T of wheat and 240T of corn to feed his cattle. These amounts can be either
raised by himself or bought from an external wholesaler. If more than this amount is produced, the
exceeded part will be sold. Selling prices are 170$ and 150$ per ton of wheat and corn respectively.
The purchase prices are 40% more than the selling price.
Sugar beet sells at 36$ per ton. However, there is a quota on sugar beet production, any amount in
excess of the quota can be sold only at 10$ per ton. The quota this year is 6000T .
Based on past experience, the farmer knows that the mean yield on his land is roughly 2.5T , 3T and
10T per acre for wheat, corn and sugar beets, respectively. And the planting costs are 150$, 230$ and
260$ per acre respectively.
Let x1,2,3 be the acres of land devoted to wheat, corn and sugar beets respectively. w1,2 be the tones
of wheat and corn sold. y1,2 be the tons of wheat and corn purchased. w3 be the tons of sugar beets
sold at the favorable price, and w4 be the tons of sugar beets sold at the lower price. We formulate
the problem as the following Linear Program
minimize: 150x1 + 230x2 + 260x3 + 238y1 − 170w1 + 210y2 − 150w2 − 36w3 − 10w4
such that: x1 + x2 + x3 ≤ 500,
2.5x1 + y1 − w1 ≥ 200,
3x2 + y2 − w2 ≥ 240,
w3 + w4 ≤ 20x3 ,
w3 ≤ 6000,
x1 , x2 , x3 , y1 , y2 , w1 , w2 , w3 , w4 ≥ 0.
1
If we solve this LP, we get the optimal solution based on the expected yield:
This optimal solution is easy to understand. The farmer devotes enough land to sugar beet to reach
the quota of 6000T . He then devotes enough land to wheat and corn to meet his feeding requirement.
The rest land is devoted to wheat production for selling. That is, the optimal solution follows a simple
rule according to decreasing profit per acre. In this example, the order is sugar beets at a favorable
price, wheat for feeding, corn for feeding, wheat for selling, corn for selling, and sugar beets at the
lower price.
One problem of this formulation is that we are assuming to get the expected yield with 100% proba-
bility. In fact, yields can vary above/below their mean. Now we want to study:
We study two possible representation of this variability. One approach is a scenario based representa-
tion, and the other one is a continuous representation.
Assume that the yields for different crops are correlated and all depends on the whether. Say that we
have three possible whether condition: “good”, “average” or “bad”. Here “good” and “bad” stands
for 20% beyond or below the mean yield for all crops.
The LP for the “good” scenario is
minimize: 150x1 + 230x2 + 260x3 + 238y1 − 170w1 + 210y2 − 150w2 − 36w3 − 10w4
such that: x1 + x2 + x3 ≤ 500,
3x1 + y1 − w1 ≥ 200,
3.6x2 + y2 − w2 ≥ 240,
w3 + w4 ≤ 24x3 ,
w3 ≤ 6000,
x1 , x2 , x3 , y1 , y2 , w1 , w2 , w3 , w4 ≥ 0.
2
Table 3: Optimal solution for the good scenario
Therefore, we see that, knowing the whether condition beforehand is very helpful for the farmer to
make his decision. Unfortunately, weather conditions can not be accurately predicted six months
ahead. The farmer must make up his mind without perfect information on yields. Assume all three
scenarios may happen with probability 1/3, and the farmer is interested in maximizing his expected
utility, let’s see how this can be done. First, we notice that among all the variables, (x1 , x2 , x3 ) have
to be chosen before realizing the weather, where the decisions on sales and purchases depend on the
yields. So we index those decision by a scenario index s = 1, 2, 3 corresponding to “good”, “average”
and “bad” weather respectively. Now the farmer’s decision can be formed as the following LP:
3
minimize: 150x1 + 230x2 + 260x3
+ 1/3(238y11 + −170w11 + 210y21 − 150w21 − 36w31 − 10w41 )
+ 1/3(238y12 + −170w12 + 210y22 − 150w22 − 36w32 − 10w42 )
+ 1/3(238y13 + −170w13 + 210y23 − 150w23 − 36w33 − 10w43 )
such that: x1 + x2 + x3 ≤ 500,
3x1 + y11 − w11 ≥ 200,
3.6x2 + y21 − w21 ≥ 240,
w31 + w41 ≤ 24x3 ,
w31 ≤ 6000,
2.4x1 + y12 − w12 ≥ 200,
3x2 + y22 − w22 ≥ 240,
w32 + w42 ≤ 20x3 ,
w32 ≤ 6000,
2x1 + y13 − w13 ≥ 200,
2.4x2 + y23 − w23 ≥ 240,
w33 + w43 ≤ 16x3 ,
w33 ≤ 6000,
x, y, w ≥ 0.
Such a model of a stochastic decision program is known as the extensive form of the stochastic program
because it explicitly describe the second stage decision variable for all scenarios. And its solution is
Suppose we know the scenario before hand, the mean profit is thus 1/3($118, 600 + $167, 677 +
$59, 950) = $115, 406. Hence, we have a gap $7, 016 between the solution of knowing and not knowing
the scenario beforehand. This gap, is called the expected value of perfect information (EVPI).
Another approach the farmer may have is to assume expected yields ad allocate the optimal planting
surface according to these yields (so-called expected value solution). This will lead to an expected profit
4
$107, 240. The loss by not considering the randomness is the difference between this and the stochastic
model profit. This value, $108, 390 − $107, 240 = $1, 150 is the value of the stochastic solution (VSS).
VSS tells us whether we should take a stochastic approach, and EVPI tells us whether we should dig
more information.
This example illustrate the general formulation of a stochastic problem. We have a set of decision
to be taken without full information on some random events. These decisions are called first-stage
decisions, represented as x. Later, full information is received on the realization of some random vector
ξ. Then, second stage or corrective actions y are taken. In mathematical programming terms, this
defines the so-called two-stage stochastic program with recourse of the form
where Q(x, ξ) = min{q> y|W y = h − Tx, y ≥ 0}, ξ is the vector formed by the components of q> ,
h> and T. We assumed that W is fixed (fixed recourese).
In the farmer example, the random vector is a discrete variable with only three different realizations.
The second stage problem can be written as
This form is called the implicit representation of the stochastic program. A more condensed implicit
representation is by defining Q(x) = Eξ Q(x, ξ) as the value function or recourse function:
We now assume that the yields for different crops are independent and follows a continuous distribu-
tion. To be more detailed, assume that the yield for each crop uniformly distributed in [li , ui ] where
li is 80% of the mean, and ui is 120% of the mean.
Notice in this particular example, the recourse function is separable
3
X 3
X
Eξ Q(x, ξ) = Eξ Qi (xi , ξ) = Qi (xi ),
i=1 i=1
5
where Qi (xi , ξ) is the optimal second-stage value of purchases and sales of crop i.
Considering Sugar beets:
Therefore, we have
This is a non-linear program, solve the solution x1 = 135.83, x2 = 85.07 and x3 = 279.10.
6
2 News Vendor Problem
A news vendor goes to the publisher every morning and buys x newspaper at a price of c per paper.
This number is usually bounded above by some limit u. The news vendor then tries to sell as many
newspapers as he can at a price q > c. Any unsold newspaper can be returned at a price q < c.
Demand for newspapers varies over days and is described by a random variable ξ. Assume the news
vendor cannot return to the publisher to buy more newspapers during the day and readers only want
the last edition.
To formulate this problem, we use y to represent the effective sales and w to be the number of
newspapers returned. Hence, the problem can be formulated as
min cx + Q(x)
s.t. 0 ≤ x ≤ u,
where Q(x) = Eξ Q(x, ξ), and
Q(x, ξ) = min − qy(ξ) − rw(ξ)
s.t. y(ξ) ≤ ξ,
y(ξ) + w(ξ) ≤ x,
y(ξ), w(ξ) ≥ 0.
It is easy to see that the optimal solutions are y ∗ (ξ) = min(ξ, x) and w∗ (ξ) = max(x−ξ, 0). Therefore,
the second stage expected value function is
Q(x) =Eξ [−q min(ξ, x) − r max(x − ξ, 0)]
Z x Z ∞
= (−qξ − r(x − ξ))dF (ξ) + −qxdF (ξ)
−∞ x
Z x
= − (q − r) ξdF (ξ) − rxF (ξ) − qx(1 − F (x)).
−∞
Since Q(x) is convex and differentiable when ξ is a continuous random variable, the optimal x mush
satisfy ∗
x =0 if c + Q0 (0) > 0,
x∗ = u if c + Q0 (u) < 0,
c + Q0 (x∗ ) = 0 otherwise.
We hence have
Q0 (x) = −q + (q − r)F (x).
Taking derivative of cx + Q(x) we get the optimal solution
∗
x =0 if (q − c)/(q − r) < F (0),
x∗ = u ¡ if (q − c)/(q − r) > F (u),
∗ −1 q−c ¢
x =F q−r otherwise.
7
3 Financial Planning
To provide for a child’s college education Y years from now. We currently have $b to invest in any
of I investments. After Y years, we will have a wealth that we would like to have exceed a tuition
goal $G. Suppose we can change investments every v years, so we have Y /v investment periods. Now
suppose exceeding $G would be equivalent to having an income of q% of the excess, while not meeting
the goal would lead to borrowing for a cost r% of the amount short. The return of each investment on
each period is random. We observe the return of each past period, but can not anticipate. Let I = 2
including a stock and a government security. Y = 15 and v = 5. Therefore we have 3 investment
periods. Assume we have 8 possible scenario: independent, equal likelihood of having one of the two
cases in each period :(1) 1.25 for stock and 1.14 for bound; (2) 1.06 for stock and 1.12 for bond. We
have the following program:
X X ¡
Maximize: ··· p(s1 , · · · , sH ) − rw(s1 , · · · , sH ) + gy(s1 , · · · , sH ))
sH s1
X
s.t. x(i, 1) = b
i
X X
−ξ(i, t − 1, s1, · · · , st−1 )x(i, t − 1, s1 , · · · , st−2 ) + x(i, t, s1, · · · , st−1 ) = 0,
i i
t = 2, · · · , H; ∀(s1 , · · · , st−1 );
X
−ξ(i, H, s1, · · · , sH )x(i, H, s1 , · · · , sH−1 ) − y(s1 , · · · , sH ) + w(s1 , · · · , sH ) = G
i
∀(s1 , · · · , sH ).