FRAMES NO FRAMES

Class IlcSchedulerTraceI

Definition file: ilsched/schedtracei.h
Include file: <ilsched/ilsched.h>

The class IlcSchedulerTraceI is the base class used to build a trace for a scheduling problem. It provides virtual methods that are called when a change occurs on a traced scheduling object, and is intended to be sub-classed by the user so that its behavior fits the user's needs.

The default behavior of all the virtual methods is to do nothing, so that one can overload only the methods one is interested in.

Tracing modifications of objects

When a modification on a traced scheduling object (see IlcSchedulerTrace) occurs, the virtual method that corresponds to this change (named xxxChange, where xxx is the type of object that changes) will be called twice: first just before the modification, then just after. The timing of a particular call (whether just before or just after the modification) is indicated by the first argument, a boolean value that equals IlcTrue if that call occurred just before the modification.

The other arguments give the context of the modification: the instance of object that is being modified, the type of change, and the value that is used to change the object (for example, the new minimum value or the value removed from the possible set).

Tracing failures

When a failure occurs, it will be traced if either of the two following conditions hold:

If a failure is traced, then one or more virtual methods of the class IlcSchedulerTraceI will be called.

Example

 class MyTraceI : public IlcSchedulerTraceI {
 public:
   MyTraceI(IlcScheduleI* schedule, const char* name=0);
   virtual ~MyTraceI() {}

   ...

 };

 int main () {

   ...

   MyTraceI* myTraceI = new (solver.getGlobalHeap())
        MyTraceI(scheduler, "MyTrace"));
   IlcSchedulerTrace myTrace(myTraceI);

   ...

 }

See Also:

Constructor and Destructor Summary
public IlcSchedulerTraceI(IlcScheduleI * schedule, const char * name=0)
Method Summary
public virtual voidactivityChange(IlcBool isBeginEvent, const IlcActivity act, IlcSchedulerChange change, IlcSolverChange solverChange, const IlcActivity act2, IlcInt val)
public virtual voidaltResConstraintChange(IlcBool isBeginEvent, const IlcAltResConstraint altResCt, IlcSchedulerChange change, IlcSolverChange solverChange, IlcInt intVal)
public virtual voidanyTimetableChange(IlcBool isBeginEvent, const IlcAnyTimetable tt, IlcSchedulerChange change, IlcInt t1, IlcInt t2, IlcAnySet anySet, IlcAny anyVal)
public virtual voidfailDemon(const IlcDemon demon)
public virtual voidfailIntSetVar(const IlcIntSetVar setVar)
public virtual voidfailIntVar(const IlcIntExp exp)
public virtual voidfailManager(IlcInt nbFails)
public IlcActivitygetCurrentActivity1() const
public IlcActivitygetCurrentActivity2() const
public IlcAltResConstraintgetCurrentAltResConstraint() const
public IlcAltResSetgetCurrentAltResSet() const
public IlcPrecedenceConstraintgetCurrentPrecedenceConstraint() const
public IlcResourcegetCurrentResource() const
public IlcResourceConstraintgetCurrentResourceConstraint1() const
public IlcResourceConstraintgetCurrentResourceConstraint2() const
public IlcTimeBoundConstraintgetCurrentTimeBoundConstraint() const
public IlcIntgetCurrentTimeMax() const
public IlcIntgetCurrentTimeMin() const
public IlcFailReasongetFailReason() const
public const char *getMessage(IlcFailReason reason) const
public const char *getMessage(IlcSolverChange chg) const
public const char *getMessage(IlcSchedulerChange chg) const
public IlcScheduleI *getScheduleI() const
public IloSolvergetSolver() const
public ILCSTD(ostream) const
public virtual voidintTimetableChange(IlcBool isBeginEvent, const IlcIntTimetable tt, IlcSchedulerChange change, IlcInt t1, IlcInt t2, IlcInt intVal)
public virtual voidprecedenceConstraintChange(IlcBool isBeginEvent, const IlcPrecedenceConstraint precCt, IlcSchedulerChange change, IlcSolverChange solverChange, IlcInt intVal)
public virtual voidresourceConstraintChange(IlcBool isBeginEvent, const IlcResourceConstraint resCt, IlcSchedulerChange change, IlcSolverChange solverChange, const IlcResourceConstraint resCt2, IlcInt intVal, IlcAny anyVal)
public virtual voidtimeBoundConstraintChange(IlcBool isBeginEvent, const IlcTimeBoundConstraint tbCt, IlcSchedulerChange change, IlcSolverChange solverChange, IlcInt intVal)
Constructor and Destructor Detail

