Preparing the submodel
Either by using run configuration and project instances, or by using model and data file instances.
There are two ways of initializing all that is necessary for the submodel:
Using run configuration and project instances
Using model and data file instances
Using run configuration and project instances
The quickest way of instantiating the model consists in using the class
IloOplProject. An alternative method (not used in the
example) is presented afterwards, using
IloOplRunConfiguration.
IloOplProject
The class IloOplProject allows you to create an IloOplModel instance. This allows you to handle settings files (.ops) easily.
These two classes are fully documented in the IBM ILOG Script Reference Manual.
The IloOplDataElements is created from scratch and initialized
with data from the master model using the following code:
var subData = new IloOplDataElements();
subData.RollWidth = masterOpl.RollWidth;
subData.Size = masterOpl.Size; The array Duals is now declared in the post processing of
the master model and we pass it to the sub model as follows:
subData.Duals = masterOpl.Duals; IloOplRunConfiguration
Alternatively, the class IloOplRunConfiguration could be used to create an IloOplModel instance in a straightforward manner by just passing the file names as arguments, as follows:
var subSource = new IloOplModelSource("cutstock-sub.mod");
var subDef = new IloOplModelDefinition(subSource);
var subData = new IloOplDataElements();
var subCplex = new IloCplex();
After
the run configuration is created, you can access the IloOplModel instance
using the oplModel property, as follows:
subOpl.generate();
Using model and data file instances
from scratch, using a model source, model definition, and data source (see the list in The cutting stock example).
var subSource = new IloOplModelSource("cutstock-sub.mod");
var subDef = new IloOplModelDefinition(subSource);
var subCplex = new IloCplex();