Extraction process

A model is extracted to the engine recursively.

Before a model is solved, CP Optimizer creates engine objects corresponding to the model objects. This process is called model extraction. Model extraction is automatically done at the beginning of the search (that is at the beginning of IloCP::solve(), of IloCP::propagate() or of the first call to IloCP::next() after IloCP::startNewSearch()).

A model is extracted to the engine recursively. When an instance of IloCP extracts a model, it iterates over each model object (also called extractables) added to the model and works on extracting it. This mechanism is recursive in the sense that the extraction of an object may lead to the extraction of another object. For instance, the extraction of the model:


    IloIntVar x(env, 0, 1);
    IloIntVar y(env, 0, 10);
    IloIntVar z(env, -1, 3);
    IloModel model(env);
    model.add(z);
    model.add(x + 2 * y <= 3);

involves the extraction of the variable z and the constraint x + 2 * y <= 3. The extraction of the constraint in turn involves the extraction of variables x and y.

The purpose of extraction is to create engine objects from the extractables of the model. Theses objects can be constraints, variables or expressions.

In particular, it creates:

  • one engine variable for each decision variable in the model and

  • an engine constraint for a constraint or a group of constraints in the model.

These engine objects are usually prefixed with Ilc.

  • The engine object of a decision variable is an instance of IlcIntVar.

  • The engine object of a constraint is an instance of IlcConstraint.

  • The engine object of an expression is an instance of IlcIntExp or IlcFloatExp depending on the type of the expression.

  • Other types of extractables generally have counterparts in the engine. For instance, an instance of IloIntTupleSet is extracted to an instance of IlcIntTupleSet.