Manually Enabling the Tuner
In some cases, the
Run Model dialog is not sufficient, and you must modify the source code of your model to enable the tuner:
- If your model executes a submodel using Mosel's run subroutine, the tuner will not be enabled for the submodel.
- If your model solves more than one optimization problem, the tuner will be enabled for all problems defined in the model, but the custom tuner settings specified in the Run Model dialog will only apply to the top-level problem.
There are two ways to manually enable the tuner. The first is to pass the
XPRS_TUNE option to the
minimize or
maximize call. For example, to tune a submodel when it is executed from a master model, the submodel could contain the following code:
minimize(XPRS_TUNE, Objective)The second way is to set the xprs_tunermode parameter:
setparam("xprs_tunermode", 1) minimize(Objective)
If you want to tune the main problem in your Mosel model, but disable the tuner for the subproblems, you can set
xprs_tunermode to zero when solving the subproblem, and then set it to 1 when solving the main problem.
with subprob do setparam("xprs_tunermode", 0) ! Disable the tuner minimize(SecondaryObjective) done setparam("xprs_tunermode", 1) ! Enable the tuner minimize(PrimaryObjective)
To customize the tuner settings when tuning a subproblem, the relevant parameters must be set inside the with block which defines the subproblem. For example:
with subprob do setparam("xprs_tunermethodfile", "tunermethod.xtm") setparam("xprs_tunerthreads", 4) minimize(SecondaryObjective) done
For more information about parameters that affect the tuner's behavior, see Using the Tuner in the Optimizer Reference Manual. See the Mosel Language Reference Manual for more information about working with multiple problems in Mosel.