FRAMES NO FRAMES

Class IloMultipleEvaluator<,>

Definition file: ilsolver/iimmulti.h
Include file: <ilsolver/iim.h>
An explicit evaluator which can be refreshed from a container class.

This class is a simple extension to the IloExplicitEvaluator class, which allows the explicit evaluator to be filled with the objects (and their evaluations) found in a container class.

This class is best used when a particular container changes relatively infrequently, but at known times. When this happens, you can update the evaluator explicitly by asking the evaluator to take evaluations from the container.

This class can be created in two ways. The first way of creating an instance of this class is from a subordinate evaluator, so that when the update from the container happens, this subordinate evaluator is used to evaluate each member of the container. In this case, the class is used as a kind of manually refreshed cache to avoid excessive recomputation. The other way of creating an instance of this class is through the use of the ILOMULTIPLEEVALUATOR0 macro (or one of its variants), which allows complete freedom in how the evaluations are derived from the objects in the container class.

See Also:

Constructor Summary
public IloMultipleEvaluator(IloEnv env, IloEvaluator< IloObject > evaluator, IloVisitor< IloObject, IloContainer > visitor=0)

Builds a multiple evaluator from a subordinate evaluator.

Method Summary
public voidupdate(IloContainer container) const

Updates the evaluations of the invoking evaluator.

Inherited Methods from IloExplicitEvaluator
getEvaluation, getNumberOfEvaluations, hasEvaluation, removeAllEvaluations, removeEvaluation, setEvaluation
Inherited Methods from IloEvaluator
makeGreaterThanComparator, makeLessThanComparator, operator()
Constructor Detail

IloMultipleEvaluator

public IloMultipleEvaluator(IloEnv env, IloEvaluator< IloObject > evaluator, IloVisitor< IloObject, IloContainer > visitor=0)
Builds a multiple evaluator from a subordinate evaluator.

This constructor builds a multiple evaluator for an environment env, an evaluator evaluator and an optional visitor visitor. The resulting evaluator will evaluate its objects using evaluator. The visitor visitor will be used to traverse the containers used used to update the evaluator. If no visitor is specified, a default visitor will be used if it exists. If no default visitor exists, an exception of type IloException is raised.


Method Detail

update

public void update(IloContainer container) const
Updates the evaluations of the invoking evaluator.

This member function updates the evaluations stored in the invoking evaluator for each member of the container container. The member function has two behaviors depending on how the class was created. However, common to those two behaviors is the initial removal of all evaluations currently contained in the invoking evaluator.

If the class was created using the ILOMULTIPLEEVALUATOR0 macro (or one of its variants), the user-defined method of the macro is called, with container passed as argument. This user-defined method will use calls to IloExplicitEvaluator::setEvaluation to fill the evaluator.

If the class was created from an evaluator, then the visitor (or the default visitor if none was specified) will be used to traverse container. For each object visited, its evaluation will be performed by evaluator passed at construction time, and its evaluation will be stored in the invoking evaluator.