7.4 Setting solver parameters

MOSEK comes with a large number of parameters that allows the user to tune the behavior of the optimizer. The typical settings which can be changed with solver parameters include:

  • choice of the optimizer for linear problems,

  • choice of primal/dual solver,

  • turning presolve on/off,

  • turning heuristics in the mixed-integer optimizer on/off,

  • level of multi-threading,

  • feasibility tolerances,

  • solver termination criteria,

  • behaviour of the license manager,

and more. All parameters have default settings which will be suitable for most typical users.

The API reference contains:

Setting parameters

Each parameter is identified by a unique name and it can accept either integers, floating point values, symbolic strings or symbolic values. Parameters are set in the lists iparam, dparam and sparam of the structure problem and passed with the problem to mosek.

Some parameters can accept symbolic strings from a fixed set. The set of accepted values for every parameter is provided in the API reference.

For example, the following piece of code sets up some parameters before solving a problem.

Listing 7.3 Parameter setting example. Click here to download.
    # Set log level (integer parameter)
    # and select interior-point optimizer... (integer parameter)    
    # ... without basis identification (integer parameter)    
    prob$iparam <- list(LOG=0, OPTIMIZER="OPTIMIZER_INTPNT", INTPNT_BASIS="BI_NEVER")

    # Set relative gap tolerance (double parameter)
    prob$dparam <- list(INTPNT_CO_TOL_REL_GAP=1.0e-7)    

    # Solve the problem
    r <- mosek(prob)