Procedural and Nonprocedural Execution
Execution based on definitions
The definitions specified inside the declarations of sets and parameters together form a system of functional relationships. As discussed in Execution of Nonprocedural Components AIMMS automatically determines the dependency between the identifiers that are used inside these relationships. Based on the (required) a-cyclic dependency structure between identifiers (see also Dependency Structure of Definitions), AIMMS knows the exact order in which identifiers need to be computed. Execution based on definitions is not controlled by the user, but takes place automatically when values are needed.
Execution based on procedures
Procedures are self-contained programs with a body consisting of execution statements. These statements typically determine the value of those identifiers which cannot be defined using a single functional relationship. Execution using procedures proceeds according to the order of execution statements encountered inside each procedure, and is therefore controlled by the user.
Relating definitions and procedures
Whenever a set or a parameter with a definition is used in an execution statement inside a procedure, and its value is not up-to-date due to previous data changes, AIMMS will compute its current value just prior to executing the corresponding statement. This updating facility in AIMMS forms the necessary and powerful connection between automatic execution based on definitions and user-initiated execution based on procedures.
Definitions and algorithms
Procedural and nonprocedural execution both have their own natural role in an AIMMS application. Identifier definitions are the most convenient way to define unique functional relationships between various identifiers in your model-and keep them up-to-date at all times. Procedures provide a powerful tool to specify the algorithms that are needed to compute the identifier values without a direct functional relationship. Procedural statements are also required to communicate data between AIMMS and external data sources such as files and databases.
AIMMS provides a rich set of execution statements that you can use to
compose your procedures. Available statements include a versatile
assignment statement, statements for data and option management, the
most common flow control statements, calls to other procedures, and a
SOLVE statement to solve various types of optimization