What occurs during the extraction of a model and what is the correspondence between the model object (starting with Ilo
) and the Solver object (starting with Ilc
)? All the extractable objects (that is, instances of IloExtractable
or one of its subclasses) that have been added to a model (an instance of IloModel
) and that have not been removed from it and that are relevant to the given search algorithm will be extracted when Concert Technology extracts information from a model.
In case you need to access the extractable objects in a model, an instance of the embedded class IloModel::Iterator
accesses those objects. For example, the following lines create the model model
in the environment env
, add constraints to the model, and iterate over the extractable objects added to model
.
for (IloModel::Iterator it(model); it.ok(); ++it) {
if ((*it).getName())
env.out() << (*it).getName() << endl;
}
|
After you create a search algorithm in your Concert Technology application, your next step is to extract a model for that search algorithm. You call the member function extract with the model as an argument. Since these two steps--creating the search algorithm and extracting the model--are repeated in most Concert Technology applications, there is a shortcut combining them:
When a search algorithm extracts a model, it scans all the extractable objects in that model and creates corresponding internal objects for optimizing the model. The search algorithm also recursively extracts the other extractable objects referenced by that extractable object.
A search algorithm extracts only one model at a time. If you extract another model for an instance of IloSolver
, that search algorithm will discard the current model and load the new one.