Use CPLEX to Solve an Integer Linear Programming (ILP) Problem


The Problem:
Min:  z = x1 + x2 + x3 + x4 + x5 + x6 + x7
Subject to:
        x1 + x4 + x5 + x6 + x7 >= 17
        x1 + x2 + x5 + x6 + x7 >= 13
        x1 + x2 + x3 + x6 + x7 >= 15
        x1 + x2 + x3 + x4 + x7 >= 19
        x1 + x2 + x3 + x4 + x5 >= 14
        x2 + x3 + x4 + x5 + x6 >= 16
        x3 + x4 + x5 + x6 + x7 >= 11
        x1 >= 0, and x1 is an integer
        x2 >= 0, and x2 is an integer
        x3 >= 0, and x3 is an integer
        x4 >= 0, and x4 is an integer
        x5 >= 0, and x5 is an integer
        x6 >= 0, and x6 is an integer
        x7 >= 0, and x7 is an integer

     

Create the file "The_Post_Office_Problem.lp":
\Problem name: example

Minimize
obj: x1 + x2 + x3 + x4 + x5 + x6 + x7
Subject To
c1: x1 + x4 + x5 + x6 + x7 >= 17
c2: x1 + x2 + x5 + x6 + x7 >= 13
c3: x1 + x2 + x3 + x6 + x7 >= 15
c4: x1 + x2 + x3 + x4 + x7 >= 19
c5: x1 + x2 + x3 + x4 + x5 >= 14
c6: x2 + x3 + x4 + x5 + x6 >= 16
c7: x3 + x4 + x5 + x6 + x7 >= 11
Bounds
x1 >= 0
x2 >= 0
x3 >= 0
x4 >= 0
x5 >= 0
x6 >= 0
x7 >= 0
Generals
x1 x2 x3 x4 x5 x6 x7
End

 

Solving the Problem Using CPLEX Interactive Optimizer:
CPLEX> read The_Post_Office_Problem.lp
Problem 'The_Post_Office_Problem.lp' read.
Read time = 0.00 sec.
   
CPLEX> opt
Tried aggregator 1 time.
Reduced MIP has 7 rows, 7 columns, and 35 nonzeros.
Presolve time = 0.00 sec.
MIP emphasis: balance optimality and feasibility.
Root relaxation solution time = 0.00 sec.

Nodes Cuts/
Node Left Objective IInf Best Integer Best Node ItCnt Gap

0 0 22.3333 4 22.3333 5
* 0+ 0 0 23.0000 22.3333 5 2.90%

MIP - Integer optimal solution: Objective = 2.3000000000e+01
Solution time = 0.00 sec. Iterations = 5 Nodes = 0

CPLEX> d sol v -
Variable Name Solution Value
x1 6.000000
x2 4.000000
x3 1.000000
x4 8.000000
x6 4.000000
All other variables in the range 1-7 are 0.


CPLEX>

 


last update: July 03, 2009