You are on page 1of 10

IE426 - Optimization models and application

Fall 2013 - Homework #3 Answer

Goal Programming
1. Check that the original LP is infeasible by solving it with AMPL.
Answer: we can build the LP model in AMPL as
set row = 1..5;
# number of linear constraints
set col = 1..4;
# number of variables
param coef_obj {col};
param coef_con {row,col};

# coefficient of objective
# coefficient of constraints

var x {col} >= 0;

# variables

minimize obj:
sum{j in
subject to row1:
sum{j in
subject to row2:
sum{j in
subject to row3:
sum{j in
subject to row4:
sum{j in
subject to row5:
sum{j in

col} coef_obj[j] * x[j];


col} coef_con[1,j] * x[j] <= 5;
col} coef_con[2,j] * x[j] <= 4;
col} coef_con[3,j] * x[j] = 9;
col} coef_con[4,j] * x[j] >= 3;
col} coef_con[5,j] * x[j] >= 1;

with data

data;
param: coef_obj:=
1 1
2 1
3 1
4 1;
param coef_con:
1
2
1 1
3
2 3
1
3 5
3
4 0
1
5 1
1

3
2
2
3
0
-1

4 :=
4
1
3
1
1;

AMPL calls LP solver and reports infeasibility of the problem


Ampl: model 1.1.mod;
Ampl: solve;
presolve: constraint row4 cannot hold:
body >= 3 cannot be <= 2.91667; difference = 0.0833333
2. Write an integer LP that finds the constraints subset with maximum cardinality.
Answer: the IP problem is formed as
max

y1 + y2 + y3 + y4 + y5

s.t.

x1 + 3x2 + 2x3 + 4x4

5 + M (1 y1 )

3x1 + x2 + 2x3 + x4

4 + M (1 y2 )

5x1 + 3x2 + 3x4 + 3x4 9 + M (1 y3 )


5x1 + 3x2 + 3x4 + 3x4 9 M (1 y3 )
x2 + x4

3 M (1 y4 )

x1 + x2 x3 + x4

1 M (1 y5 )

xi 0, yj B

i, j

where M is a large enough number.


3. Solve the IP model.
Answer: The solution obtained from AMPL by calling CPLEX is

ampl: model 1.3.mod;


ampl: solve;
CPLEX 12.5.0.0: optimal integer solution; objective 4
3 MIP simplex iterations
0 branch-and-bound nodes
ampl: display y;
y [*] :=
1 0
2 1
3 1
4 1
5 1
;
which implies that all except the 1st constraint is infeasible. To verify the problem becomes
feasible after removing the 1st constraint, we solve the original LP but drop off the 1st
constraint and obtain
CPLEX 12.5.0.0: optimal solution; objective 3
0 dual simplex iterations (0 in phase I)
ampl: display x
ampl? ;
x [*] :=
1 0
2 0
3 0
4 3
;
indicating that the problem becomes feasible.
4. Formulate a preemptive goal programming problem and solve it in AMPL, describe which
subset of the constraints are feasible for this solution.
Answer: the preemptive goal programming problem can be formulated as
min y2 + y31 + y32 + y4 + y5
s.t.

x1 + 3x2 + 2x3 + 4x4

5 + y1

3x1 + x2 + 2x3 + x4

4 + y2

5x1 + 3x2 + 3x4 + 3x4

= 9 + y31 y32

x2 + x4

3 y4

x1 + x2 x3 + x4

1 y5

xi 0, yj 0
3

i, j

The solution obtained from AMPL by calling CPLEX is


CPLEX 12.5.0.0: optimal solution; objective 0
1 dual simplex iterations (0 in phase I)
y1 = 7
y2 = 0
y31 = 0
y32 = 0
y4 = 0
y5 = 0
which implies that all except the 1st constraint are feasible.
The second stage would be:

min

y1

s.t.

x1 + 3x2 + 2x3 + 4x4

5 + y1

3x1 + x2 + 2x3 + x4

5x1 + 3x2 + 3x4 + 3x4 = 9


x2 + x4

x1 + x2 x3 + x4

xi 0, y1 0

The solution would be:


ILOG AMPL 10.100, licensed to "lehigh university-bethlehem, pa".
AMPL Version 20070505 (Linux 2.6.9-5.ELsmp)
CPLEX 12.5.0.0: optimal solution; objective 4
4 dual simplex iterations (0 in phase I)
y1 = 4

Logic

Note: all variables are assumed binary unless otherwise specified.


4

1. b c (d a)
Answer: the statement is true if and only if
xb + (1 xc ) + x1

x1 (1 xd ) + xa 1
x1

(1 xd )

x1

xa

2. The opposite of b c (d a)
Answer: the opposite is
(b c (d a)) = (b) ((c (d a)))
= (b) ((c (d a)))
= b c (d a)
The statement is true if and only if
(1 xb ) =

xc =

x1 =

x1 xd + (1 xa )
x1

xd

x1

(1 xa )

3. c d (a b)
Answer: the statement can be formulated as
x1

