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 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.

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_loadnames
Enable/disable loading of MPS names into the Optimizer.
XPRS_problem
Optimizer problem pointer
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.

clearmipdir
Delete all defined MIP directives.
clearmodcut
Delete all defined model cuts.
command
Execute an Optimizer command.
defsecurevecs
Define the sets of variables and constraints that must not be removed by the presolve.
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).
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.
initglobal
Reset the global search.
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.
readbasis
Read a basis from a file.
readdirs
Read directives from a file.
resetbasis
Reset a basis.
savebasis
Save the current basis.
savemipsol
Save the current solution into the provided array.
savestate
Save current state of the Optimizer to a file.
setbstat
Set the status of a variable or constraint in a basis.
setcallback
Set optimizer callback functions and procedures.
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.

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 docs@dashoptimization.com.