Initializing help system before first use

# 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
--- | ---
TIMELIMIT | The maximum time in seconds that the Optimizer will run before it terminates.
SOLTIMELIMIT | A soft limit (in seconds) on runtime for a MIP solve. The solver stops whenever a feasible MIP solution is found and the runtime exceeds the specified value.
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 (object-oriented APIs)

Depending on your choice of a host language open one the files Folio.[cs|java] located in the corresponding subdirectory examples\optimizer\[csharp|java]\objects of the Xpress distribution. This new version of the portfolio optimization problem from 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'
- Optimizer: ``Xpress Optimizer Reference Manual'', Chapter 7 `Control Parameters'
- Optimizer: ``Solver Java/.NET/C++ User Guide'', Chapter 1, `Setting solver controls'

## 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, MIP, QCQP, MIQCQP, SOCP, and MISOCP problems. When Xpress Nonlinear or Xpress Global are available, it can work with general nonlinear and MINLP problems for tuning the algorithms provided by those solvers. 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 TIMELIMIT 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 (see the example in file examples\getting_started\Mosel\foliolptune.mos):

    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.

Applying the tuning results

Any parameter settings need to be made before the call to the solution algorithm. Prefix the parameter name with XPRS_ to obtain its Mosel name:

    setparam("XPRS_PRESOLVE", 0)

Alternatively, define parameter settings as a system command (requires module mmsystem):

    command("PRESOLVE=0")

Xpress Workbench

If you are using Xpress Workbench for working with Mosel models, you can employ the option XPRS_TUNE to the optimization routine in the Mosel source as described above, or alternatively 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. The summary tuner result files (file with extension .xtr in the tuner log output directory) can be opened in the Workbench editor:

Figure 1: Tuner results display in Xpress Workbench

The displayed lines representing individual tuner runs can be re-ordered by clicking on the column headers. By selecting the copy link in any line of the summary file Workbench opens a message box showing how to apply the corresponding parameter settings in the Mosel model :

Figure 2: Applying tuner results to a Mosel model

#### »Scenario 2 (object-oriented APIs)

After loading the problem into the solver, you can use the Xpress Optimizer API functions to set solver controls and start the tuning for this problem.

- C++:

       XpressProblem prob;                        // Initialize Optimizer
       prob.readProb("MyProb.mps", "");

       prob.setTimeLimit(60);                     // Set a time limit
       prob.tune("");                             // Start the tuning

- Java:

       XpressProblem prob = new XpressProblem();  // Initialize Optimizer
       prob.readProb("MyProb.mps", "");

       prob.controls().setTimeLimit(60);          // Set a time limit
       prob.tune("");                             // Start the tuning

Applying the tuning results

To apply the tuning results, simply set the control parameters that were recommended by the tuner.

- C++:

       XpressProblem prob;
       prob.readProb("MyProb.mps", "");

       prob.setPresolve(0);
       prob.setSbEffort(0.5);

- Java:

       XpressProblem prob = new XpressProblem();
       prob.readProb("MyProb.mps", "");

       prob.controls().setPresolve(0);
       prob.controls().setSbEffort(0.5);

#### »Scenarios 3 and 4 (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. Alternatively, a set of problems can be tuned via the subcommand 'probset' of TUNE or the library function XPRStuneprobsetfile. The Xpress Optimizer API also provides routines for managing tuner methods.

Optimizer Python interface: After loading the problem file into a Python object, use the Xpress Optimizer API functions to set solver controls and start the tuning for this problem.

    import xpress as xp

    p = xp.problem()

    p.read('foliolp.mps')    # reads MPS file into the problem

    p.chgobjsense(sense=xp.maximize)
    p.controls.timelimit=60
    p.tune(flags='l')        # specify flag 'l' (optional)

Instead of working with a single problem instance it usually is preferrable to work with a set of problems, provided as a list of problem filenames in a file problems.set:

    import xpress as xp

    p = xp.problem()

    p.controls.timelimit=60  # set a time limit per individual solve
    p.tuneprobsetfile("problems.set")

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
    timelimit=60
    tune -l
    quit

Alternatively, you can use this form of the TUNE command to tune a set of problems defined in the file problems.set:

    optimizer
    timelimit=60
    tune -l probset problems.set
    quit

Applying the tuning results

With the Optimizer console, you can modify control parameter settings as shown for the 'TIMELIMIT' 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'
- Python: see examples in the ``Python interface manual'', Chapter 6

Parent Topic Advanced Evaluators Guide

© 2001-2026 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.