finalize
finalize |
Purpose
Synopsis
procedure finalize(s:set)
procedure finalize(l:list)
Arguments
s
|
Dynamic set
|
l
|
Dynamic list
|
Example
In the following, an indexing set is defined, on which depends a dynamic array of decision variables. The set is subsequently defined to have three elements and is finalized. A static array is then defined:
declarations Set1: set of string x: array(Set1) of mpvar ! Declare a dynamic array of variables ! (entries need to be created ! subsequently) end-declarations Set1:= {"first", "second", "fifth"} finalize(Set1) ! Finalize the set definition declarations y: array(Set1) of mpvar ! Declare a static array of variables ! (entries are created immediately) end-declarations
Further information
1. This procedure finalizes the definition of a set (or list), that is, it turns a dynamic set into a constant set consisting of the elements that are currently in the set. All subsequently declared arrays that are indexed by this set will be created as static (= fixed size). Any arrays indexed by this set that have been declared prior to finalizing the set retain the status dynamic but their set of elements cannot be modified any more.
2. Using this routine on sets declared dynamic has no effect.