IBM ILOG Solver User's Manual > Extending the Library > Advanced Modeling with Set Variables: Configuring Tankers > Model > Declaring the variables |
Declaring the variables |
INDEX
![]() |
To represent the orders the imaginary company receives from customers, you first define the class OrderI
, identifying each order uniquely and indicating its products, like this:
You group orders (instances of OrderI
) into a global array (Orders
) to represent all the orders to fulfill.
To represent the products demanded within an order, you define the class ProductI
, indicating which order, which type of product, and which quantity, like this:
The five different types of products are represented by the integers {1, 2, 3, 4, 5}. You say that 3 and 4 are the two types that cannot be transported in the same truck.
You also represent the trucks by a class--TruckI
--with a unique identifier for each truck, an indicator of whether or not that truck is used, a set variable to show which orders are filled by that truck, and another set variable to indicate which tanks make up the truck. You define that class like this:
To represent the tanks that make up a truck, you first enumerate the capacity of the different types of tanks: {1000, 2000, 3000, 4000, 5000}
. Then you define the class TankI
, like this:
Using these classes, you can express many of the constraints in the problem through their constructors, but before you add the constraints, you must look more closely at how to access attributes of those classes when their objects serve in the model as elements in the domain of a set.
© Copyright IBM Corp. 1987, 2009. Legal terms. | PREVIOUS NEXT |