• No results found

Handling More Complex Objectives

Let’s look at another production example, which is a modification of Exam-ple 2.1.

Example 2.5. Consider the setting of Example 2.1, but suppose now that, due to market demand, we can only sell the first 30 units of part X for £1000.

Further units up to 60 can be sold for £700 and any excess units after that can be sold only for £400. Now how should we schedule production?

Here, the revenue from selling X is given by the function depicted in Figure 2.1.

We can write this function mathematically as:

f (o1) =





1000o1 o1 ∈ [0, 30]

30000 + 700(o1− 30) o1 ∈ [30, 60]

51000 + 400(o1− 60) o1 ∈ [60, ∞)

Notice that, for example, if we produce o1 = 45 parts X, we should get 30 · 1000 profit for the first 30, which leaves 45 − 30 = 15 each giving a profit of 700. Thus, we get 30000 + 700(o1− 30), just like the function says.

We cannot model this problem directly as a linear program, since our profit function is non-linear. However, notice that it is linear over 3 distinct regions, and its slope is decreasing. Suppose that we split the decision variable o1 into 3 non-negative variables, o1,1, o1,2, and o1,3 representing how many units of part X

0 30 60 90 0

10 20 30 40 50 60 70

Units of X Produced

Revenuein£1000’s

Figure 2.1: Revenue for Example 2.5

we sell at each of the prices 1000, 700, and 400, respectively. Then, we set:

o1 = o1,1+ o1,2+ o1,3.

We add this as a constraint to the program. All of the existing constraints in-volving o1 remain unchanged. We can represent the profit from these decisions by introducing the terms:

1000o1,1+ 700o1,2+ 400o1,3

in our objective function. Additionally, from the problem’s statement we have that:

o1,1 ≤ 30 o1,2 ≤ 30

We add these (together with the restrictions o1,1, o1,2, o1,3 ≥ 0) to the program.

The final result looks like this:

maximise 1000o1,1+ 700o1,2+ 400o1,3+ 1800o2

subject to o1 = o1,1+ o1,2+ o1,3 o1,1 ≤ 30

o1,2 ≤ 30

o1 = 4x1+ 3x3+ 6x4 o2 = x2+ x3+ 3x4

i1 = 100x1+ 70x2+ 120x3+ 270x4 i2 = 800x1+ 600x2+ 2000x3+ 4000x4 i3 = 16x1+ 16x2+ 50x3+ 48x4

i1 ≤ 6000 i2 ≤ 100000 i3 ≤ 1000 x1, x2, x3, x4 ≥ 0 o1,1, o1,2, o1,3 ≥ 0

i1, i2, i3, o2 unrestricted

We claim that this program models the problem we are interested in. Notice, however, that there is nothing saying that the first 30 parts must be sold at the high price. Suppose it was feasible to make 50 parts in our original program.

We could now set o1,1 = 10, o1,2 = 20, and o1,3 = 20. This would be a feasible solution, since o1 = o1,1 + o1,2 + o1,3 = 50, as desired, and also 0 ≤ o1,1 ≤ 30, 0 ≤ o1,2 ≤ 30, and 0 ≤ o1,3. However, this doesn’t really model the problem as stated! This is okay, because (as you can check), this will not be an optimal solution the program. Indeed, we could decrease o1,3 by 20, and increase o1,1 by 20, to get another feasible solution that produced 50 total parts, and this would change our revenue by (1000 − 400)20. Intuitively, then, at any optimal solution, the first 30 parts must be sold at the price of 1000, the next 30 (if there are any) at the price of 700, and the remaining at the price of 400. In other words, at an optimal solution, our linear objective will always agree with the value f (o1) for our original problem. We now show that, under certain conditions on our piecewise linear function, this will always work.

b1 b2 b3 b4 0

20 30 35

x

f(x)

Definition 2.3 (Piecewise Linear Concave Function). We say that a function f is piecewise linear if it has the form:

f (x) = di+ λi(x − bi), for bi ≤ x ≤ bi+1

