MathematicalProgram
Declaration and Attributes
Attributes
The attributes of mathematical programs are listed in this table.
Attribute 
Valuetype 
See also page 


variableidentifier 





variableset 


constraintset 


modeltype 


reference 


string 


comment string 


convention 
Example
The following example illustrates a typical mathematical program.
MathematicalProgram TransportModel {
Objective : TransportCost;
Direction : minimize;
Constraints : AllConstraints;
Variables : AllVariables;
Type : lp;
}
It defines the linear program TransportModel
, which is built up from
all constraints and variables in the model text. The variable
TransportCost
serves as the objective function to be minimized.
The Objective
attribute
With the Objective
attribute you can specify the objective of your
mathematical program. Its value must be a reference to a (defined)
variable or any other variable expression. When you want to use the
objective value in the enduser interface of your model, the
Objective
attribute must be a variable reference.
Omitting the objective
If you do not specify an objective, your mathematical program will be solved to find a feasible solution and it will then terminate.
The Direction
attribute
In conjunction with an objective you must use the Direction
attribute to indicate whether the solver should minimize
or
maximize
the objective. During a SOLVE
statement you can
override this direction by using a WHERE
clause for the
direction
option.
The Variables
attribute
With the Variables
attribute you can specify which set of variables
are to be included in your mathematical program. Its must be either the
predefined set AllVariables
or a subset thereof. The set
AllVariables
is predefined by AIMMS, and it contains the names of
all the variables declared in your model. Its contents cannot be
changed. If you mathematical program contains an objective, AIMMS will
automatically add this to set of generated variables during generation.
Variables as parameters
If the Variables
attribute is assigned a subset of the set
AllVariables
, AIMMS will treat all the variables outside this set as
if they were parameters. That is, all occurrences of such variables will
not result in the generation of individual variables for the solver, but
will be accounted for in the righthand side of the constraint according
to their value during generation.
Compare to NonvarStatus
The Variables
attribute performs a similar function as the
NonvarStatus
attribute or the .NonVar
suffix of a variable (see
also Variable Declaration and Attributes). The Variables
attribute in a mathematical
program allows you to quickly change the status of an entire class of
variables, while the NonvarStatus
(in a variable declaration) gives
much finer control at the individual level. As shown below, the latter
is very useful to perform model algebra.
The Constraints
attribute
With the Constraints
attribute you can specify which constraints are
part of your mathematical program. Its value must be either the
predefined set AllConstraints
or a subset thereof. The set
AllConstraints
contains the names of all declared constraints plus
the names of all variables which have a definition attribute. Its
contents is computed at compile time, and cannot be changed.
If you specify the set
AllConstraints
, AIMMS will generate individual constraints for all declared constraints and variables with a definition.If you specify a subset of the set
AllConstraints
, AIMMS will only generate individual constraints for the declared constraints and defined variables in that subset.
If you mathematical program has an objective which is a defined variable, its definition is automatically added to the set of generated constraints during generation.
Defined variables
Variables with a nonempty definition attribute have a somewhat special
status. Namely, for every defined variable AIMMS will not only generate
this variable, but will also generate a constraint containing its
definition. Therefore, defined variables are contained in both the
predefined sets AllVariables
and AllConstraints
. You can add a
defined variable to the variable and constraint set of a mathematical
program independently.
If you omit a defined variable from the variable set of a mathematical program, all occurrences of the variable will be fixed to its current value and accounted for in the righthand side of all constraints.
If you omit a defined variable from the constraint set of a mathematical program, the defining constraint will not be generated.
Performing model algebra
By changing the contents of the identifier sets that you have entered at
the Variables
and Constraints
attributes of a mathematical
program you can perform a simple form of model algebra. That is, you
can investigate the effects of adding or removing constraints from
within the graphical interface. Furthermore, it allows you to
reconfigure your model based on the value of your model data.
Synchronizing variable and constraint sets
When changing the contents of either the variable or the constraint set of a mathematical program, you may find that the contents of the other set also needs some adjustment. For instance, adding a variable to a mathematical program makes no sense if there are no constraints that refer to it. AIMMS offers two special setvalued functions to help you to accomplish this task.
The function VariableConstraints
The function VariableConstraints
takes a subset of the predefined
set AllVariables
as its argument, and returns a subset of the
predefined set AllConstraints
. The resulting constraint set contains
all constraints which use one or more of the variables in the argument
set.
The function ConstraintVariables
The function ConstraintVariables
performs the opposite task. It
takes a subset of the set AllConstraints
as its arguments, and
returns a subset of the set AllVariables
. The resulting variable set
contains all variables which are referred to in one or more constraints
in the argument set. Also included are all variables referred to in the
definitions of other variables inside the set.
Example
Consider the use of the functions VariableConstraints
and
ConstraintVariables
in conjunction with the following declaration of
a mathematical program.
MathematicalProgram PartialTransportModel {
Objective : TransportCost;
Direction : minimize;
Constraints : PartialConstraintSet;
Variables : PartialVariableSet;
}
Assume that the set PartialVariableSet
contains a subset of the
variables declared in the model. Further assume that you would like to
build up the contents of the set PartialConstraintSet
together with
the required additions to PartialVariableSet
so that the contents of
both sets are maximal. This is referred to as their transitive closure.
By successively calling the functions VariableConstraints
and
ConstraintVariables
, the following loop computes the transitive
closure of the variable and constraint sets.
repeat
PreviousCardinality := Card( PartialVariableSet );
PartialConstraintSet := VariableConstraints( PartialVariableSet );
PartialVariableSet := ConstraintVariables( PartialConstraintSet );
break when Card( PartialVariableSet ) = PreviousCardinality;
endrepeat ;
The break
occurs when the set PartialVariableSet
has not
increased in size.
The Type
attribute
With the Type
attribute of a mathematical program you can prescribe
a solution type. When the specified type is not compatible with the
generated mathematical program, AIMMS will return an error message. You
can override the type during a SOLVE
statement using a WHERE
clause for the type
option. You can use this, for instance, to
easily switch between the mip
and rmip
types.
Available types
A complete list of the mathematical program types available within AIMMS
is given in this table. Most are selfexplanatory. When
the type rmip
is specified, all integer variables are treated as
continuous within their bounds. The rmip
type is the global version
of the Relax
attribute associated with individual variables (see
also Variable Declaration and Attributes). The types ls
and nls
can only be
selected in the absence of the Objective
attribute.
Type 
Description 


linear program 

linear system 

quadratic program 

nonlinear program 

nonlinear system 

mixed integer program 

relaxed mixed integer program 

mixed integer nonlinear program 

relaxed mixed integer nonlinear program 

quadratic program 

mixed integer quadratic program 

quadratic constraint program 

mixed integer quadratic constraint program 

pure network program 

mixed complementarity program 

mathematical program with complementarity constraint 
The Convention
attribute
You can use the Convention
attribute to specify the unit convention
that you want to be used for scaling the variables and constraints in
your mathematical program. For further details on this issue you are
referred to Globally Overriding Units Through Conventions.
The ViolationPenalty
attribute
With the ViolationPenalty
attribute you can instruct AIMMS to
automatically add artificial terms to the constraints of your
mathematical program to help resolve and/or track infeasibilities in
your mathematical program. Infeasibility analysis and the use of the
ViolationPenalty
attribute is discussed in full detail in
Infeasibility Analysis.