x2

x1

(1 xc )

x1

(xd )

x1 + 1 (1 xa ) + xd
x2

xa + xb

x2

xa

x2

xb

4. (a b) (a c) d c

Answer: the statement can be formulated as


xr =

xl

xr x1 + x2
x1

xr

x2

xr

x1

xa

x1

xb

x1 + 1 xa + xb
x2

xa

x2

xc

x2 + 1 xa + xc
xl

xd

xl

xc

xl + 1 xd + xc
5. Answer: the statement can be formulated as
2x1 + x2 + 3x3 5 + M1 (1 z1 )
2x1 + x2 + 3x3

5 + M1 z 1

2x6 x7 + x8 3 M2 (1 z2 )
2x6 x7 + x8

3 + M 2 z2

x9 + x10 1 M3 (1 z3 )
x9 + x10

1 + M 3 z3

z1 + z2

1 + zR

z1

zR

z2

zR

zR

z3

where 0 < is a small number and M1 , M2 , M3 are large enough numbers.

Formulations
1. Formulate S = {x + y R : |x| + |y| 1} as a linear programming problem.

Answer: with the objective arbitrarily specified, the LP is formulated as


min

x,yR

x+y 1

s.t.

xy 1
x y 1
x + y 1
2. Answer: with the objective arbitrarily specified, let the MILP is formulated as
min

x,yR,zB4

x + y 1 M 1(1 z1 )

s.t.

x + y 1 + M 1(1 z1 )
x y 1 M 2(1 z2 )
x y 1 + M 2(1 z2 )
x + y 1 M 3(1 z3 )
x + y 1 + M 3(1 z3 )
x y 1 M 4(1 z4 )
x y 1 + M 4(1 z4 )
z1 + z2 + z 3 + z4 1
3. The key part of the reformulation is x 6= x
, which can first be formulated as

n
X
i=1

|xi x
i | 1.

However since this is a binary problem we can separate the indices. Let set A be the set of
indices where x
i = 0, and set B includes indices where x
i = 1. Then we can formulate the
problem as follow:
cT x

max

s,tRn ,zBn

Ax b

s.t.
P
P

iA xi

iB

1 + M (1 z1 )

xi |B| 1 + M (1 z2 )
z1 + z 2 1
x Bn , z1 , z2 B

where M is a sufficiently large number.

4. (a) We can associate binary variable xi {0, 1} to each node of the graph which represents
if a node i is selected for the subset or not. So the objective function would be simply
to maximize the number of selected nodes.
X
xi
Max
iV

Now the constraint would be to have edges between every selected node. One simple
way to do this is to remove cases that allow selecting nodes without edges between them.
So if E is set set of nodes we can have the following constraint:
xi + xj 1,

(i, j) 6 E

(b) Assuming that x is the optimal solution of the maximum clique problem, we can add
the following constraint to the above problem so that we find the next largest clique.
X
xi 1
iV|xi =0

param n;
# number of nodes
set V := 1..n;
# set of nodes
set E within {i in V, j in V: i < j};
# set of edges
var x {V} binary;
maximize size: sum {i in V} x[i];
cut {i in V, j in V: i < j and (i,j) not in E}: x[i] + x[j] <= 1;
data;
param n := 14;
set E := (1,2) (1,8) (1,10) (2,3) (2,5) (2,8) (3,5) (3,6)
(4,6) (4,7) (5,6) (5,13) (6,9) (7,9) (7,11) (7,12)
(8,9) (8,10) (8,13) (9,11) (9,12) (10,14) (11,12)
(12,13) (13,14);

The solution would be:

CPLEX 12.5.0.0: optimal integer solution; objective 4


6 MIP simplex iterations
0 branch-and-bound nodes
x [*] :=
1 0
2 0
3 0
4 0
5 0
6 0
7 1
8 0
9 1
10 0
11 1
12 1
13 0
14 0;
(c) Next largest clique
param n=14;
# number of nodes
set V := 1..n;
# set of nodes
set E within {i in V, j in V: i < j};
set S within {i in V};
var x {V} binary;
maximize size: sum {i in V} x[i];
cut {i in V, j in V: i < j and (i,j) not in E}: x[i] + x[j] <= 1;
nextcut: sum {i in V: i not in S} x[i]>=1;
data;
set E := (1,2) (1,8) (1,10) (2,3) (2,5) (2,8) (3,5) (3,6)
(4,6) (4,7) (5,6) (5,13) (6,9) (7,9) (7,11) (7,12)
(8,9) (8,10) (8,13) (9,11) (9,12) (10,14) (11,12)
(12,13) (13,14);
set S:=7,9,11,12;
The solution would be:

CPLEX 12.5.0.0: optimal integer solution; objective 3


7 MIP simplex iterations
0 branch-and-bound nodes
x [*] :=
1 1
2 1
3 0
4 0
5 0
6 0
7 0
8 1
9 0
10 0
11 0
12 0
13 0
14 0;

10

You might also like