mmxprs
Topics covered in this chapter:
- New functionality for the Mosel language
- Control parameters
- Procedures and functions
- Cut Pool Manager
The mmxprs module provides access to FICO® 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 getbstat) 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 mpsol
The type mpsol characterises a solution of an MP problem by associating a value to each decision variable (type mpvar) of the problem. Initialising such an object can be achieved by saving the current solution found by the optimiser (savesol or savemipsol) or by building it one variable at a time (setsol). Various routines requiring solution information support the solution object. For instance getsol may be used to evaluate an expression on a specific solution; loadmipsol and addmipsol accept this object as input. A solution might be saved into a file using writesol and the resulting file can be loaded into the optimiser with readsol. The type mpsol supports assignment and test of equality.
The type boolvar
An entity of type boolvar is a pseudo boolean decision variable. This type supports operators and, or and not for building logical expressions and can be combined with ordinary Boolean variables. A logical constraint is specified either by associating a pseudo boolean variable to a logical expression using the following syntax:
boolvar = logical_expression
or by forcing the truth value (i.e. true or false) of an expression as follows:
logical_expression = boolean
When a logical expression is used on its own as a statement it is implicitly turned into a constraint (forced to true) and added to the constraint store.
Each boolvar is represented in the MIP problem by two binary variables (mpvar): one for the value itself and another one for its negation. These decision variables can be accessed from the model using the function getvar such that they can be used in linear constraints. The solution value of a boolvar is of type boolean and can be obtained using getsol.
The type logctr
The type logctr represents either a logical expression over linear constraints, a logical expession/constraint over pseudo boolean decision variables (boolvar) 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 (for logical expressions over linear constraints only). 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 over linear constraints 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 logical constraints over pseudo boolean variables or 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:
Reorder matrix columns before loading the problem.
|
|
Handling of duplicate solutions during an enumeration.
|
|
Maximum number of solutions to be saved during an enumeration.
|
|
Number of solutions found during the last enumeration.
|
|
Optimizer version number.
|
|
Enable/disable loading of MPS names into the Optimizer.
|
|
Size of the pool of matrix updates.
|
|
Optimizer problem pointers.
|
|
Read/set the problem name used by the Optimizer.
|
|
Enable/disable message printing by the Optimizer.
|
setparam("XPRS_verbose", true) ! Turn on message printing pstat:= getparam("XPRS_lpstatus") ! Get the problem LP optimization status writeln("Best bound=", getparam("XPRS_bestbound")) ! Display the best bound value
Procedures and functions
This section lists in alphabetical order the functions and procedures that are provided by the mmxprs module.
Add a MIP solution to the optimizer.
|
|
Get basis stability information.
|
|
Calculates a property of an mpsol solution.
|
|
Delete all defined MIP directives.
|
|
Delete all defined model cuts.
|
|
Execute an Optimizer command.
|
|
Copy solution values to initial values of an NL problem.
|
|
Crosses over a previously loaded LP solution to a basic solution.
|
|
Define the set of constraints to be treated as delayed rows.
|
|
Define the variables and constraints to be preserved.
|
|
Estimate better marginal values for variables and constraints for degenerate problems.
|
|
Fix values of discrete entitites.
|
|
Get the status of a variable or constraint in a basis.
|
|
Get whether Insight Compute Interface integration is allowed
|
|
Get a dual ray for an infeasible problem.
|
|
Compute then get the Irreductible Infeasible Sets (IIS).
|
|
Decode the sense part of an IIS bound type information.
|
|
Decode the type part of an IIS bound type information.
|
|
Returns the variable or constraint causing infeasibility.
|
|
Returns sets of infeasible primal and dual variables.
|
|
Get the lower bound of a variable.
|
|
Get the linear constraints loaded into the optimiser.
|
|
Get the decision variables loaded into the optimiser.
|
|
Get the coefficient of a variable or the constant term of a constraint directly from the Optimizer.
|
|
Get the name of a decision variable or constraint.
|
|
Get a primal ray for an unbounded problem.
|
|
Get the Optimizer problem status.
|
|
Get a range value for a variable or constraint.
|
|
Retrieves scaling information about the currently loaded problem.
|
|
Get sensitivity ranges for objective function coefficients, RHS coefficients, variable upper bounds or variable lower bounds.
|
|
Get the size of a solution.
|
|
Get the solution value of an expression from a solution object.
|
|
Get the upper bound of a variable.
|
|
Get the decision variable associated to a pseudo boolean.
|
|
Get the set of variables of a solution.
|
|
Check if a specific feature is supported by the currently used license.
|
|
Create an implies expression.
|
|
Create an indicator constraint.
|
|
Check whether an IIS number exists.
|
|
Check whether a solution value is integral.
|
|
Load a previously saved basis.
|
|
Load an LP solution into the optimizer.
|
|
Load a MIP solution into the optimizer.
|
|
Load a problem into the optimizer.
|
|
Maximize/minimize the current problem.
|
|
Postsolve the current matrix.
|
|
Read a basis from a file.
|
|
Read directives from a file.
|
|
Read a solution from a file.
|
|
Executes the MIP solution refiner on an mpsol solution.
|
|
Reject a PREINTSOL solution.
|
|
Relaxing bounds to repair infeasibility.
|
|
Reset a basis.
|
|
Reset the search for IIS.
|
|
Reset a solution.
|
|
Save the current basis.
|
|
Save the current solution into the provided array or solution object.
|
|
Save the current solution into a solution object.
|
|
Save current state of the Optimizer to a file.
|
|
Select one of the solutions found by solution enumerator.
|
|
Sets the optimizer architecture control.
|
|
Set the status of a variable or constraint in a basis.
|
|
Set optimizer callback functions and procedures.
|
|
Set cutoff for PREINTSOL callback.
|
|
Set whether Insight Compute Interface integration is allowed
|
|
Update data for GAPNOTIFY callback.
|
|
Set the lower bound of a variable.
|
|
Set the coefficient of a variable or the constant term directly in the Optimizer.
|
|
Set a directive on a variable or Special Ordered Set.
|
|
Mark a constraint as a model cut.
|
|
Define the value associated to a decision variabe in a solution object.
|
|
Set the upper bound of a variable.
|
|
Update data for CHGBRANCH callback.
|
|
Interrupt the optimizer algorithms.
|
|
Unload the problem held in the optimizer.
|
|
Sets up the last barrier solve's solution as the current one if one is available
|
|
Write the current basis to a file.
|
|
Write current directives to a file.
|
|
Write the current problem to a file.
|
|
Write a solution to a file.
|
|
Create an exclusive or expression.
|
|
Retrieve memory usage statistics.
|
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.
Add a cut to the problem in the optimizer.
|
|
Add an array of cuts to the problem in the optimizer.
|
|
Delete cuts from the problem in the optimizer.
|
|
Drop a set of cuts from the cut pool.
|
|
Get the set of cuts active at the current node.
|
|
Get a set of cut indices from the cut pool.
|
|
Load a set of cuts into the problem in the optimizer.
|
|
Store a cut into the cut pool.
|
|
Store an array of cuts into the cut pool.
|
© 2001-2022 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.