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

Read two tables and a set from a text data file

Description
Read two tables and a set from a free format data file (text file).
  • opening and closing a file
  • skipping comments and empty lines
  • using 'read' and 'readln'
  • using loops: forall, repeat-until, while


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

Data Files





datafile.dat

# A simple data file
# to initialise 2 tables and a set

# The sizes of the first table:
4 4
# Then the values:
01 02 03 04
11 12 13 14
21 22 23 24
31 32 33 34

# The second array is dynamic and indexed by 2 sets of strings
# Entries are separated by the symbol `|'. The end is marked
# with an empty line
v1 | x1 | 10
v2 | x2 | 20
v3 | x3 | 30

# The elements of a set of strings. The end is marked with a dot:
Pomegue Rateneau
Degaby Planier .

Back to examples browserPrevious exampleNext example