Optimizer parameter settings and tuning
Among the most frequently used controls are the stopping criteria for the optimization algorithms. Stopping criteria controls include
Parameter name | Description |
---|---|
MAXTIME![]() |
The maximum time in seconds that the Optimizer will run before it terminates (0: no time limit; n>0: if an integer solution has been found, stop MIP search after n seconds, otherwise continue until an integer solution is finally found; n<0: hard stop after n seconds) |
MAXNODES![]() |
The maximum number of nodes that will be explored by branch and bound. |
MIPRELSTOP![]() |
Stop the MIP search when the gap (difference between the best solution's objective function and the current best solution bound) becomes less than the specified percentage. |
MIPABSSTOP![]() |
Stop the MIP search when the gap (difference between the best solution's objective function and the current best solution bound) becomes less than the specified absolution value. |
For the complete list of parameters please refer to the chapter 'Control parameters' of the ``Xpress Optimizer Reference Manual''.
»Scenario 1 (Mosel)
Open the model file examples\getting_started\Mosel\foliomip3.mos. This file contains a version of the portfolio optimization problem from the Mosel part of the 'Getting Started' manual with some additional constraints and a larger data set. Try out the effect of setting different values in the setparam commands (just before the call to the optimization).
»Scenario 2 (BCL)
Depending on your choice of a host language open one the BCL files foliomip3.[c|cxx|java] located in the corresponding subdirectory examples\bcl\[C|Cxx|Java]\UGExpl of the Xpress distribution. This new version of the portfolio optimization problem from the BCL part of the 'Getting Started' manual has some additional constraints and uses a larger data set. Try out the effect of setting different values for the control parameters (just before the call to the optimization).
Further information
- Mosel: ``Xpress Mosel User Guide'', Part II `Advanced language features'
- BCL: see examples documented in the ``BCL Reference Manual'', Appendix B `Using BCL with the Optimizer library'
Tuning the Optimizer
Xpress Optimizer solves optimization problems by applying a number of algorithms and techniques, such as cutting planes, heuristics, branch and bound search, etc. These internal algorithms are user customizable through control parameters.
Solver tuning helps the user to identify a favorable set of control parameters that allow the Xpress Optimizer to solve a particular problem (or a set of problems) faster than by using defaults.
Xpress Optimizer has a built-in tuner that can be used through different APIs on all supported platforms.
The Xpress Optimizer built-in tuner
The Xpress Optimizer built-in tuner works with LP and MIP problems, and when Xpress Nonlinear is available it can also work with SLP and MISLP problems. The tuner will solve the problem with its default baseline control settings and then solve the problem mutiple times with each individual control and certain combinations of these controls. As the tuner works by solving a problem mutiple times, it is important and recommended to set time limits. Setting MAXTIME will limit the effort spent on each individual solve and setting TUNERMAXTIME will limit the overall effort of the tuner.
A tuner run produces detailed log files (by default located under the subdirectory tuneroutput of the working directory) and also displays a summary progress log.
The tuner works on an optimization problem loaded into the Optimizer or alternatively it can be launched on a set of matrices in LP or MPS format. The tuning process can be customized by providing pre-defined lists of controls, so-called factory tuner methods, and through various output and tuning target settings—the reader is referred to the section Using the Tuner of the ``Xpress Optimizer Reference Manual'' for further detail.
Applying the tuning results
Copy the control parameter settings of the best strategy into your model or program. Note that any solver parameters need to be set before starting the optimization.
»Scenario 1 (Mosel)
The tuner can be launched for a specific optimization problem directly from within a Mosel model by adding the option XPRS_TUNE to the optimization routine call:
minimize(XPRS_TUNE, MinCost) maximize(XPRS_TUNE+XPRS_LIN, TotalProfit)
Note that the Optimizer output display (parameter XPRS_VERBOSE) needs to be enabled in order to see the tuner progress log displayed.
Alternatively, within Xpress Workbench select the 'Tools' button to open the Run Options Dialog window where you can configure the run mode Tune the Model to tune the last optimization problem specified within a model (select a time limit greater than 0 to enable the tuner).
Applying the tuning results
Prefix the parameter name with XPRS_ to obtain its Mosel name:
setparam("XPRS_PRESOLVE", 0)mmsystem
command("PRESOLVE=0")
»Scenario 2 (BCL)
After loading the problem from BCL into the solver, you can use the Xpress Optimizer API functions to set solver controls and start the tuning for this problem.
- BCL C++:
XPRSprob optprob; XPRBprob bclprob("MyProb"); // Initializes BCL and Optimizer bclprob.loadMat(); optprob = bclprob.getXPRSprob(); // Retrieve the Optimizer problem XPRSsetintcontrol(optprob, XPRS_MAXTIME, 60); // Set a time limit XPRStune(optprob, ""); // Start the tuning
- BCL Java:
XPRBprob bclprob; XPRSprob optprob; bcl = new XPRB(); // Initialize BCL bclprob = bcl.newProb("MyProb"); // Create a BCL problem XPRS.init(); // Initialize Xpress Optimizer optprob = bclprob.getXPRSprob(); // Retrieve the Optimizer problem optprob.setIntControl(XPRS.MAXTIME, 60); // Set a time limit optprob.tune(""); // Start the tuning
Applying the tuning results
You need to retrieve the Xpress Optimizer problem associated with the BCL problem to be able to modify its control parameter settings as shown for the 'MAXTIME' control in the code snippets above.
»Scenarios 3 and 4 (Xpress Optimizer)
With a loaded problem, the built-in tuner can be started by calling TUNE from the Optimizer console, or XPRStune from a user application. The Xpress Optimizer API also provides routines for managing tuner methods.
At the command prompt, the following sequence of commands can be used to tune an LP problem that is provided in the form of an MPS matrix in the file foliolp.mps:
optimizer foliolp readprob chgobjsense max maxtime=60 tune -l quit
Applying the tuning results
With the Optimizer console, you can modify control parameter settings as shown for the 'MAXTIME' control in the command listing above. From an application program you need to use one of the Optimizer API routines XPRSsetdblcontrol / XPRSsetintcontrol / XPRSsetstrcontrol depending on the parameter type.
Further information
- Xpress Optimizer: ``Xpress Optimizer Reference Manual'', Section 5.10 `Using the Tuner'