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

Using 'exists' for loops over sparse arrays

Description
The models loop.mos/looph.mos and proj.mos show the effect of using the keyword exists in conditions on loops over sparse arrays. As can be seen, the careful formulation of loops may result in a considerable speedup of the model execution time. Mosel defines two forms of sparse arrays, namely dynamic arrays and hashmap arrays. The model sparsearrays.mos compares the performance of these two forms for different cases of enumerations.

Further explanation of this example: 'Mosel User Guide', Appendix 'Good modeling practice' explains in detail the correct use of exists.


Source Files

Data Files





proj1.dat

D: [(1 3 6) 136
    (1 2 1) 121
    (2 2 3) 263
    (3 3 3) 333
    (-1 7 4) -174
    (5 3 9) 10320
    (2 3 4) 235]

Back to examples browserPrevious exampleNext example