The oil sheet project
Describes the model file in the project.
Use the menu command to open the oil example.
The IDE displays the oil project
in the OPL Projects Navigator. Open the model file in the editing
area.
Set definitions in the model
At the beginning of the model file, there are definitions of sets of string values to hold the names of the gasolines and oils:
Set definitions (oil.mod)
{string} Gasolines = ...;
{string} Oils = ...;
Tuple definitions in the model
These are followed by definitions of tuples for the data, as shown in the following code extract.
Tuple definitions
(oil.mod)
tuple gasType {
float demand;
float price;
float octane;
float lead;
}
tuple oilType {
float capacity;
float price;
float octane;
float lead;
}
Note
that these tuple definitions follow the rows in the gas data and oil
data sheets respectively but do not include the name column.
Tuple arrays in the model
The model in OPL then declares one-dimensional arrays, Gas and Oil,
containing tuples for the gasolines and oils:
Tuple arrays (oil.mod)
gasType Gas[Gasolines] = ...;
oilType Oil[Oils] = ...;
For data input from Microsoft Excel, OPL supports one-dimensional
arrays of tuples as well as one or two-dimensional arrays of int, float,
and string values.