FRAMES NO FRAMES

Class IlcSearchSelectorI

Definition file: ilsolver/search.h
Include file: <ilsolver/ilosolver.h>

The class IlcSearchSelector represents search selectors internally in the Solver search. The class IloSearchSelector represents search selectors in a Concert Technology model. Search selectors are useful as filters during a Solver search.

A search selector is an object in Solver. Like other Solver entities, a search selector is implemented by means of two classes: a handle class and an implementation class. In other words, an instance of the class IlcSearchSelector (a handle) contains a data member (the handle pointer) that points to an instance of the class IlcSearchSelectorI (its implementation object).

A search selector has several purposes:

A search selector has its own life cycle. To be used internally, it has to be cloned by the duplicate member function.

See Also:

Constructor and Destructor Summary
public IlcSearchSelectorI(IloSolver solver, IlcBool duplicate)
public ~IlcSearchSelectorI()
Method Summary
public voidactivateNode(IloSolver solver, IlcSearchNode n)
public voidcloseNode(IlcSearchNode n)
public virtual IlcSearchSelectorI *duplicateSelector(IloSolver solver)
public virtual IlcFloatevaluate(const IlcSearchNode node) const
public IlcSearchNodegetCurrentNode(IloSolver solver)
public virtual IlcBoolisFeasible(IlcFloat eval) const
public voidsaveObjectiveValue(IloSolver solver, IloNum newVal)
public virtual voidupdateObjective(IloSolver solver)
public virtual voidupdateObjectiveTo(IloSolver solver, IloNum newVal)
public virtual voidwhenFinishedTree(IloSolver solver, IlcBool toKill)
public virtual voidwhenLeaf(IloSolver solver)
Constructor and Destructor Detail

IlcSearchSelectorI

public IlcSearchSelectorI(IloSolver solver, IlcBool duplicate)

This constructor creates an instance of the class IlcSearchSelectorI using the solver. The parameter duplicate indicates whether the object is an internal copy used by the solver (duplicate = IlcTrue), or if it is just a template. This constructor should not be called directly as this class is an abstract class. This constructor is called automatically in the constructor of its subclasses.


~IlcSearchSelectorI

public ~IlcSearchSelectorI()

This destructor is called automatically by the destructor of its subclasses. It frees memory used by the objects.


Method Detail

activateNode

public void activateNode(IloSolver solver, IlcSearchNode n)

This member function should be called only from within the whenFinished member function. It indicates that this node n is in fact selected (which is the purpose of the IlcSelectSearch function).


closeNode

public void closeNode(IlcSearchNode n)

This member function deletes a node n obtained with the getCurrentNode member function.


duplicateSelector

public virtual IlcSearchSelectorI * duplicateSelector(IloSolver solver)

This member function is called internally to duplicate the current search selector. When you use this member function, the duplicate parameter in the IlcSearchSelectorI constructor should be equal to IlcTrue.


evaluate

public virtual IlcFloat evaluate(const IlcSearchNode node) const

This member function evaluates the node given as a parameter. This evaluation will be used by the isFeasible member function. Its purpose is to prune nodes before the solver jumps to them.

When you implement this virtual member function yourself, you should make sure that your implementation is independent of the state of the solver (the instance of IloSolver where the invoking search selector is working). The signature of this member function includes const for that reason to avoid accumulated effects of multiple calls of this member function.


getCurrentNode

public IlcSearchNode getCurrentNode(IloSolver solver)

This member function returns a copy of the current search node. It should be called only from the registerSolution member function. To discard a node obtained by this member function, you must use the closeNode member function.


isFeasible

public virtual IlcBool isFeasible(IlcFloat eval) const

This member function uses the eval parameter which comes from the evaluate member function. A return value of IlcFalse indicates that it is safe to discard this node and not to evaluate it. The return value IlcTrue indicates that the node will be kept.

When you implement this virtual member function yourself, you should make sure that your implementation is independent of the state of the solver (the instance of IloSolver where the invoking search selector is working). The signature of this member function includes const for that reason to avoid accumulated effects of multiple calls of this member function.


saveObjectiveValue

public void saveObjectiveValue(IloSolver solver, IloNum newVal)

This member function is called by the solver when it arrives at a leaf of the search tree associated with the goal given as a parameter to the IlcSelectSearch function. It may use the member functions getCurrentNode and closeNode.


updateObjective

public virtual void updateObjective(IloSolver solver)

This member function is used to implement a minimization process. It checks whether a better upper bound on the objective is known. If this is the case, it adds the corresponding constraint and saves the information using the saveObjectiveValue member function.


updateObjectiveTo

public virtual void updateObjectiveTo(IloSolver solver, IloNum newVal)

This member function is called during recomputation. It adds the same constraint as was posted by the update member function. The parameter newVal is the one which was saved by the saveObjectiveValue member function.


whenFinishedTree

public virtual void whenFinishedTree(IloSolver solver, IlcBool toKill)

This member function is called by the solver when it has completely explored the search tree associated with the goal given as a parameter to the IlcSelectSearch function. It may use the member functions closeNode and activateNode.

The expected behavior depends on the parameter toKill. If toKill is equal to IlcFalse (which is the usual case), the search selector proceeds normally. If toKill is equal to IlcTrue, the search selector must not activate any of the stored nodes, but must kill them all using the closeNode member function.


whenLeaf

public virtual void whenLeaf(IloSolver solver)

This member function is called by the solver when it arrives at a leaf of the search tree associated with the goal given as a parameter to the IlcSelectSearch function. It may use the member functions getCurrentNode and closeNode.