where the constants b1, b2, b3, . . . , bp+1 (with b1 = 0) are the boundaries be-tween our p different linear functions (note if there is no upper boundary, we can set bp+1 = ∞), the constants λ1, λ2, λ3, . . . , λp are the slopes of these functions, and the constants d1, d2, d3, . . . , dp (with d1 = 0) satisfy:

di+ λi(bi+1− bi) = di+1,

for all 1 ≤ i < p. We say that a piecewise linear function is concave if λ1 > λ2 > λ3 > · · · > λp.

Note that by fixing b1 = 0 and d1 = 0, we ensure that f (0) = 0. Additionally, the condition on di ensures that the function is continuous at the boundary points, since it requires that the linear functions λi(x − bi) + di and λi+(x − bi+1) + di+1

agree when we have x = bi+1 on the boundary between the intervals for these functions. The condition for being concave, just corresponds to our intuition that the slopes should be decreasing.

In general, if we have a linear program with an objective f (z) that is a piece-wise linear function of some variable z, we can convert it into a linear program as follows:

1. We introduce new non-negative variables z1, z2, z3, . . . , zp corresponding to each interval on which f is linear.

2. We add the constraint z = z1+ z2+ z3 + · · · + zp to the program.

3. We replace the term f (z) in the objective with the expression: (λ1z1+ λ2z2+ λ3z3+ · · · + λpzp).

4. We introduce a constraint stating that zi ≤ bi+1− bi, for every i = 1, 2, . . . , p.

If bp+1 = ∞, then we will get a constraint of the form zp ≤ ∞ − bp, which we can leave out, since it will be satisfied by any zp.

We claim that if we carry out the above procedure on any program with a piecewise linear, concave function, we will get a program whose optimal objective agrees with the original program. First let’s formalise our previous observation that things should be okay as long as we make sure to sell as many items as possible at the higher prices first. Consider a feasible solution to our modified linear program, including the new variables z1, z2, . . . , zp, and let h be the largest index such zh > 0 (so, zi = 0 for all i > h). We say that this solution is good if zi = bi+1− bi for all i < h.

Claim 2.1. If z1, z2, . . . , zp is part of a good solution, then f (z) = λ1z1+ λ2z2+ · · · + λpzp

Proof. First, note that, due to our added constraint:

z =

zi (Remove last term from summation)

= zh+

On the other hand, if we rearrange the condition:

λizi (Remove last term of summation)

= λhzh+

Now, we just need to show that every optimal solution of the our program must be good. We will make use of the fact that our piece-wise linear function is concave.

We show the contrapositive: that if a solution is not good, it cannot be optimal.

Fix a feasible solution to our program, and suppose it assigns values z1, z2, . . . , zp to the variables that we introduced to model f (z). As before, let h be the largest index for which zh > 0. Then, if our solution is not good, then for some k < h, we have zk < bk+1− bk. Define  = min(bk+1− bk− zk, zh). Note that our assumptions so far ensure that  > 0. Suppose we construct a new solution in which we set zh = zh− , zk = zk+  and zi = zi for all other i. Then, in our new solution, the value of z is unchanged, since we added  to zkand subtracted  from zh. Thus, all the constraints involving z will still be satisfied. All constraints and restrictions involving zifor i 6∈ {k, h} will still be satisfied, as well, since we didn’t change those variables. Finally, notice that our choice of  guarantees that 0 ≤ zh ≤ bh− bh−1 and 0 ≤ zk ≤ bk+1− bk, so these restrictions and constraints are also valid. Thus, we have constructed a new feasible solution to our linear program. How did this modification change the objective value of our linear program? We decreased zh

by , which decreases our objective by λh and increased zk by , which increases our objective by λk. So the total change is λk − λh > 0, since λk > λh (because f is concave) and  > 0. Thus, we have found a new feasible solution with value larger than our original solution, and so our original solution cannot be optimal.

It follows that indeed in every optimal solution of our transformed linear pro-gram, the objective value introduced into the objective will always that agrees with the piece-wise linear function f (z) that we wanted to model. Thus, we can safely se this trick to model any maximisation problem with piece-wise linear, concave objectives.