IlcSchedulerTraceI

public IlcSchedulerTraceI(IlcScheduleI * schedule, const char * name=0)

This constructor creates a new instance of IlcSchedulerTraceI and adds it to the given schedule. It can be used to trace all objects in schedule. Its name is set to name.


Method Detail

activityChange

public virtual void activityChange(IlcBool isBeginEvent, const IlcActivity act, IlcSchedulerChange change, IlcSolverChange solverChange, const IlcActivity act2, IlcInt val)

This member function is called when a change occurs on the traced activity act. If activityChange is called just before the modification, then isBeginEvent equals IlcTrue; it equals IlcFalse if the modification has just occurred. The argument change indicates what is changed in the activity (for example, the start variable or end variable). If the change is related to an underlying Solver object (such as the start variable), then solverChange indicates how this object is changed (for example, setMin, setMax, setValue). Otherwise, this parameter equals IlcUndefinedSolverChange.

Some events (such as IlcActivitySetSuccessor) are related to two activities. In this case, act2 is a handle on this other activity. Otherwise, it is an empty handle.

When an integer Solver variable is changed, the value used (such as the new minimum) is given in val. When an activity is postponed (either forward or backward), the date from which it is postponed is given in val. Otherwise, the value of this argument is IlcIntMin.


altResConstraintChange

public virtual void altResConstraintChange(IlcBool isBeginEvent, const IlcAltResConstraint altResCt, IlcSchedulerChange change, IlcSolverChange solverChange, IlcInt intVal)

This member function is called when a change occurs on the traced alternative resource constraint altResCt. If altResConstraintChange is called just before the modification, then isBeginEvent equals IlcTrue; it equals IlcFalse if the modification has just occurred. The argument change indicates what is changed in the alternative resource constraint (for example, the index variable). If the change is related to an underlying Solver object (such as the index variable), then solverChange indicates how this object is changed (for example, setMin, setMax, setValue). Otherwise, this parameter equals IlcUndefinedSolverChange.

Some events (such as IlcResourceConstraintSetSuccessor) are related to two alternative resource constraints. In this case, resCt2 is a handle on this other alternative resource constraint. Otherwise, it is an empty handle.

When an integer Solver variable is changed, the value used (such as the new minimum) is given in intVal. Otherwise, the value of this argument is IlcIntMin.


anyTimetableChange

public virtual void anyTimetableChange(IlcBool isBeginEvent, const IlcAnyTimetable tt, IlcSchedulerChange change, IlcInt t1, IlcInt t2, IlcAnySet anySet, IlcAny anyVal)

This member function is called when a change occurs on the traced timetable tt. If resourceConstraintChange is called just before the modification, then isBeginEvent equals IlcTrue; it equals IlcFalse if the modification has just occurred. The argument change indicates what is changed in the timetable.

The parameters t1 and t2 define the interval on which the timetable is being modified.

The value used to change the timetable (for example, the set of states removed from the possible states set) is given in anySet. If the value consists of only one IlcAny, then anySet is an empty handle, and this value is given in anyVal. The value used to change the timetable (such as the value removed from the possible states set) is given in anyVal, if it is only a single state. Otherwise, this parameter equals 0 and the values are given in anySet.


failDemon

public virtual void failDemon(const IlcDemon demon)

This method is called when demon triggers a failure.


failIntSetVar

public virtual void failIntSetVar(const IlcIntSetVar setVar)

This method is called when a modification of setVar triggers a failure.


failIntVar

public virtual void failIntVar(const IlcIntExp exp)

This method is called when a modification of exp triggers a failure.


failManager

public virtual void failManager(IlcInt nbFails)

This method is called when a failure occurs. The new number of fails is nbFails.


getCurrentActivity1

public IlcActivity getCurrentActivity1() const

When a fail occurs and the activity related to the failure is known to Scheduler Engine, then this method returns this activity. Otherwise it returns an empty handle. This method must only be called when inside a call to failDemon, failIntVar, failIntSetVar or failManager.


getCurrentActivity2

public IlcActivity getCurrentActivity2() const

When a fail occurs and a second activity related to the failure is known to the Scheduler Engine (e.g. one activity is said to be next to another, and this leads to a fail), then this method returns this second activity. Otherwise it returns an empty handle. This method must only be called when inside a call to failDemon, failIntVar, failIntSetVar or failManager.


getCurrentAltResConstraint

public IlcAltResConstraint getCurrentAltResConstraint() const

When a fail occurs and an instance of IlcAltResConstraint is known to the Scheduler Engine, then this method returns this alternative resource constraint. Otherwise it returns an empty handle. This method must only be called when inside a call to failDemon, failIntVar, failIntSetVar or failManager.


getCurrentAltResSet

public IlcAltResSet getCurrentAltResSet() const

When a fail occurs and an instance of IlcAltResSet related to the failure is known to the Scheduler Engine, then this method returns this alternative resource set. Otherwise it returns an empty handle. This method must only be called when inside a call to failDemon, failIntVar, failIntSetVar or failManager.


getCurrentPrecedenceConstraint

public IlcPrecedenceConstraint getCurrentPrecedenceConstraint() const

When a fail occurs and a precedence constraint related to the failure is known to the Scheduler Engine, then this method returns this precedence constraint. Otherwise it returns an empty handle. This method must only be called when inside a call to failDemon, failIntVar, failIntSetVar or failManager.


getCurrentResource

public IlcResource getCurrentResource() const

When a fail occurs and a resource related to the failure is known to the Scheduler Engine, then this method returns this resource. Otherwise it returns an empty handle. This method must only be called when inside a call to failDemon, failIntVar, failIntSetVar or failManager.


getCurrentResourceConstraint1

public IlcResourceConstraint getCurrentResourceConstraint1() const

When a fail occurs and a resource constraint related to the failure is known to the Scheduler Engine, then this method returns this resource constraint. Otherwise it returns an empty handle. This method must only be called when inside a call to failDemon, failIntVar, failIntSetVar or failManager.


getCurrentResourceConstraint2

public IlcResourceConstraint getCurrentResourceConstraint2() const

When a fail occurs and a second resource constraint related to the failure is known to the Scheduler Engine, then this method returns this second resource constraint. Otherwise it returns an empty handle. This method must only be called when inside a call to failDemon, failIntVar, failIntSetVar or failManager.


getCurrentTimeBoundConstraint

public IlcTimeBoundConstraint getCurrentTimeBoundConstraint() const

When a fail occurs and a time bound constraint related to the failure is known to the Scheduler Engine, then this method returns this time bound constraint. Otherwise it returns an empty handle. This method must only be called when inside a call to failDemon, failIntVar, failIntSetVar or failManager.


getCurrentTimeMax

public IlcInt getCurrentTimeMax() const

When a fail occurs and the time interval related to the failure is known to the Scheduler Engine, then this method returns the upper bound of this interval. Otherwise it returns IlcIntMax. This method must only be called when inside a call to failDemon, failIntVar, failIntSetVar or failManager.


getCurrentTimeMin

public IlcInt getCurrentTimeMin() const

When a fail occurs and the time interval related to the failure is known to the Scheduler Engine, then this method returns the lower bound of this interval. Otherwise it returns IlcIntMin. This method must only be called when inside a call to failDemon, failIntVar, failIntSetVar or failManager.


getFailReason

public IlcFailReason getFailReason() const

When a fail occurs and the reason for the fail is known to the Scheduler Engine, then this method returns the reason. If the reason of the fail is unknown to the Scheduler Engine, this method will return IlcFailReasonUnknown. This method must only be called when inside a call to failDemon, failIntVar, failIntSetVar or failManager.


getMessage

