Overview | Group | Tree | Graph | Index | Concepts |
During the search, an instance of this class traverses the activities that are such that a precedence constraint holds between this activity and the activity given in the constructor of the iterator. If used before entering the search, this iterator will traverse an empty list of activities.
This class of iterators does not distinguish among the precedence
constraints created by means of the member functions IlcActivity::startsAfterStart
, IlcActivity::startsAfterEnd
, IlcActivity::endsAfterStart
, IlcActivity::endsAfterEnd
,
IlcActivity::startsAtStart
,
IlcActivity::startsAtEnd
, IlcActivity::endsAtStart
,
IlcActivity::endsAtEnd
. Whichever of those
member functions is used to create the precedence constraint, the invoking
activity is identified as the one that is constrained to occur after the
activity passed as an argument to the member function. Likewise, the
activity passed as an argument to the member function is identified as the
one that is constrained to occur before the invoking activity. See the
Example which follows for a program that illustrates that idea.
The order in which activities are seen by the iterator is platform-dependent and thus is not predictable.
Example
Must be during search (e.g., inside a goal) IloSolver solver = getSolver(); IlcScheduler schedule(solver, 0, 20); IlcActivity A(schedule, 5); A.setName("A"); IlcActivity B(schedule, 5); B.setName("B"); IlcActivity C(schedule, 5); C.setName("C"); solver.add(A.startsAtEnd(C)); solver.add(B.endsAtStart(C)); solver.add(A.startsAfterEnd(B, 2)); solver.out() << "Preceding A:" << endl; for(IlcPrecedingActivityIterator precedingActivityIterator(A); precedingActivityIterator.ok(); ++precedingActivityIterator) solver.out() << " " << *precedingActivityIterator << endl; solver.out() << "Following C:" << endl; for (IlcFollowingActivityIterator followingActivityIterator(C); followingActivityIterator.ok(); ++followingActivityIterator) solver.out() << " " << *followingActivityIterator << endl;
See Also:
IlcActivity, IlcPrecedenceConstraint, IlcPrecedingActivityIterator
Constructor and Destructor Summary | |
---|---|
public | IlcFollowingActivityIterator(IlcActivity activity, IlcResourceConstraintIteratorFilter filter=IlcAllConstraints) |
Method Summary | |
---|---|
public IlcPrecedenceConstraint | getPrecedenceConstraint() const |
public IlcBool | ok() const |
public IlcActivity | operator*() const |
public IlcFollowingActivityIterator & | operator++() |
Constructor and Destructor Detail |
---|
This constructor creates an iterator to traverse all the activities
constrained to follow activity
.
Method Detail |
---|
This member function returns the precedence constraint between the activity used by the constructor of the invoking iterator and the activity at its current position.
This member function returns IlcTrue
if the current position
of the iterator is a valid one. It returns IlcFalse
if all the
activities have been scanned by the iterator.
This operator accesses the instance of IlcActivity
located at the current position of the iterator.
If the iterator is set past the end position, this operator returns an empty
handle.
This operator shifts the current position of the iterator.