Sunteți pe pagina 1din 8

CO 250 I NTRODUCTION TO O PTIMIZATION , S PRING 2017

A SSIGNMENT 3 SOLUTIONS∗, S ECTION : O NLINE

Due: Friday, May 26, 2017, at 4:00 p.m.

y,
am
Exercise 1 (25 marks). The figure below shows a graph G = (V, E). Each edge ij ∈ E in the figure is
labelled by its length cij , and each vertex by its name.

el Sw
9

b
nç C. t
Tu h,
7
ic

4 2 5 2
ov

s a d
6 1
hk
L.
as

Write down the IP formulation for finding a shortest s, t-path in the graph G, both in compact notation
(see Section 1.5.2 of the textbook) and in explicit notation (where each constraint of the IP and the objective
.P

function is written in full, and no abbreviations are allowed; you may use either matrix-vector notation or
scalar notation).
K

Solution: Using the course notes we know that the IP formulation for the shortest path problem for a
given graph G = (V, E) and vertices s, t ∈ V is given by
P
(IP) min c x
P e∈E e e
s.t e∈δ(U ) xe ≥1 (U ⊆ V, s ∈ U, t ∈
/ U)
xe ≥ 0 (e ∈ E)
xe integer (e ∈ E)

COPYRIGHT: Reproduction, sharing or online posting of this document is strictly forbidden University
c of Waterloo, K.
Pashkovich, C. Swamy, L. Tunçel.
1
2

Thus, applying this to our example we obtain


(IP) min 6xsa + 4xsb + 9xst + 2xab + xad + 5xat + 7xbt + 2xdt
s.t xsa + xsb + xst ≥1 (cut δ({s}))
xab + xad + xat + xsb + xst ≥1 (cut δ({s, a}))
xbt + xsa + xab + xst ≥1 (cut δ({s, b}))

y,
xda + xdt + xsa + xsb + xst ≥1 (cut δ({s, d}))
xad + xat + xbt + xst ≥1 (cut δ({s, a, b}))

am
xab + xat + xdt + xsb + xst ≥1 (cut δ({s, a, d}))
xab + xad + xbt + xdt + xsa + xst ≥1 (cut δ({s, b, d}))
xat + xbt + xdt + xst ≥1 (cut δ({s, a, b, d}))

el Sw
xsa , xsb , xst , xab , xad , xat , xbt , xdt ≥0
xsa , xsb , xst , xab , xad , xat , xbt , xdt integer.
We did not define the variables and we did not give explanations for the constraints in this solution file
since these were already given in the textbook. Note that in an exam, you must define the variables and give

nç C.
explanations/justification for the objective function and the constraints, unless specifically instructed to do
otherwise.
Tu h,
ic
ov
hk
L.
as
.P
K
3

Exercise 2 (25 marks). Alice has a non-deformable box of size 100mm × 120mm × 60mm and five different
non-deformable balls. Each ball has a radius and value as shown below.

y,
Balls A B C D E
Radius (mm) 10 15 20 25 22

am
Value ($) $20 $60 $70 $110 $100

Alice would like to pack these balls in the box. A ball is considered to be packed if it is completely

el Sw
contained in the box.
Provide a non-linear programming (NLP) formulation to help Alice pack balls so that the total value of
the packed balls is maximized. Your objective function must be a linear function. Your formulation should

nç C.
only use constraints involving quadratic functions; some examples are:

x21 + x2 ≤ 5,
Tu h,
x1 x2 + x22 − 2x3 = 5,
ic

2x1 + 3x2 ≥ 7.
ov

Note that affine functions are also quadratic functions.


Also, note that we can encode a binary variable xi ∈ {0, 1} via the quadratic constraint xi (1 − xi ) = 0.
hk
L.

(Hint: You may ignore gravity: for example, letting (0, 0, 0)> denote the bottom far left corner of the box,
it is OK to only include ball A in the box, centered at (20, 20, 20)> , although this would mean that ball A is
as

floating in the box.)


Solution: The formulation below uses a max objective, and =, ≥, and ≤ constraints; at the end of the
.P

solution we also show the (NLP) formulation in the form specified in the textbook. For this exercise will
accept solutions specified in either form.
K