public const char * getMessage(IlcSchedulerChange chg) const
public const char * getMessage(IlcFailReason reason) const
public const char * getMessage(IlcSolverChange chg) const

This member function returns a string containing the name of the change given as argument.


getScheduleI

public IlcScheduleI * getScheduleI() const

This member function returns the instance of IlcScheduleI on which the trace was built.


getSolver

public IloSolver getSolver() const

This member function returns the instance of IloSolver that is associated with the instance of IlcSchedule on which the trace was built.


ILCSTD

public ILCSTD(ostream) const

This member function returns the stream that can be used to output trace information. This is the stream that is attached to the solver.


intTimetableChange

public virtual void intTimetableChange(IlcBool isBeginEvent, const IlcIntTimetable tt, IlcSchedulerChange change, IlcInt t1, IlcInt t2, IlcInt intVal)

This member function is called when a change occurs on the traced integer timetable tt. If timeBoundConstraintChange is called just before the modification, then isBeginEvent equals IlcTrue; it equals IlcFalse if the modification has just occurred. The argument change indicates what is changed in the timetable.

The value used to change the timetable (such as the new minimum) is given by intVal. The parameters t1 and t2 define the interval on which the timetable is being modified.


precedenceConstraintChange

public virtual void precedenceConstraintChange(IlcBool isBeginEvent, const IlcPrecedenceConstraint precCt, IlcSchedulerChange change, IlcSolverChange solverChange, IlcInt intVal)

This member function is called when a change occurs on the traced precedence constraint precCt. If precedenceConstraintChange is called just before the modification, then isBeginEvent equals IlcTrue; it equals IlcFalse if the modification has just occurred. The argument change indicates what is changed in the precedence constraint (for example, the delay variable). If the change is related to an underlying Solver object (such as the delay variable), then solverChange indicates how this object is changed (for example, setMin, setMax, setValue). Otherwise, this parameter equals IlcUndefinedSolverChange.

When an integer Solver variable is changed, the value used (such as the new minimum) is given in intVal. Otherwise, the value of this argument is IlcIntMin.


resourceConstraintChange

public virtual void resourceConstraintChange(IlcBool isBeginEvent, const IlcResourceConstraint resCt, IlcSchedulerChange change, IlcSolverChange solverChange, const IlcResourceConstraint resCt2, IlcInt intVal, IlcAny anyVal)

This member function is called when a change occurs on the traced resource constraint resCt. If resourceConstraintChange is called just before the modification, then isBeginEvent equals IlcTrue; it equals IlcFalse if the modification has just occurred. The argument change indicates what is changed in the resource constraint (for example, the capacity variable). If the change is related to an underlying Solver object (such as the capacity variable), then solverChange indicates how this object is changed (for example, setMin, setMax, setValue). Otherwise, this parameter equals IlcUndefinedSolverChange.

Some events (such as IlcResourceConstraintSetSuccessor) are related to two resource constraints. In this case, resCt2 is a handle on this other resource constraint. Otherwise, it is an empty handle.

When an integer Solver variable is changed, the value used (for example, the new minimum) is given in intVal. Otherwise, this parameter equals IlcIntMin. When an IlcAnyVar is changed (such as the state required), the value used (such as the state removed) is given in anyVal. Otherwise this parameter equals 0.


timeBoundConstraintChange

public virtual void timeBoundConstraintChange(IlcBool isBeginEvent, const IlcTimeBoundConstraint tbCt, IlcSchedulerChange change, IlcSolverChange solverChange, IlcInt intVal)

This member function is called when a change occurs on the traced time bound constraint tbCt. If timeBoundConstraintChange is called just before the modification, then isBeginEvent equals IlcTrue; it equals IlcFalse if the modification has just occurred. The argument change indicates what is changed in the time bound constraint (for example, the date variable). If the change is related to an underlying Solver object (such as the date variable), then solverChange indicates how this object is changed (for example, setMin, setMax, setValue). Otherwise, this parameter equals IlcUndefinedSolverChange.

When an integer Solver variable is changed, the value used (for example, the new minimum) is given in intVal. Otherwise, this parameter equals IlcIntMin.