FRAMES NO FRAMES

IlcRank

public IlcGoal IlcRank(IlcResource resource, IloSelector< IlcResourceConstraint, IlcResource > rcSel=0)
public IlcGoal IlcRank(IlcSchedule schedule, IloSelector< IlcResource, IlcSchedule > rSel=0, IloSelector< IlcResourceConstraint, IlcResource > rcSel=0)
public IlcGoal IlcRank(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 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 first on a given resource given as first context to the selection function. By default, that is, when no IloSelector<IlcResourceConstraint,IlcResource> 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(IlcResourceConstraintPossibleFirstPredicate(s));
 sel.setComparator(IlcLexicalComposition(IlcCompareMin(IlcActivityStartMinEvaluator(s)<<ac),
					   IlcCompareMin(IlcActivityStartMaxEvaluator(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(IlcRankResource, IlcResource, resource,
 	    IloSelector<IlcResourceConstraint,IlcResource>, rcSel) {
   IlcResourceConstraint constraint;
   if (rcSel.select(constraint, resource))
     return IlcAnd(IlcTryRankFirst(constraint), this);
   return 0;
 }
 

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

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

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

See Also: