Data structures
array, set, list, record and any combinations thereof, e.g.,
S: set of list of integer A: array(range) of set of real
- Arrays
-
Array: collection of labeled objects of a given type where the label of an array entry is defined by its index tuple
declarations A: array(1..5) of real B: array(range, set of string) of integer x: array(1..10) of mpvar C: array(1..5) of real end-declarations A:: [4.5, 2.3, 7, 1.5, 10] A(2):= 1.2 B:: (2..4,["ABC", "DE", "KLM"])[15,100,90,60,40,15,10,1,30] C:= array(i in 1..5) x(i).sol
- Sets
-
Set: collection of objects of the same type without establishing an order among them (as opposed to arrays and lists)
Set elements are unique: if the same element is added twice the set still only contains it once.declarations S: set of string R: range end-declarations S:= {"A", "B", "C", "D"} R:= 1..10
- Lists
-
List: collection of objects of the same type
A list may contain the same element several times. The order of the list elements is specified by construction.declarations L: list of integer M: array(range) of list of string end-declarations L:= [1,2,3,4,5] M:: (2..4)[['A','B','C'], ['D','E'], ['F','G','H','I']]
- Records
-
Record: finite collection of objects of any type
Each component of a record is called a field and is characterized by its name and its type.declarations ARC: array(ARCSET:range) of record Source,Sink: string ! Source and sink of arc Cost: real ! Cost coefficient end-record end-declarations ARC(1).Source:= "B" ARC(3).Cost:= 1.5
- User types
-
User types are treated in the same way as the predefined types of the Mosel language. New types are defined in
declarations blocks by specifying a type name, followed by
=, and the definition of the type.
declarations myreal = real myarray = array(1..10) of myreal COST: myarray end-declarations
© 2001-2020 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.