create
create |
Purpose
Synopsis
procedure create(x:array reference)
Argument
x
|
Cell to be created
|
Example
The following declares a dynamic array of variables, creating only those corresponding to the odd indices. Finally, it defines the linear expression
x(1) + x(3) + x(5) + x(7):
declarations x: dynamic array(1..8) of mpvar end-declarations forall(i in 1..8| isodd(i)) create(x(i)) c:= sum(i in 1..8) x(i)
Further information
Usually cells of dynamic arrays are created by means of assignments. This procedure can be used as a replacement for an assignment especially when the type of a dynamic array does not provide any assignment operator (like
mpvar for instance).
Related topics