Variables. We need to decide which balls to pack in the box, so it is natural to introduce a binary (i.e., {0, 1})
variable xi for each ball i ∈ {A, B, C, D, E}, with xi = 1 indicating that ball i is packed, and xi = 0
indicating that it is not packed. Note that we cannot explicitly specify xi ∈ {0, 1} in our formulation (unlike
in an IP), but we will impose suitable constraints that enforce this.
These variables alone are not enough to encode that the balls selected, i.e., those with xi = 1, can indeed
be packed properly in the box. In order to encode this, we need variables that specify where these balls are
positioned in the box. Therefore, for each ball i, we include variables pi1 , pi2 , pi3 to denote the position (in
4

mm) of the center of ball i if it is packed; otherwise, their values do not mean anything. Here, subscripts 1,
2, 3 correspond to the box dimensions, 100mm, 120mm, 60mm respectively.

Objective. Given the xi variables, the total value of the balls packed is 20xA + 60xB + 70xC + 110xD +

y,
100xE , so our objective is to

am
max 20xA + 60xB + 70xC + 110xD + 100xE .

el Sw
Constraints. First, we enforce that each xi only takes values 0 or 1 via the constraints

xi (1 − xi ) = 0 ∀i ∈ {A, B, C, D, E}

nç C.
Note that the LHS above is a quadratic function.
Next, we ensure that each ball is positioned so that it is properly contained in the box. Let ri denote the
Tu h,
radius of ball i; note that this is not a variable, but just a symbol to represent a piece of data. For ball i, we
impose that for each j = 1, 2, 3, we have ri ≤ pij ≤ (box dimension in direction j) − ri . This yields the
ic

following constraints.
ov

pi1 , pi2 , pi3 ≥ ri , pi1 ≤ 100 − ri , pi2 ≤ 120 − ri , pi3 ≤ 60 − ri ∀i ∈ {A, B, C, D, E}


hk

Finally, we need to enforce that the balls for which xi = 1 are positioned so that they do not overlap in
L.

space. Note that balls i and i0 do not overlap if and only if the distance between their centers, which is given
as

p 0 0 0 √
by (pi1 − pi1 )2 + (pi2 − pi2 )2 + (pi3 − pi3 )2 , is at least ri + ri0 . We are not allowed to use . . . in our
constraints as this does not constitute a quadratic function; therefore, we will square both sides of the above
.P

constraint. Also, we should only enforce the above constraint if xi = xi0 = 1. Thus, we can enforce that the
balls with xi = 1 do not overlap with the following constraints
K

0 0 0

(pi1 − pi1 )2 + (pi2 − pi2 )2 + (pi3 − pi3 )2 ≥ (ri + ri0 )2 xi xi0 
0 0 0
∀i, i0 ∈ {A, B, C, D, E}, i 6= i0 .
≡ (pi1 − pi1 )2 + (pi2 − pi2 )2 + (pi3 − pi3 )2 − (ri + ri0 )2 xi xi0 ≥ 0 

Observe that LHS of the final constraint is a quadratic function of the variables (since ri , ri0 are not variables).
If xi = xi0 = 1, then the above constraint correctly imposes the desired spacing between the centers of balls
0 0 0
i and i0 . Otherwise, the above constraint is vacuously true since (pi1 − pi1 )2 + (pi2 − pi2 )2 + (pi3 − pi3 )2 is
always nonnegative.
5

Putting everything together, our NLP formulation is as follows.

max 20xA + 60xB + 70xC + 110xD + 100xE

s.t. xi (1 − xi ) = 0 ∀i ∈ {A, B, C, D, E}

y,
pi1 , pi2 , pi3 ≥ ri , pi1 ≤ 100 − ri , pi2 ≤ 120 − ri , pi3 ≤ 60 − ri ∀i ∈ {A, B, C, D, E}
0 0 0
(pi1 − pi1 )2 + (pi2 − pi2 )2 + (pi3 − pi3 )2 − (ri + ri0 )2 xi xi0 ≥ 0 ∀i, i0 ∈ {A, B, C, D, E},

am
i 6= i0 .

el Sw
Aside: We can also put this problem into the form described on page 37 of the textbook.

