NO FRAMES

Class IloCplex::SearchLimitI

Definition file: ilocplexi.h
Include files: ilcplex/ilocplex.h

IloCplex::SearchLimitI is the base class for implementing user-defined search limits. To do so, you must subclass IloCplex::SearchLimitI and implement methods check and duplicateLimit. You may optionally implement method init. The method check must return IloTrue when the limit is reached and IloFalse otherwise. The method duplicateLimit must return a copy of the invoking object to be used in parallel search.

Whenever method check is called by IloCplex, the search limit object is first initialized to a node, referred to as the current node. Information about the current node can be queried by calling the get methods of class IloCplex::SearchLimitI.

Search limits are applied to subtrees defined by goals with method IloCplex::LimitSearch. For example:


   IloGoal limitGoal = IloCplex::LimitSearch(cplex, goal1, limit);

creates a goal limitGoal which branches as specified by goal1 until the limit specified by limit is reached. Only the nodes created by goal1 (or any of the goals created by it later) are subjected to the search limit. For example, if you created two branches with the goal


   OrGoal(limitGoal, goal2);

only the subtree defined by goal1 is subject to the search limit limit; the subtree defined by goal2 is not.

The ability to specify search limits for subtrees means that it is possible for certain branches to be subject to more than one search limit. Nodes with multiple search limits attached to them are processed only if none of the search limits has been reached, or, in other words, if all the search limits return IloFalse when method check is called by IloCplex.

Each time CPLEX uses a search limit, it is duplicated first. If you use the same instance of your limit in different branches, it will be duplicated first, the copy will be passed to the corresponding node, and init method will be called on the copy.

See Also:

Constructor and Destructor Summary
public SearchLimitI()
public ~SearchLimitI()
Method Summary
public virtual IloBoolcheck()
public virtual SearchLimitI *duplicateLimit()
public virtual voidinit()
Constructor and Destructor Detail

SearchLimitI

public SearchLimitI()

The default constructor creates a new instance of SearchLimitI.


~SearchLimitI

public ~SearchLimitI()

The virtual destructor allows you to manage you own data inside a search limit object and to delete the data when the limit is deleted.


Method Detail

check

public virtual IloBool check()

This method is called for every node subjected to the invoking search limit before evaluating the node. If it returns IloTrue, the node is pruned, or, equivalently, the search below that node is discontinued. Thus, users implementing search limits must implement this method to return IloTrue if the search limit has been reached and IloFalse otherwise.


duplicateLimit

public virtual SearchLimitI * duplicateLimit()

This method is called internally to duplicate the current search limit. Users must implement it in a subclass to return a copy of the invoking object.


init

public virtual void init()

This method is called by IloCplex right before the first time check is called for a node and allows you to initialize the limit based on that node.