Interactive Optimizer Commands


This chapter documents the commands and options of the CPLEX Interactive Optimizer. For examples of their use, see the ILOG CPLEX User's Manual. An appendix of that manual contains a list of Interactive Optimizer commands with cross-references to text where the command or option is used.

To enter an ILOG CPLEX command into the Interactive Optimizer, type its full name or any initial segment sufficient to identify the command uniquely. Most commands and options can be entered with a single letter. When there is a prompt for an entry, a return on a blank line returns the user to the ILOG CPLEX prompt without causing any action. All ILOG CPLEX commands can be entered from a single line or incrementally with prompts.

Whenever input defining a range of items is required, ILOG CPLEX expects two indices separated by the default range character, a hyphen (-). The indices can be names or matrix index numbers. CPLEX automatically sets the default upper and lower limits defining any range to be the lowest and highest possible values. Therefore, either the upper or the lower name or index number on either side of the range character can be left out. A hyphen alone means all items in the range.

Command 
Options 
Concert Technology Library/Callable Library Equivalent 
add 
filename 
The add command is used to add new constraints and bounds to the current problem. When the add command is executed alone, it results in a mode in which multiple constraints can be entered on consecutive lines. Bounds can be entered after the constraints and following the keyword bounds
Integer declarations may be added after the keyword binary (for binary variables) or the keyword general (for general integer variables). 
Example: Add a new constraint to a problem. 

  CPLEX> add [return]
  Enter new constraints and bounds ['end' terminates]:
  x1 + 2x2 + 3x3 >= 50 [return]
  end [return]
  Problem addition successful.
  CPLEX>

baropt 
option 
The baropt command directs ILOG CPLEX to solve the problem currently in memory using the ILOG CPLEX barrier optimizer. The barrier optimizer uses a primal-dual logarithmic barrier algorithm to solve the LP problem. 
The option specifies what happens when the barrier optimizer terminates (either when optimal or when termination criteria are met). Available options are: stop, primopt, dualopt, or no option at all. Specifying no option means the crossover type is determined by the current setting of the barrier crossover parameter. The option primopt instructs ILOG CPLEX to use a primal crossover algorithm to convert the pure barrier solution to a basic solution. Similarly, dualopt instructs ILOG CPLEX to follow a barrier optimization with a dual crossover. Specifying stop instructs ILOG CPLEX barrier optimizer not to initiate a crossover automatically. 
change 
option identifier1 identifier2 new-_value 
CPXchg_____()
IloCplex::set_____() 
The change command modifies the problem currently in memory. The options are: bounds, coefficient, delete, name, objective, rhs, sense. One or two identifiers indicate the item to change. Identifiers can be specified by name or by number. The right-hand side name, the string rhs, or the number 0 (zero) specifies the right-hand side of a constraint. The number 0 (zero), the string obj, or the name of the objective function identifies the objective function. The argument new_value refers to the new value for the item. 
The change command can also query for current values. Enter change option without a new value. ILOG CPLEX then displays the current option value and prompts for a new value. Enter a return without pressing another key to return to the CPLEX> prompt. No changes are made. 
Example: Change the upper bound on the variable x2 to the new value 50

  CPLEX> change [return]
  
  Change Options:
  
  bounds        change bounds on a variable
  coefficient   change a coefficient
  delete        delete some part of the problem
  name          change a constraint or variable name
  objective     change objective function value
  rhs           change a right-hand side or network supply/demand value
  sense         change objective function or a constraint sense
  
  Change to make: bounds [return]
  Change bounds on which variable: x2 [return]
  Change lower or upper bound, or both ['l', 'u', or 'b']: u [return]
  Present bounds on variable x2: The indicated variable is >= 0.
  Change upper bound to what ['+inf' for no upper bound]: 50 [return]
  New bounds on variable 'x2': 0 <= x2 <= 50

