mmxprs



The mmxprs module provides access to the Xpress-Optimizer from within a Mosel model and as such it requires the Xpress-Optimizer library (XPRS) to be installed on the system. To use this module, the following line must be included in the header of the Mosel model file:

 uses 'mmxprs'

A large number of optimization-related routines are provided, ranging from those for finding a solution to the problem, to those for setting callbacks and cut manager functions. Whilst a description of their usage is provided in this manual, further details relating to the usage of these may be found by consulting the Xpress-Optimizer Reference Manual.

New functionality for the Mosel language

The problem type mpproblem.xprs

This module exposes its functionality through an extension to the mpproblem problem type. As a consequence, all routines presented here are executed in the context of the current problem. In particular, the setting of a control parameter is applied only to the current problem and each problem has its own set of settings and solution information. However, when a new problem instance is created, the value of the control parameters XPRS_colorder, XPRS_enummaxsol, XPRS_enumduplpol, XPRS_loadnames and XPRS_verbose are initialised with the settings of the main problem.

The type basis

The module mmxprs defines the type basis to represent solution basis in the Mosel Language. This new type is used to store a basis computed by the optimizer during its solution process (savebasis). A basis can then be loaded again into the optimiser with loadbasis, inspected (by getting the basis status of each variable/constraint it includes with getbstatus) or modified (by changing this basis status using setbstat). The type basis supports assignment and test of equality. This comparison only checks whether two basis contain the same information, it does not indicate whether the basis are equivalent.

The type logctr

The type logctr represents either a logical expression over linear constraints or an indicator constraint (see indicator). Logical expressions can be built using standard operators (and, or, not) or with the help of the dedicated functions implies and xor. These logical constructs are handled like linear constraints: they are associated to the current problem, can be (re)defined via assignments and hidden using sethidden. Note however that logical constructs are not shown by exportprob although the mmxprs' routine writeprob will report them.

If logical expressions are employed in a model, the loading of the problem into the optimizer requires the use of the helper package "advmod":

 uses 'advmod'

This package is not necessary when a model uses only indicator constraints directly.

Control parameters

This module extends the getparam function and the setparam procedure in order to access all the control and problem parameters of Optimizer (for example the problem attribute LPSTATUS is mapped to the mmxprs control parameter XPRS_lpstatus). In addition to these, the following control parameters are also defined:

XPRS_colorder
Reorder matrix columns before loading the problem.
XPRS_enumduplpol
Handling of duplicate solutions during an enumeration. Refer to the MSP control parameter MSP_DUPLICATESOLUTIONSPOLICY for further information.
XPRS_enummaxsol
Maximum number of solutions to be saved during an enumeration.
XPRS_enumsols
Number of solutions found during the last enumeration
XPRS_fullversion
Optimizer version number
XPRS_loadnames
Enable/disable loading of MPS names into the Optimizer.
XPRS_problem
Optimizer problem pointers
XPRS_probname
Read/set the problem name used by the Optimizer.
XPRS_verbose
Enable/disable message printing by the Optimizer

Example:

setparam("XPRS_verbose", true)      ! Turn on message printing
pstat:= getparam("XPRS_lpstatus")   ! Get the problem LP optimization status

Procedures and functions

This section lists in alphabetical order the functions and procedures that are provided by the mmxprs module.

