Previous Page: CPXwritesolFirst PageNext Page: Parameter Table

Interactive Base System Commands


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

To enter a CPLEX command into the Interactive Base System, 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 will return the user to the CPLEX prompt without causing any action. All CPLEX commands can be entered from a single line or incrementally with prompts.

Whenever input defining a range of items is required, 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.

Interactive Command  

Options  

 

Callable Library Equivalent  

 
 
 
 
 
add  
filename  
 
 
CPXaddrows(), CPXaddcols()  
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.  
If you are licensed for the mixed integer optimizer, 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  
 
 
CPXhybbaropt()  
This command is available only to users licensed for the barrier optimizer. The baropt command directs CPLEX to solve the problem currently in memory using the 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 is equivalent to specifying primopt. The option primopt instructs CPLEX to use a primal crossover algorithm to convert the pure barrier solution to a basic solution. Similarly, dualopt instructs CPLEX to follow a barrier optimization with a dual crossover. Specifying stop instructs CPLEX barrier optimizer not to initiate a crossover automatically.  
change  
option identifier1 identifier2 new-_value  
CPXchg_____()  
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. CPLEX will then display the current option value and prompt for a new value. Enter a return without pressing another key to return to the CPLEX> prompt. No changes will be 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  
type  
 
CPXchgprobtype()  
Users licensed for the mixed integer optimizer and the barrier optimizer can change the type of the problem currently in memory. Mixed integer programming problems can be changed to lp, mip, relaxed_mip, or fixed_mip. Caution: The change from MIP to LP type disassociates the variable type information from the problem.  
Barrier and quadratic programming problems can be changed to zeroed_qp or qp. Caution: The change from a QP problem to an LP or MIP problem disassociates the quadratic information in the Q matrix from the problem. Changing barrier/QP problems to zeroed_qp will allow the problem to be solved as a linear programming problem and then changed back to a QP without loss of the quadratic information.  
change  
variable  
type  
 
CPXchgctype()  
Users licensed for the mixed integer optimizer can use this command to change the variable type (continuous, binary, general).  
change  
qpterm  
 
 
CPXchgqpcoef()  
Users licensed for the barrier/QP optimizer can use this command to change quadratic objective terms.  
display  
option  
identifier  
 
CPXget______()  
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 following terms are valid as option:  
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 Getting Started and CPLEX User's Manual.  
display  
problem  
suboption identifier  
 
The command display problem has these suboptions:  
all display entire problem  
bounds display a set of bounds  
constraints display a set of constraints or the objective function  
histogram display a histogram of row or column counts  
names display names of variable, constraints, or rim vectors  
stats display problem statistics  
variable display a column of the constraint matrix  
The command display problem histogram may be useful when the user is looking for particularly dense or sparse columns or rows. Network structures are often identified by the presence of columns with exactly two entries.  
display  
problem  
suboption identifier  
 
Users licensed for the mixed integer optimizer have these additional suboptions:  
binaries display binary variables  
generals display general integer variables  
integers display integer variables (binary and general)  
display  
problem  
qpvariables identifier  
 
Users licensed for the mixed integer optimizer have this additional suboption to list variables with quadratic coefficients.  
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  
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  
Even 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, CPLEX lists each variable, slack, 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.  
display  
solution  
bestbound  
 
 
Users licensed for the mixed integer optimizer have this additional suboption to display the best bound of a solution.  
enter  
problem_name  
 
 
CPXread______()  
This 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 CPLEX is running. The problem is entered in LP file format.  
help  
command  
 
 
 
The help command displays information about CPLEX commands. The optional command is the name of one of the commands of the Interactive Base System. If no argument is specified, CPLEX displays a list of all commands with a short description of each.  
mipopt  
 
 
 
CPXmipopt()  
The mipopt command is available only to users licensed for the CPLEX mixed integer optimizer. This command directs CPLEX to solve a mixed integer programming problem. If the problem currently in memory is not a mixed integer programming problem, CPLEX will return the message Not a MIP.  
netopt  
 
option  
 
CPXhybnetopt()  
The netopt command directs CPLEX to solve the problem currently in memory with the CPLEX network optimizer. The available options are: primopt, dualopt, or no option at all. The option primopt directs CPLEX to use primal simplex to complete optimization; dualopt directs CPLEX to use dual simplex; no option is equivalent to dualopt.  
primopt  
 
 
 
CPXprimopt()  
The primopt command directs CPLEX to solve the problem currently in memory with the primal simplex optimizer.  
quit  
 
 
 
CPXcloseCPLEX()  
The quit command exits the CPLEX Interactive Base System. To save your work, before issuing the quit command, use the write command.  
read  
filename  
file_format  
 
CPXreadcopyprob()  
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, CPLEX first allocates space for the problem data according to the values of the read parameters (set read). If the problem exceeds those limits, CPLEX will issue a warning. The problem will still be 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.  
Example: Read an MPS formatted file named afiro.  
CPLEX> read afiro [return]  
 
File Type Options:  
 
lp LP format problem file  
mps MPS format problem file  
bas INSERT format basis file  
min DIMACS min-cost network-flow format file  
sav Binary matrix and basis file  
net CPLEX network-flow format file  
 
 
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, 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, CPLEX will find the spurious file first and thus read it rather than afiro.mps.  
read  
filename  
file_format  
 
 
Users licensed for the CPLEX mixed integer optimizer have additional read options:  
ord for integer priority order files  
sos for special ordered sets files  
tre for branch & bound tree-save files  
read  
filename  
file_format  
 
 
Users licensed for the CPLEX barrier optimizer have additional read options:  
vec for vector solution format files  
qp for quadratic coefficient matrix files  
set  
parameter  
option  
new_-value  
CPXsetintparam(), CPXsetdblparam(), CPXsetstrparam()  
The set command allows a user to change the value of certain CPLEX parameters, where parameter is one that can be set by a licensed user; new_value is the value set by the user. The command set defaults resets all parameters to their default value. See the CPLEX User's Manual for examples of this command, its paramters and their options. See the parameters appendix of this manual for acceptable new values and default values.  
tranopt  
 
 
 
CPXdualopt()  
The tranopt command directs CPLEX to solve the problem currently in memory with the CPLEX dual simplex optimizer.  
write  
filename  
file_format  
 
CPXwriteprob(), CPX__write()  
The write command writes a problem or solution report to a file, where filename is any valid file name on the platform where CPLEX is running and file_format is one of the file formats recognized by CPLEX. See the file format appendix in this manual for information about those file formats.  
write  
filename  
file_format  
 
CPXordwrite(), CPXsoswrite(), CPXtreewrite()  
Users licensed for the CPLEX mixed integer optimizer have additional write options:  
ord for integer priority order files  
sos for special ordered sets files  
tre for branch & bound tree-save files  
write  
filename  
file_format  
 
CPXvecwrite(), CPXqpwrite()  
Users licensed for the CPLEX barrier optimizer have additional write options:  
vec for vector solution format files  
qp for quadratic coefficient matrix files  
xecute  
command  
 
 
 
The xecute command executes a command on the operating system on which 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: CPXwritesolFirst PageNext Page: Parameter Table