Initializing help system before first use

Initializing lists

Lists are not commonly used in the standard formulation of Mathematical Programming problems. However, this data structure may be useful for the Mosel implementation of some more advanced solving and programming tasks.

Constant list

If the contents of a list are specified at the declaration of the list, such as

 declarations
  L = [1,2,3,4,5,6,7,8,9,10]
 end-declarations

we have defined a constant list (its contents cannot be changed). If we want to be able to modify the list contents subsequently we need to separate the definition of the list contents from the declaration, resulting in a dynamic list:

 declarations
  L: list of integer
 end-declarations

 L:= [1,2,3,4,5,6,7,8,9,10] 

A two-dimensional array of lists may be defined thus (and higher dimensional arrays by analogy):

 declarations
  M: array(range,set of integer) of list of string
 end-declarations

 M:: (2..4,1)[['A','B','C'], ['D','E'], ['F','G','H','I']] 

List initialization from file

Similarly to what we have already seen for other data structures, the contents of lists may be initialized from file through initializations blocks. For example,

 declarations
  K: list of integer
  N: array(range,set of integer) of list of string
 end-declarations

 initializations from "listinit.dat"
  K  N
 end-initializations

 writeln("K: ", K)
 writeln("An entry of N: ", N(5,3)) 

Assuming the datafile listinit.dat contains these lines

K: [5 4 3 2 1 1 2 3 4 5]

N: [(3 1) ['B' 'C' 'A']
    (5 3) ['D' 'E']
    (6 1) ['H' 'I' 'F' 'G']] 

we obtain the following output from the model fragment above:

K: [5,4,3,2,1,1,2,3,4,5]
An entry of N: [`D',`E']  

© 2001-2019 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.