FRAMES NO FRAMES

IlcRankBackward

public IlcGoal IlcRankBackward(IlcResource resource, IloSelector< IlcResourceConstraint, IlcResource > rcSel=0)
public IlcGoal IlcRankBackward(IlcSchedule schedule, IloSelector< IlcResource, IlcSchedule > rSel=0, IloSelector< IlcResourceConstraint, IlcResource > rcSel=0)
public IlcGoal IlcRankBackward(IlcSchedule schedule, IlcIntVar criterion, IloSelector< IlcResource, IlcSchedule > rSel=0, IloSelector< IlcResourceConstraint, IlcResource > rcSel=0)
Definition file: ilsched/srchgoal.h
Include file: <ilsched/ilsched.h>

This function creates and returns a goal that ranks all resource constraints on a set of resources in anti-chronological order.

 IloSelector<IlcResource,IlcSchedule> defaultResSel = IlcResourceInScheduleSelector(s);
 sel.setPredicate(IlcResourceIsUnaryResourcePredicate(s) &&
		    !IlcResourceRankedPredicate(s));
 sel.setComparator(IlcResourceGlobalSlackEvaluator(s));
 

The resource constraint selector rcSel selects the next resource constraint to be ranked last on a given resource given as first context to the selection function. By default, that is, when no IloSelector<IlcResourceConstraint> is given, a resource constraint selector defaultRCSel defined as follows is used:

 IloSelector<IlcResourceConstraint,IlcResource> defaultRCSel = IlcResourceConstraintInScheduleSelector(s);
 IlcTranslator<IlcActivity, IlcResourceConstraint> ac = IlcActivityResourceConstraintTranslator(s);
 sel.setPredicate(IlcResourceConstraintPossibleLastPredicate(s));
 sel.setComparator(IlcLexicalComposition(IlcCompareMax(IlcActivityEndMaxEvaluator(s)<<ac),
					   IlcCompareMax(IlcActivityEndMinEvaluator(s)<<ac)));
 
Note
WARNING This function assumes that all resources that are selected have been closed, that is, that no unknown resource constraints have yet to be posted. If you cannot close all resources, you should use a resource selector that selects only closed resources. In such a case, you should also handle the ranking of the resources that are not closed yourself.

Ranking is only well defined on unary and state resources. Therefore, your resource selector should contain an instance of IlcResourceIsUnaryResourcePredicate or IlcResourceIsStateResourcePredicate (or both, joined by a logical-OR).

Implementation

Here's how we could define the goal returned by the first version of the function.

 ILCGOAL2(IlcRankBackwardResource, IlcResource, resource,
 	 IloSelector<IlcResourceConstraint,IlcResource>, rcSel) {
   IlcResourceConstraint constraint;
   if (rcSel.select(constraint, resource))
     return IlcAnd(IlcTryRankLast(constraint), this);
   return 0;
 }
 

Here's how we could define the goal returned by the second version of the function:

 ILCGOAL3(IlcRankBackwardSchedule, IlcSchedule, schedule,
 	 IloSelector<IlcResource,IlcSchedule>, rSel,
 	 IloSelector<IlcResourceConstraint,IlcResource>, rcSel) {
   IlcResource resource;
   if (rSel.select(resource, schedule))
     return IlcAnd(IlcRankBackward(resource, rcSel), this);
   return 0;
 }

See IloSelector in the IBM ILOG Solver Reference Manual for more information.

See Also: