We use the following code, depending on the traceLevel
parameter, to add marked objects to our instance of IlcSchedulerPrintTrace
.
If traceLevel
is 0, we iterate over all the activities to find those that are marked. They are added to the trace object with the method trace(IlcActivity)
.
// Trace only some specific activities
for (IlcActivityIterator it(scheduler); it.ok(); ++it) {
IlcActivity act = *it;
if (act.getObject() == (IloAny)1) {
trace.trace(act);
}
}
|
If traceLevel
is 1, we iterate over all the resources to find those that are marked. They are added to the trace object with the method trace(IlcResource)
. Its effect is that all the activities that require the resource will be traced.
// We trace only the activities that require a specific resource
for (IlcResourceIterator it(scheduler); it.ok(); ++it) {
IlcResource res = *it;
if (res.getObject() == (IloAny)1) {
trace.trace(res);
}
}
|
And finally, if traceLevel
is 2, we want to trace all the activities in the problem. This is achieved simply by using the method traceAllActivities
.
// Tracing all activities in the problem
trace.traceAllActivities();
|