addmipsol
Add a MIP solution to the optimizer.
basisstability
Get basis stability information.
clearmipdir
Delete all defined MIP directives.
clearmodcut
Delete all defined model cuts.
command
Execute an Optimizer command.
defdelayedrows
Define the set of constraints to be treated as delayed rows.
defsecurevecs
Define the variables and constraints to be preserved.
fixglobal
Fix values of global entitites.
getbstat
Get the status of a variable or constraint in a basis.
getiis
Compute then get the Irreductible Infeasible Sets (IIS).
getiissense
Decode the sense part of an IIS bound type information.
getiistype
Decode the type part of an IIS bound type information.
getinfcause
Returns the variable or constraint causing infeasibility.
getinfeas
Returns sets of infeasible primal and dual variables.
getlb
Get the lower bound of a variable.
getname
Get the name of a decision variable or constraint.
getprobstat
Get the Optimizer problem status.
getrange
Get a range value for a variable or constraint.
getsensrng
Get sensivity ranges for objective or RHS function coefficients.
getub
Get the upper bound of a variable.
implies
Create an implies expression.
indicator
Create an indicator constraint.
isiisvalid
Check whether an IIS number exists.
isintegral
Check whether a solution value is integral.
loadbasis
Load a previously saved basis.
loadmipsol
Load a MIP solution into the optimizer.
loadprob
Load a problem into the optimizer.
maximize, minimize
Maximize/minimize the current problem.
postsolve
Postsolve the current matrix.
readbasis
Read a basis from a file.
readdirs
Read directives from a file.
rejectintsol
Reject a PREINTSOL solution.
repairinfeas
Relaxing bounds to repair infeasibility.
resetbasis
Reset a basis.
resetiis
Reset the search for IIS.
savebasis
Save the current basis.
savemipsol
Save the current solution into the provided array.
savestate
Save current state of the Optimizer to a file.
selectsol
Select one of the solutions found by solution enumerator.
setbstat
Set the status of a variable or constraint in a basis.
setcallback
Set optimizer callback functions and procedures.
setcbcutoff
Set cutoff for PREINTSOL callback.
setgndata
Update data for GAPNOTIFY callback.
setlb
Set the lower bound of a variable.
setmipdir
Set a directive on a variable or Special Ordered Set.
setmodcut
Mark a constraint as a model cut.
setub
Set the upper bound of a variable.
setucbdata
Update data for CHGBRANCH callback.
stopoptimize
Interrupt the optimizer algorithms.
unloadprob
Unload the problem held in the optimizer.
writebasis
Write the current basis to a file.
writedirs
Write current directives to a file.
writeprob
Write the current problem to a file.
xor
Create an exclusive or expression.

Cut Pool Manager

This section contains the functions and procedures of the Xpress-Optimizer cut manager. For a detailed description of the cut manager and its functionality the user is referred to the Xpress-Optimizer Reference Manual. To run the cut manager from Mosel, it may be necessary to (re)set certain control parameters of the optimizer. For example, switching off presolve and automatic cut generation, and reserving space for extra rows in the matrix may be useful:

setparam("XPRS_presolve", 0);       /* Switch presolve off... */
setparam("XPRS_presolveops", 2270); /* ...or use secure setting for presolve */
setparam("XPRS_cutstrategy", 0);    /* Switch automatic cut generation off */
setparam("XPRS_extrarows", 5000);   /* Reserve space for 5000 extra rows in 
                                       the matrix*/

The callback functions and procedures that are relevant to the cut manager are initialized with function setcallback, in common with the other Optimizer callbacks.

It should be noted that cuts are not stored by Mosel but sent immediately to the Optimizer. Consequently, if a problem is reloaded into the Optimizer, any previously defined cuts will be lost. In Mosel, cuts are defined by specifying a linear expression (i.e. an unbounded constraint) and the operator sign (inequality/equality). If instead of a linear expression a constraint is given, it will also be added to the system as an additional constraint.

addcut
Add a cut to the problem in the optimizer.
addcuts
Add an array of cuts to the problem in the optimizer.
delcuts
Delete cuts from the problem in the optimizer.
dropcuts
Drop a set of cuts from the cut pool.
getcnlist
Get the set of cuts active at the current node.
getcplist
Get a set of cut indices from the cut pool.
loadcuts
Load a set of cuts into the problem in the optimizer.
storecut
Store a cut into the cut pool.
storecuts
Store an array of cuts into the cut pool.


If you have any comments or suggestions about these pages, please send mail to support@fico.com.

© Copyright 2001-2013 Fair Isaac Corporation. All rights reserved.