min −20xA − 60xB − 70xC − 110xD − 100xE

s.t. xi (1 − xi ) ≤ 0 nç C. ∀i ∈ {A, B, C, D, E}
Tu h,
−xi (1 − xi ) ≤ 0 ∀i ∈ {A, B, C, D, E}

−pi1 , −pi2 , −pi3 ≤ −ri , pi1 − 100 + ri ≤ 0, pi2 − 120 + ri ≤ 0, pi3 − 60 + ri ≤ 0 ∀i ∈ {A, B, C, D, E}
ic

0 0 0
−(pi1 − pi1 )2 − (pi2 − pi2 )2 − (pi3 − pi3 )2 + (ri + ri0 )2 xi xi0 ≤ 0 ∀i, i0 ∈ {A, B, C, D, E},
i 6= i0 .
ov
hk
L.
as
.P
K
6

Exercise 3 (25 marks). Let m and n be positive integers, n ≥ m ≥ 1, and let x := (x1 , x2 , . . . , xn )> .

(a) (15 marks) Consider the following linear program (for A ∈ Rm×n and c ∈ Rn ):

y,
max {c> x : Ax = 0, x ≥ 0}. (P)

am
Prove that (P) is either unbounded, or has an optimal value of 0. If (P) is unbounded, what is a certificate
of unboundedness?
Solution: First, note that x̄ := 0 is a feasible solution to (P). So (P) is feasible, and if it is not

el Sw
unbounded, then its optimal objective value is at least 0. We claim that if (P) has a feasible solution with
positive objective value, then it is unbounded; otherwise, its optimal value is 0. To see this, first note
that if there is no feasible solution with positive objective value, (P) is not unbounded and has optimal

nç C.
value at most 0; as x = 0 is a feasible solution, this means that the optimal value is exactly 0. Secondly,
suppose d is a feasible solution with c> d > 0. Then, d is a certificate of unboundedness for (P): we have
Ad = 0, d ≥ 0 (since d is feasible), and c> d > 0 (by assumption).
Tu h,
Note that we do not have to use x̄ as part of the certificate here (d itself is a feasible solution, in
addition to being the direction). Upon defining
ic

x(t) := td,
ov

is a feasible solution of (P) for every t ≥ 0, and c> x(t) = tc> d → +∞ as t → +∞. The above
argument holds for all LPs of the form (P).
hk
L.

(b) (10 marks) Let c, c ∈ Rn be such that ci , ci > 0 for all i ∈ {1, . . . , n}. Let (P’) be the LP with the same
as

constraints as (P) but with objective function

max c> x.
.P

Prove that (P) and (P’) have the same outcome: that is, (P) is unbounded iff (P’) is unbounded, and (P)
has an optimal value of 0 iff (P’) has an optimal value of 0.
K

Solution: Suppose the system Ax = 0, x ≥ 0 has a feasible solution d 6= 0. Then, we have di > 0
for some i ∈ {1, . . . , n}, and since ci , ci > 0, we have c> d > 0 and c> d > 0, and so d is a certificate
of unboundedness for both (P) and (P’) showing that both LPs are unbounded. Otherwise, if x̄ := 0 is
the only feasible solution to the above system, then as in the solution to part (a), both (P) and (P’) have
optimal value 0.
7

Exercise 4 (25 marks). (a) (10 marks) Consider the following linear program.

min (3, 2, −2, 0, 1)x

subject to

y,
   
1 −2 1 2 2 5
−2 1 4 4 −2 x =  4 
   

am
4 0 5 6 3 8

x ≥ 0.
Show that this LP is infeasible by exhibiting a certificate of infeasibility and justifying why this implies

el Sw
that the LP is infeasible.
Solution: We claim that y := (−1, −1, 1)> is a certificate of infeasibility. To see this, note that every
feasible solution x must satisfy

nç C.
   
1 −2 1 2 2 5
(−1, −1, 1) −2 1 4 4 −2 x = (−1, −1, 1)  4 
   
4 0 5 6 3 8
Tu h,
which evaluates to (5, 1, 0, 0, 3)x = −1. However, the left-hand-side is nonnegative for every feasible x
(since x ≥ 0). Therefore, the above LP is infeasible.
ic

