IBM ILOG Solver User's Manual > Extending the Library > Extraction Concepts > Main rule of extraction: 1 to 1 correspondence > Exceptions to the rule: The effect of preprocessing

The following rule is always true. For each Ilo object in the model, there is a corresponding Ilc object. However, this is not always a 1 to 1 correspondence due to preprocessing. Preprocessing causes the following exceptions to the 1 to 1 correspondence rule:

Exception 1

The following example demonstrates the first effect of preprocessing: the corresponding Ilc object is not always the same for the same Ilo object. The extraction that takes place will merge the extracted objects.

Here's the code to be extracted

IloNumVar x(env, 0, 10, ILOINT);
IloNumVar y(env, 0, 10, ILOINT);
model.add(x == y + 2);

You might expect the following code due to the 1-to-1 correspondence rule:

IlcIntVar x(solver, 0, 10);
IlcIntVar y(solver, 0, 10);
solver.add(x == y + 2);

However, due to preprocessing the extraction will create the following Ilc code:

IlcIntVar y(solver, 0, 10);
IlcIntVar x = y + 2;

In this case, the 1-to-1 correspondence rule is not followed because in the preprocessing phase the expression y + 2 and the variable x are merged into one object: IlcIntVar x = y + 2. Even though IloNumVar x and IloNumVar y are the same type of Ilo object they are not extracted into the same type of Ilc objects. IloNumVar y is extracted into the Ilc variable IlcIntVar y while IloNumVar x is merged with the expression model.add(x == y + 2) and extracted into IlcIntVar x = y + 2. Though the same type of extraction behavior is expected for these two objects of the same type, this does not occur due to the effects of preprocessing.

Exception 2

The following example demonstrates the second effect of preprocessing: two Ilo objects may be extracted into one Ilc object.

Here is the code to be extracted:

IloNumVar x(env, 0, 10, ILOINT);
IloNumVar y(env, 0, 10, ILOINT);
IloNumVar z(env, 0, 10, ILOINT);
model.add(x == y + 2);
model.add(z == y + 2);

You might expect the following code due to the 1-to-1 correspondence rule:

 IlcIntVar x(solver, 0, 10);
IlcIntVar y(solver, 0, 10);
IlcIntVar z(solver, 0, 10);
solver.add(x == y + 2);
solver.add(z == y + 2);

However, due to preprocessing the extraction will create the following Ilc code:

IlcIntVar y(solver, 0, 10);
IlcIntVar x = y + 2;
IlcIntVar z = y + 2;

The implementation of expressions and variables in Solver will cause x and z to be extracted into the same physical object. The two Ilo objects x and z are extracted into one Ilc object due to the effects of preprocessing. (When you build the same expression twice in Solver, it merges these expressions into the same physical object.)