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

Working with arrays

Description
  • arraydef.mos: Defining arrays: sparse and dense arrays; deleting array entries; multiple indices; array access functions
  • arrayinit.mos: Array initialization from a text file (requires arrayinit.dat)
  • autoarray.mos: Working with automatic arrays
  • chess2.mos: Indexing arrays by variables
Further explanation of this example: 'Mosel User Guide', Section 8.1 Arrays


Source Files
By clicking on a file name, a preview is opened at the bottom of this page.
arraydef.mos[download]
arrayinit.mos[download]
autoarray.mos[download]
chess2.mos[download]

Data Files





arrayinit.dat

! Data file for "arrayinit.mos"
A: [2 4 6 8 10 12]
B: [(1 1) 2 (1 2) 4 (1 3) 6 (2 1) 8 (2 2) 10 (2 3) 12]
SomeName: [("a" 1) 2 ("a" 2) 4 ("b" 3) 6 ("c" 4) 8 ("b" 5) 10]
SomeName2: [("a" 3) 12 ("b" 2) 14 ("b" 5) 16]
MNData: [ ("A") [2 "a"] ("B") [* "b"] 
          ("C") [6 *]   ("D") [8 "c"]
          ("E") [10 "b"] ]

Back to examples browserPrevious exampleNext example