Nonprocedural Execution
Execution based on definitions
Execution based on definitions is typically not controlled by the user. It takes place automatically, but only when up-to-date values of defined sets or parameters are needed. Basically, execution can be triggered automatically from within:
the body of a function or procedure, or
an object in the graphical user interface.
Relating definitions and procedures
Consider a set or a parameter with a definition which is referenced in an execution statement inside a function or a procedure. Whenever the value of such a set or parameter is not up-to-date due to previous data changes, AIMMS will compute its current value just prior to executing the corresponding statement. This mechanism ensures that, during execution of functions or procedures, the functional relationships expressed in the definitions are always valid.
Lazy evaluation
During execution AIMMS minimizes its efforts and updates only those values of defined identifiers that are needed at the current point of execution. Such lazy evaluation can avoid unnecessary computations and reduces computational time significantly when the number of dependencies is large, and when relatively few dependencies need to be resolved at any particular point in time.
GUI requests
For the graphical objects in an end-user interface you may specify whether the data in that object must be up-to-date at all times, or just when the page containing the object is opened. AIMMS will react accordingly, and automatically update all corresponding identifiers as specified.
The set CurrentAutoUpdatedDefinitions
Which definitions are automatically updated in the graphical user
interface whenever they are out-of-date, is determined by the contents
of the predefined set CurrentAutoUpdatedDefinitions
. This set is a
subset of the predefined set AllIdentifiers
, and is initialized by
AIMMS to the union of the sets AllDefinedSets
and
AllDefinedParameters
by default.
Exclude from auto-updating
To prevent auto-updating of particular identifiers in your model, you
should remove such identifiers from the set
CurrentAutoUpdatedDefinitions
. You can change its contents either
from within the language or from within the graphical user interface.
Typically, you should exclude those identifiers from auto-updating whose
computation takes a long time to finish. Instead of waiting for their
computation on every input change, it makes much more sense to collect
all input changes for such identifiers and request their re-computation
on demand.
Requesting updates
All identifiers that are not contained in
CurrentAutoUpdatedDefinitions
must be updated manually under your
control. AIMMS provides several mechanisms:
you can call the
UPDATE
statement from within the language, oryou can attach update requests of particular identifiers as actions to buttons and pages in the end-user interface.
The UPDATE
statement
The UPDATE
statement can be used to update the contents of one or
more identifiers during the execution of a procedure that is called by
the user. In this way, selected identifiers which are shown in the
graphical user interface and not kept up-to-date automatically, can be
made up-to-date once the procedure is activated by the user.
Syntax
update-statement:
Allowed identifiers
The following selections of identifiers are allowed in the UPDATE
statement:
identifiers with a definition,
identifiers associated with a structural section in the model-tree, and
identifiers in a subset of the predefined set
AllIdentifiers
.
Example
The following execution statement inside a procedure will trigger AIMMS
to update the values of the identifiers FixedCost
, VariableCost
and TotalCost
upon execution.
Update FixedCost, VariableCost, TotalCost;