Skip to main content
FRAMES NO FRAMES

Custom inferencer in CP Optimizer
PREVIOUS NEXT

A custom inferencer is an object used by the default search for integrating an inference algorithm specific to a constraint model. Like a constraint, the purpose of a custom inferencer is to reduce the domains of the constrained variables. Unlike a constraint, a custom inferencer is not executed as soon as it might reduce some domains. The execution of an inferencer is left to the determination of the search algorithm, which decides when to execute it. In practice, a custom inferencer is used for costly inference algorithms. When a costly inference algorithm is embedded in a constraint, it may be executed at each node of the search tree and, consequently, may slow down the search for a solution significantly. When embedded in a custom inferencer, the inference algorithm is executed less often. Indeed, the default search attempts to manage the execution of the inferencer such that the slow down is not as significant, while the inference power is partially kept.

There are two modes for influencing the execution of a custom inferencer in the search:

Note that, in either case, the custom inferencer is executed for every leaf of the search tree. This way, a custom inferencer is able to guarantee the invariant in a solution of the model.

An example showing the usage of a custom inferencer is given in the example networkcfg.cpp.

Usage: the custom inferencer mechanism is a feature of the default search, which means that a user-defined search is not supported. Moreover, this feature is available for C++ API and for integer decision variables problems only (it is disabled when there is an interval variable in the model).

PREVIOUS NEXT