The SOLVE
Statement
The SOLVE
statement
With the SOLVE
statement you can instruct AIMMS to compute the
solution of a MathematicalProgram
, resulting in the following
actions.
AIMMS determines which solution method(s) are appropriate, and checks whether the specified type is also appropriate.
AIMMS then generates the Jacobian matrix (first derivatives of all the constraints), the bounds on all variables and constraints, and an objective where appropriate.
AIMMS communicates the problem to an underlying solver that is able to perform the chosen solution method.
AIMMS finally reads the computed solution back from the solver.
Syntax
In addition to initiating the solution process of a
MathematicalProgram
, you can also use the SOLVE
statement to
provide local overrides of particular AIMMS settings that influence the
way in which the solution process takes place. The syntax of the
SOLVE
statement follows.
solve-statement:
Replace and merge mode
You can instruct AIMMS to read back the solution in either replace or
merge mode. If you do not specify a mode, AIMMS assumes replace mode.
In replace mode AIMMS will, before reading back the solution of the
mathematical program, remove the values of the variables in the
Variables
set of the mathematical program for all index tuples
except those that are fixed
because they are not within their current domain (i.e. inactive),
through the
NonvarStatus
attribute or the.NonVar
suffix of the variable,because they are outside the planning interval of a
Horizon
(see Horizons), orbecause their upper and lower bounds are equal.
In merge mode AIMMS will only replace the individual variable values involved in the mathematical program. This mode is very useful, for instance, when you are iteratively solving subproblems which correspond to slices of the symbolic variables in your model.
Infeasible and unbounded problems
Whenever the invoked solver finds that a mathematical program is
infeasible or unbounded, AIMMS will assign one of the special values
na
, inf
or -inf
to the objective variable. For you, this
will serve as a reminder of the fact that there is a problem even when
you do not check the ProgramStatus
and SolverStatus
suffices.
For all other variables, AIMMS will read back the last values computed
by the solver just before returning with infeasibility or unboundedness.
Temporary option settings
Sometimes you may need some temporary option settings during a single
SOLVE
statement. Instead of having to change the relevant options
using the OPTION
statement and set them back afterwards, AIMMS also
allows you to specify values for options that are used only during the
current SOLVE
statement. The syntax is similar to that of the
OPTION
statement.
Also for attributes
Apart from specifying temporary option settings you can also use the
WHERE
clause to override the type
and direction
attributes
specified in the declaration of the mathematical program, as well as the
solver
to use for the solution process.
Example
The following SOLVE
statement selects 'cplex'
as its solver,
sets the model type to 'rmip'
, and sets the CPLEX option
LpMethod
to 'Barrier'
.
solve TransportModel in replace mode
where solver := 'cplex',
type := 'rmip',
LpMethod := 'Barrier' ;