Information Technology Reference
In-Depth Information
new CtDiscreteResource(schedule, CtRequiredResource,capacity);
// To state that only 20000 is available in first 15 days
res->setCapacityMax(0,date,cap);
// To state that an operation act consumes c units of resources.
act->consumes(res, c);
CtBoolean IsUnScheduled(CtActivity* act){
// Return true if operation does not have a fixed start time.
if (act->getStartVariable()->isBound())
return CtFalse;
else
return CtTrue;
}
CtBoolean IsMoreUrgent(CtActivity* act1,
CtActivity* act2){
// Returns true if act1 is more urgent than act2.
// Returns true if act2 is not limited (==0)
if (act2 == 0)
return CtTrue;
else if (act1->getStartMax() < act2->getStartMax())
return CtTrue;
else
return CtFalse;
}
CtActivity* SelectActivity(CtSchedule* schedule){
// Returns the unscheduled activity with the smallest latest
// statrt time. Returns 0 if all activities are scheduled.
CtActivity* bestActivity = 0;
//Creates an iterator to iterate on all activities.
CtActivityIterator* iterator(schedule);
CtActivity* newActivity;
while(iterator.next(newactivity))
if((IsUnScheduled(newActivity))
&& (IsMoreUgent(newActivity, bestActivity)))
bestactivity = newActivity;
return bestActivity;
}
Search WWH ::




Custom Search