Vous êtes sur la page 1sur 3

CPLEX Interactive Optimizer

Documentation on Cplex at C:\Program Files\IBM\ILOG\CPLEX_Studio124\doc\html\en-US\CPLEX\Getting_started

Useful Cplex Commands

cplex: to enter Cplex environment

Welcome to IBM(R) ILOG(R) CPLEX(R) Interactive Optimizer 12.4.0.0 with Simplex, Mixed Integer & Barrier Optimizers

CPLEX> help: for list of cplex commands

CPLEX> help

add add constraints to the problem


baropt solve using barrier algorithm
change change the problem
conflict refine a conflict for an infeasible problem
display display problem, solution, or parameter settings
enter enter a new problem
feasopt find relaxation to an infeasible problem
help provide information on CPLEX commands
mipopt solve a mixed integer program
netopt solve the problem using network method
optimize solve the problem
populate get additional solutions for a mixed integer program
primopt solve using the primal method
quit leave CPLEX
read read problem or advanced start information from a file
set set parameters
tranopt solve using the dual method
tune try a variety of parameter settings
write write problem or solution information to a file
xecute execute a command from the operating system

Enter enough characters to uniquely identify commands & options. Commands can be entered partially (CPLEX will
prompt you for further information) or as a whole.
Example:
Min5 x−3 y
x+ 2 y ≥ 4
2x−y≥0
x−3 y ≥−13
x≥0
y ∈ {0, 1, … ,10 }
CPLEX> enter
Enter name for problem: Ex1
Enter new problem ['end' on a separate line terminates]:
minimize
5x-3y
subject to
c1: x+2y >= 4
c2: 2x-y >= 0
c3: x - 3y >= -13
bounds
0 <= y <= 10
integer
y
end
CPLEX> mipopt
Tried aggregator 1 time.
Reduced MIP has 3 rows, 2 columns, and 6 nonzeros.
Reduced MIP has 0 binaries, 1 generals, 0 SOSs, and 0 indicators.
Probing time = 0.00 sec.
Tried aggregator 1 time.
Presolve time = 0.00 sec.
Found feasible solution after 0.00 sec. Objective = 20.0000
Probing time = 0.00 sec.
MIP emphasis: balance optimality and feasibility.
MIP search method: dynamic search.
Parallel mode: deterministic, using up to 4 threads.
Root relaxation solution time = 0.00 sec.

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

* 0+ 0 20.0000 2 ---
0 0 -2.6000 1 20.0000 -2.6000 2 113.00%
* 0+ 0 -2.5000 -2.6000 2 4.00%
0 0 cutoff -2.5000 2 0.00%
Elapsed real time = 0.00 sec. (tree size = 0.00 MB, solutions = 2)

Root node processing (before b&c):


Real time = 0.00
Parallel b&c, 4 threads:
Real time = 0.00
Sync time (average) = 0.00
Wait time (average) = 0.00
-------
Total (root+branch&cut) = 0.00 sec.

Solution pool: 2 solutions saved.

MIP - Integer optimal solution: Objective = -2.5000000000e+000


Solution time = 0.02 sec. Iterations = 2 Nodes = 0
Deterministic time = 0.04 ticks (2.65 ticks/sec)

CPLEX>

CPLEX> display

Display Options:

auxilliary display auxilliary information used during optimization


conflict display the conflict that demonstrates problem infeasibility
problem display problem characteristics
sensitivity display sensitivity analysis
settings display parameter settings
solution display existing solution

Display what: solution

Display Solution Options:

basis display a range of basic constraints or variables


bestbound display the current MIP best bound
difference display the difference between two pool solutions
dual display a set of solution dual values
kappa display the condition number of the basis matrix
list display a list of solutions in the solution pool
member display a solution from the solution pool
objective display the solution objective value
pool display solution pool statistics
qcslacks display a set of solution quadratic constraint slack values
quality display the quality of the solution
reduced display a set of solution reduced costs
slacks display a set of solution slack values
variables display a set of solution variable values

Display which part of the solution: variables


Display values of which variable(s): y
Incumbent solution
Variable Name Solution Value
y 5.000000

CPLEX> display solution variables x


Incumbent solution
Variable Name Solution Value
x 2.500000
-----------------------------------------------------------
Read a model file (.lp format) and then solve

1. Creat a file with the following content and save it as MIP1.lp

minimize
5x-3y
subject to
c1: x+2y >= 4
c2: 2x-y >= 0
c3: x - 3y >= -13
bounds
0 <= y <= 10
integer
y
end

2. Cplex
3. CPLEX>read MIP1.lp
4. CPLEX>mipopt

Reading a large file and solving it

1. d:
2. cd “D:\Dropbox\Sachin\Teaching\FPM\Courses\OR\Applied Optimization\LSO-2014-15\cplex test\Experiment”
3. D:\Dropbox\Sachin\Teaching\FPM\Courses\OR\Applied Optimization\LSO-2014-15\cplex test\Experiment>cplex
4. CPLEX>read FRModel50301.lp (Model for Freight Allocation with Lane cost balancing constraint – 50 lane, 30 career)
5. CPLEX>mipopt

Vous aimerez peut-être aussi