FICO
FICO Xpress Optimization Examples Repository
FICO Optimization Community FICO Xpress Optimization Home
Back to examples browserPrevious exampleNext example

Conditional creation of decision variables

Description
If an array of decision variables of type mpvar is created as a dynamic array then its entries must be created explicitly using the subroutine create (doesx.mos). It is recommended to add an explicit 'exists' condition in loops over sparse arrays to improve the performance of the enumeration (doesx1.mos). Through the automatic finalization mechanism or via an explicit call to finalize a dynamic set is turned into a constant set, all subsequently declared arrays that are indexed by this set will be created as static arrays (doesx2.mos).

Further explanation of this example: 'Mosel User Guide', Section 3.3 Conditional generation


Source Files
By clicking on a file name, a preview is opened at the bottom of this page.
doesx.mos[download]
doesx1.mos[download]
doesx2.mos[download]

Data Files





doesx.dat

! Data file for 'doesx.mos'
WHICH: [1 4 7 11 14]

Back to examples browserPrevious exampleNext example