Introduction To CPLEX 1.0 Overview
Introduction To CPLEX 1.0 Overview
1.0 Overview
1
You can also buy commercial add-ons that
significantly improve the power of Excel as an LP
solver. For example, see http://www.solver.com/.
2
may also benefit from familiarity with CPLEX. For
the rest of you, CPLEX is an excellent LP/IP-solver
platform, and I can easily make it available to you.
3
2.0 Accessing CPLEX
CPLEX version 10.1.0 resides on an ISU server
called pluto. To access it, you will need to logon to
pluto. To do that, you will need a telnet and ftp
facility. I suggest using the facilities WinSCP2 and
PuTTY. WinSCP2 is an ftp facility. PuTTY is a free
implementation of Telnet and SSH for Win32 and
Unix platforms, along with an xterm terminal
emulator. Links to download both of these programs
is found at http://clue.eng.iastate.edu/downloads.shtml.
4
To transfer a file from your local machine to the
remote machine, use the left screen to navigate to the
directory on your local machine where the file
resides. Then click once on the file you want to
transfer. (If you want to transfer multiple files, you
can click once on each file while holding down the
“control” key.)
To download PuTTY,
1. The PuTTY download page is at
www.chiark.greenend.org.uk/~sgtatham/putty/download.html.
At this page, you will find some alternatives; I used
(successfully) the installer, putty-0.61-installer.exe.
5
Fig. 1 Run PuTTY
3. Use your ISU username and password to log in.
You will find yourself on a unix terminal emulator.
4. You might like to create a working directory. To
do this, use mkdir DirectoryName, where
DirectoryName is the name of the directory you
want to use. To enter that directory, use
cd DirectoryName. You can see what files reside in
that directory using the command ls .
5. To run CPLEX, type cplex122 .
6
max F 5x1 4 x2 3x3
Subject to
2 x1 3x2 x3 5
4 x1 x2 2 x3 11
3x1 4 x2 2 x3 8
x1 0, x2 0, x3 0
7
maximize
5 x1 + 4 x2 + 3 x3
subject to
2 x1 + 3 x2 + x3 <= 5
4 x1 + x2 + 2x3 <= 11
3 x1 + 4 x2 + 2 x3 <= 8
x1 >= 0
x2 >= 0
x3 >= 0
end
8
IBM ILOG License Manager: "IBM ILOG Optimization Suite
for Academic Initiative" is accessing CPLEX 12 with
option(s): "e m b q ".
Iteration log . . .
Iteration: 1 Objective = 12.500000
9
Primal simplex - Optimal: Objective = 1.3000000000e+01
Solution time = 0.00 sec. Iterations = 2 (0)
10
2. Once we had read in the problem, we solved it by
issuing the command “primopt” which calls the
primal simplex algorithm. This is the algorithm we
have been studying (there are other algorithms that
you can call with CPLEX as well).
3. The objective function improved to 12.5 after the
first iteration (from 0).
4. The problem solved in the second iteration.
5. The command display solution variables - was used to
display the values of the decision variables at the
solution.
6. The values of the decision variables at the solution
were x1=2, x2=0, x3=1, and at this solution, the
value of the objective function was F=13.
7. Note that CPLEX does not print the values of
decision variables that are zero.
8. The command display solution slacks – was used to
display the values of the slacks at the solution.
9. CPLEX will name the slack variables
c1, c2, …, cm, cm+1,…, cm+n
where there are m constraints and n decision
variables. Therefore the first m slack variables (c1,
c2, …, cm) correspond to the explicit inequality
constraints, and the last n slack variables (cm+1,…,
cm+n) correspond to the nonnegativity constraints
on the decision variables.
10. The values of the slack variables at the solution
were c1=0, c2=1, c3=0, c4=-2, c5=0, c6=-1.
11
11. Note that CPLEX does not print the values of
slack variables that are zero.
12. The fact that c1=0 and c3=0 indicates that the
first and third constraints are binding. That c2=1
indicates the left-hand side of the second constraint
is less than the right-hand-side by 1. Checking
these constraints, we find
Constraint 1:
2 x1 3x2 x3 5
2(2) 3(0) 1 5 √
Constraint 2:
4 x1 x2 2 x3 11
4(2) 0 2(1) 10 √
Constraint 3:
3x1 4 x2 2 x3 8
3(2) 4(0) 2(1) 8 √
13. The fact that c5=0 indicates that the second
inequality constraint is binding, i.e.,
x2 0
which is consistent with the fact that x2=0.
14. The facts that c4=-2, c6=-1 is interesting because
these slacks are negative. This is a result of the fact
that the corresponding constraints are actually
12
“greater than or less to” constraints instead of “less
than or equal to constraints.” The way they are
treated in CPLEX is as follows:
x1 0 x1 c4 0
so that when x1=2, as it is in the solution, c4=-2.
Likewise,
x3 0 x3 c6 0
so that when x3=1, as it is in the solution, c6=-1.
13