finalize


Purpose
Finalize the definition of a set or list.
Synopsis
procedure finalize(s:set)
procedure finalize(l:list)
Arguments
Dynamic set
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
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.


If you have any comments or suggestions about these pages, please send mail to docs@dashoptimization.com.