change 
problem 
The change command changes the type of the problem currently in memory. Problems can be changed to type lp, milp, relaxed_mip, fixed_milp, qp, zeroed_qp, miqp, fixed_miqp, or network. In general, changing a problem to a more restricted type will discard information. For example, changing a MIP to an LP will discard variable type information. Two exceptions are the change from QP to ZEROED_QP and the change from MIP to RELAXED_MIP, where the problem can be changed back to its original type without loss of information. Changing a problem to a less restricted type will associate new data with the model. For example, changing an LP to a MIP will introduce variable type information, where all variables will initially have continuous type. 
change 
type 
This command can be used to change the variable type (continuous, binary, general, semi-continuous, semi-integer). 
change 
qpterm 
This command can be used to change quadratic objective terms. 
display 
option identifier 
CPXget_____() 
IloCplex::get_____() 
The display command displays (on screen) problem characteristics, the problem solution, and related information. Some of that information is also written to a log file. The identifier is the name or number of a single item or range of items. A range is specified by a lower and an upper limit separated by a hyphen (-). If no limit is specified, then the first or last item is assumed as the limit. A lone hyphen displays all the items pertaining to the specified option. Information generated by the display command is sent to the results channel. By default, the results channel routes this information both to the screen and to a log file. 
The command display has these options:  
iis display infeasibility diagnostics (IIS constraints)
problem display problem characteristics
sensitivity display sensitivity analysis
settings display parameter settings
solution display existing solution
For examples, see the ILOG CPLEX Getting Started manual and the ILOG CPLEX User's Manual
display 
problem suboption identifier 

 
The command display problem has these suboptions
all display entire problem
binaries display binary variables
bounds display a set of bounds
constraints display a set of constraints or the objective function
generals display general integer variables
histogram display a histogram of row or column counts
integers display integer variables (binary and general)
names display names of variable, constraints, or rim vectors
qpvariables display variables with quadratic coefficients
semi-continuous display semi-continuous and semi-integer variables
sos display variables contained in special ordered sets
stats display problem statistics
variable display a column of the constraint matrix
The command display problem histogram may be useful when looking for particularly dense or sparse columns or rows. Network structures are often identified by the presence of columns with exactly two entries. 
display 
sensitivity suboption 

 
The command display sensitivity has these suboptions
lb display a set of solution lower bound sensitivity ranges
objective display a set of solution objective sensitivity ranges
rhs display a set of solution right-hand side sensitivity ranges
ub display a set of solution upper bound sensitivity ranges
display 
settings suboption 

 
The command display settings has these suboptions
all display all parameter settings
changed display parameter settings that have been changed from the default
display 
solution suboption 

 
The command display solution has these suboptions
basis display a range of basic constraints or variables
bestbound display the best bound of a solution
dual display a set of solution dual values
kappa display the condition number of the basis matrix
objective display solution objective value
quality display quality of 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
After a solution has been found, the information displayed by the command display solution quality may be useful. If the solution found was not feasible, ILOG CPLEX lists each variable, slack, and artificial that exceeds its bounds along with its current value on the log-only channel. A comparison of this value to the bounds for each variable reveals the amount of infeasibility. 
enter 
problem_name 
CPXread______() 
The enter command allows a user to enter a new problem from the screen. The optional problem_name may be any valid file name allowed by the platform where ILOG CPLEX is running. The problem is entered in LP file format. 
help 
command 

 
The help command displays information about ILOG CPLEX commands. The optional command is the name of one of the commands of the Interactive Optimizer. If no argument is specified, ILOG CPLEX displays a list of all commands with a short description of each. 
mipopt 

 
This command directs ILOG CPLEX to solve a mixed integer programming problem. If the problem currently in memory is not a mixed integer programming problem, ILOG CPLEX returns the message Not a MIP
netopt 
option 
The netopt command directs ILOG CPLEX to solve the problem currently in memory with the ILOG CPLEX network optimizer. The available options are: primopt, dualopt, or no option at all. The option primopt directs ILOG CPLEX to use primal simplex to complete optimization; dualopt directs ILOG CPLEX to use dual simplex; no option is equivalent to dualopt
optimize 

 
IloCplex::solve() 
The optimize command directs CPLEX to solve the problem currently in memory with the most suitable algorithm. For networks and mixed integer programs, CPLEX chooses the network optimizer and the mixed integer optimizer respectively. For linear programs, CPLEX chooses the most appropriate method. Currently this is the dual simplex optimizer, unless a primal feasible basis is available and the advanced indicator is on, in which case the primal simplex optimizer will be used. Future versions may use different strategies. 
primopt 

 
The primopt command directs CPLEX to solve the problem currently in memory with the primal simplex optimizer. 
quit 

 
IloEnv::end() 
The quit command exits the CPLEX Interactive Optimizer. To save your work, before issuing the quit command, use the write command. 
read 
filename file_format 
The read command reads a problem from a file on the user's platform. The argument filename is the name of the file that contains the problem; it may be a full path name, if necessary. The optional argument file_format must be one of the file formats that CPLEX recognizes. See the file format appendix in this manual for information about those file formats. The file_format is not necessary if the filename includes a valid extension indicating a recognized file format. 
When the read command is issued to read LP or MPS formatted files, ILOG CPLEX first allocates space for the problem data according to the values of the read parameters (set read). If the problem exceeds those limits, the problem is still read successfully, but this practice may result in fragmented memory. We recommend that the set read parameters be set slightly higher than needed for your problem. 
File Type Options
bas INSERT format basis file
lp LP format problem file
min DIMACS min-cost network-flow format file
mps MPS format problem file
mst MIP start file
net CPLEX network-flow format file
ord Integer priority order file
qp Quadratic coefficient matrix file
sav Binary matrix and basis file
sos Special ordered sets file
tre Branch-and-bound treesave file
vec Vector solution format file
Example: Read an MPS formatted file named afiro
CPLEX> read afiro [return]
File type: mps [return]
Selected objective sense: MINIMIZE
Selected objective name: COST
Selected RHS name: B
Problem 'afiro' read.
Read time = 0.12 sec
Since the name afiro (not afiro.mps) was entered, ILOG CPLEX first tries to find afiro, then-if afiro is not found- afiro.mps. If there is a spurious file named afiro in addition to afiro.mps, ILOG CPLEX finds the spurious file first and thus read it rather than afiro.mps.  
set 
parameter option new_-value 
tranopt 

 
The tranopt command directs ILOG CPLEX to solve the problem currently in memory with the ILOG CPLEX dual simplex optimizer. 
write 
filename file_format 
The write command writes a problem or solution report to a file, where filename is any valid file name on the platform where ILOG CPLEX is running and file_format is one of the file formats recognized by ILOG CPLEX. See the file format appendix in this manual for information about those file formats. 
bas INSERT format basis file
bin Binary solution file
dpe Binary format for dual-perturbed problem
dua MPS format of explicit dual of problem
emb MPS format of (embedded) network
iis Irreducibly inconsistent set (LP format)
lp LP format problem file
min DIMACS min-cost network-flow format of (embedded) network
mps MPS format problem file
mst MIP start file CPXmstwrite()
net CPLEX network format of (embedded) network
ord Integer priority order file CPXordwrite()
ppe Binary format for primal-perturbed problem
pre Binary format for presolved problem
qp Quadratic coefficient matrix file CPXqpwrite()
rew MPS format problem with generic names
sav Binary matrix and basis file
sos Special ordered sets file CPXsoswrite()
tre Branch-and-bound treesave file CPXtreewrite()
txt Text solution file
vec Vector solution format file CPXvecwrite()
xecute 
command 

 
The xecute command executes a command on the operating system on which ILOG CPLEX is running, where command is any valid command that can be entered at the standard operating system prompt. The xecute command and its argument must be entered on the same line. The request may fail if the operating system requires more memory than currently available to execute the command


Previous Page: ILOG CPLEX Interactive Optimizer Return to Top Next Page: Parameter Table