(b) (10 marks) Consider the following linear program.


ov

max (1, −10, 1, −1, 3)x

subject to
hk

" # !
3 1 9 3 1 −2
x=
L.

1 3 5 2 2 2
as

x1 ≤ 0, x2 , x3 ≥ 0.

You are given that x := (−1, 1, 0, 0, 0)> is a feasible solution to this LP. Show that this LP is unbounded.
.P

Justify your answer.


(Hint: Obtain a suitable vector d and proceed as described on page 47 of the textbook (and in Proposition
2.2 on page 48 of the textbook). Note that x1 ≤ 0 and x4 , x5 are free; how does this change the
K

requirements on d stated in Proposition 2.2? There is a suitable d with d2 = 0.)


Solution: Let c> := (1, −10, 1, −1, 3) and Ax = b denote the equality constraints of the given
LP. First, we argue that a vector d satisfying (1) Ad = 0, (2) d1 ≤ 0, d2 , d3 ≥ 0, and (3) c> d > 0
constitutes a certificate of unboundedness for the above LP. (Conditions (1) and (3) are the same as those
in Proposition 2.2 for certificate of unboundedness for LPs in standard equality form; condition (2) is the
only change.) To see this, and why we have the modified condition (2), consider the family x(t) = x+td,
where t ≥ 0. For x(t) to be feasible, we require that x1 (t) ≤ 0, x2 (t), x3 (t) ≥ 0, and to ensure that this
8

holds for every t ≥ 0, it suffices to require that d1 ≤ 0, and d2 , d3 ≥ 0: since x1 ≤ 0, x2 ≥ 0, x3 ≥ 0,


we have

x1 (t) = x1 + td1 ≤ 0, x2 (t) = x2 + td2 ≥ 0, x3 (t) = x3 + td3 ≥ 0.

y,
Note that since x4 , x5 are free, there are no restrictions on d4 , d5 . Also, (as before) we have Ax(t) =
Ax + t(Ad) = b, and c> x(t) = c> x + t(c> d), which tends to ∞ as x → ∞.

am
Now consider d := (−1, 0, 1, −2, 0)> . We can verify that Ad = 0, and c> d = 2 > 0 (and d1 ≤ 0,
d2 , d3 ≥ 0). This shows that the above LP is unbounded.
(Note: There is another suitable d with d1 = d2 = 0, namely, d := (0, 0, 1, −3.25, 0.75)> , with

el Sw
c> d = 6.5).
(c) (5 marks) Consider the following linear program.
max (−1, 6, 4, −5, 2)x

nç C.
subject to

1 0 −1 4 2
 
11

Tu h,
−2 2 −1 −1 2  x =  −7 
   
3 1 3 1 −1 12
ic

x ≥ 0.

You are given that x := (1, 0, 2, 3, 0)> is a feasible solution to this LP. Prove that x is an optimal solution
ov

by obtaining a suitable certificate of optimality and justifying why this implies that x is an optimal
solution to the LP.
hk

(Hint: There is a certificate y with y1 = −1.)


L.

Solution: First, note that the objective value of the feasible solution x is −8. We now show that
as

every feasible solution has objective value at most −8. We claim that y := (−1, 3, 2)> is a certificate of
optimality. Every feasible solution must satisfy
   
.P

1 0 −1 4 2 11
(−1, 3, 2) −2 2 −1 −1 2  x = (−1, 3, 2)  −7  ≡ (−1, 8, 4, −5, 2)x = −8.
   
3 1 3 1 −1 12
K

So we have −8 − (−1, 8, 4, −5, 2)x = 0 for every feasible solution. So the objective value z(x) of every
feasible solution x is
 
z(x) = (−1, 6, 4, −5, 2)x = (−1, 6, 4, −5, 2)x + −8 − (−1, 8, 4, −5, 2)x

= (0, −2, 0, 0, 0)x − 8.

Since (0, −2, 0, 0, 0)x ≤ 0 for every x ≥ 0, we infer that z(x) ≤ −8 for every feasible x. Hence, x is an
optimal solution to the above LP, as certified by y = (−1, 3, 2)> .

S-ar putea să vă placă și