IBM ILOG Solver User's Manual > Extending the Library > Using Impacts during Search > Understanding impacts

The impact of an assignment x = a is an estimation of the proportion of the search space that this assignment eliminates by constraint propagation. This proportion is computed by considering the size of variable domains before and after the assignment. In a way, the impact is an estimation of how constrained the assignment is.

In general, the impact of a given assignment x = a does not vary much from one node of the search tree to another. As a consequence, the value used is the average of the eliminated proportion observed on every other assignment of x = a, at a given point in the search. Moreover, impacts are available without significant overhead.

In practical terms, to use impacts it is necessary to add an instance of IlcConstraintAggregator and to specify the variable on which you want to produce impacts. For example, if vars is such an array of variables, you need to call the following function before model extraction:

solver.use(IlcImpactInformation(env, vars));

The (averaged) impact of the assignment x = a is obtained by calling the function:

IlcFloat IloSolver::getImpact(const IlcIntVar x, 
                              IlcInt a, 
                              IlcBool countFails = IlcTrue) const;

The countFails parameter specifies if failures of the instantiation x = a are counted in the average. A failure has an impact equal to 1 because it eliminates the whole search space below it.

For a variable it is assumed that, a priori, every value of the variable will be tried to find a solution. Consequently, the impact is the sum of the impacts of the values in the current domain of the variable. In other words, it is an estimation of the effort needed to explore the whole search space starting with this variable.

The impact of a variable is obtained by calling the function:

IlcFloat IloSolver::getImpact(const IlcIntVar x) const;

It is important to note that for impacts to be updated, you must use the goals returned by the following functions, which make choices:

IlcGoal IlcSetValue(const IlcIntVar var, const IlcInt val);
IlcGoal IlcRemoveValue(const IlcIntVar var, const IlcInt val);

In some situations (for example, when the impacts vary more than expected in the search tree) it is worthwhile to compute the impact of an assignment at a node instead of using the averaged observations. This value is obtained for values and variables with the functions:

  IlcFloat IloSolver::getLocalImpact(const IlcIntVar x, IlcInt v) const;
  IlcFloat IloSolver::getLocalVarImpact(const IlcIntVar x, 
                                        IlcInt depth = -1) const;

Note that a call to this function does instantiations and propagation to compute the local impact. Therefore, it can create a significant overhead.