FRAMES NO FRAMES

Class IlcAltResConstraint

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

An instance of the class IlcAltResConstraint expresses the fact that an activity uses exactly one resource from a set of alternatives that make up an instance of IlcAltResSet.

Instances of the class IlcAltResConstraint are created by member functions of the class IlcActivity:

An Exclusive Constructive Disjunctive Constraint

We call an instance of IlcAltResConstraint a disjunctive constraint because it defines a boolean disjunction so that only one alternative among a set of alternative resources is used to execute the activity.

We say that it is a constructive disjunction because the Scheduler Engine makes deductions on the basis of the constraint as it goes along to propagate further and more efficiently than modeling with the logical or Solver metaconstraints. Scheduler Engine maintains the temporal and demand bounds of the activity for each possible resource.

We also say that an instance of IlcAltResConstraint is exclusive because one and only one resource among the alternatives will be used by an activity.

Index Variable

A Solver variable indexing the resources of the set of alternative resources is provided. It is intended to add constraints between the selected resource. Let N be the number of resources in the set, an instance of class IlcAltResSet. The index variable is created with a domain <0, N>.

The values in <0, N-1> index the resources. The value N is an escape value in the case of no resource selection. This last value is used in the metaconstraint protocol to express the fact that the instance of IlcAltResConstraint is false. When the alternative resource constraint is posted (and therefore must be true), this escape value is automatically removed from the domain of the index variable.

Selection and Solution Search

An alternative resource constraint behaves very much like an ordinary resource constraint as far as an activity is concerned. The alternative resource constraint manages the set of possible resources for the activity, treating them so that they behave as one resource from the point of view of the activity. The domains of the start, end, and duration variables of the activity contain any value that is allowed for at least one of the possible resources of the activity.

When one resource is selected, the associated resource constraint is added. Once a resource has been selected, the other resources are no longer possible. If, for some of them, resource constraints had already been created, the capacity of these resource constraints is reduced to zero.

To make the search for a solution efficient, it is a good idea to select a resource for an activity for which a set of alternative resources is defined when you schedule it.

Metaconstraint Protocol

IlcAltResConstraint is fully compatible with the metaconstraint protocol of Solver. Stating that an instance of IlcAltResConstraint is false is conventionally the same as stating that the set of resources is not used by the activity.

Resource Constraints

The resource constraint of a possible resource is automatically created:

If need be, you can create the resource constraint of a possible resource. To do so, you use the member function IlcAltResConstraint::getResourceConstraint.

For more information, see Metaconstraints.

See Also:

Constructor Summary
public IlcAltResConstraint()
public IlcAltResConstraint(IlcAltResConstraintI * impl)
Method Summary
public IlcActivitygetActivity() const
public IlcAltResSetgetAltResSet() const
public IlcIntgetCapacity() const
public IlcIntgetCapacityMax(const IlcResource resource) const
public IlcIntgetCapacityMin(const IlcResource resource) const
public IlcIntVargetCapacityVariable() const
public IlcIntgetDurationMax(const IlcResource resource) const
public IlcIntgetDurationMin(const IlcResource resource) const
public IlcIntgetEndMax(const IlcResource resource) const
public IlcIntgetEndMin(const IlcResource resource) const
public IlcAltResConstraintI *getImpl() const
public IlcIntVargetIndexVariable() const
public IlcIntgetNumberOfPossible() const
public IlcIntgetProcessingTimeMax(const IlcResource resource) const
public IlcIntgetProcessingTimeMin(const IlcResource resource) const
public IlcResourceConstraintgetResourceConstraint(const IlcResource resource) const
public IlcCapResourcegetSelected() const
public IlcIntgetStartMax(const IlcResource resource) const
public IlcIntgetStartMin(const IlcResource resource) const
public IlcTimeExtentgetTimeExtent() const
public IlcBoolisInwardConstraint() const
public IlcBoolisPossible(const IlcResource resource) const
public IlcBoolisProvidingConstraint() const
public IlcBoolisResourceSelected() const
public IlcBoolisSelected(const IlcResource resource) const
public IlcBoolisVariableResourceConstraint() const
public voidoperator=(const IlcAltResConstraint & h)
public voidsetCapacityMax(IlcResource resource, IlcInt max)
public voidsetCapacityMin(IlcResource resource, IlcInt min)
public voidsetDurationMax(IlcResource resource, IlcInt max)
public voidsetDurationMin(IlcResource resource, IlcInt min)
public voidsetEndMax(IlcResource resource, IlcInt max)
public voidsetEndMin(IlcResource resource, IlcInt min)
public voidsetNotPossible(IlcResource resource)
public voidsetProcessingTimeMax(IlcResource resource, IlcInt max)
public voidsetProcessingTimeMin(IlcResource resource, IlcInt min)
public voidsetSelected(IlcResource resource)
public voidsetStartMax(IlcResource resource, IlcInt max)
public voidsetStartMin(IlcResource resource, IlcInt min)
public voidwhenRange(const IlcAltRCDemon g) const
Constructor Detail

IlcAltResConstraint

public IlcAltResConstraint()
This constructor creates an instance which is empty, that is, one whose handle pointer is null. You must assign it a value before you access it. Any attempt to access it before assignment leads to undefined behaviour.

IlcAltResConstraint

public IlcAltResConstraint(IlcAltResConstraintI * impl)
This constructor creates an instance of the handle class from the pointer to an instance of the implementation class.

Method Detail

getActivity

public IlcActivity getActivity() const

This member function returns the activity associated with the invoking constraint.


getAltResSet

public IlcAltResSet getAltResSet() const

This member function returns the instance of IlcAltResSet associated with the invoking constraint.


getCapacity

public IlcInt getCapacity() const

This member function returns the quantity required or provided by the activity associated with the invoking constraint.


getCapacityMax

public IlcInt getCapacityMax(const IlcResource resource) const

This member function returns the maximal capacity of the invoking alternative resource constraint assuming resource is the selected resource.


getCapacityMin

public IlcInt getCapacityMin(const IlcResource resource) const

This member function returns the minimal capacity of the invoking alternative resource constraint assuming resource is the selected resource.


getCapacityVariable

public IlcIntVar getCapacityVariable() const

This member function returns the constrained variable representing the quantity required or provided by the activity associated with the invoking constraint.


getDurationMax

public IlcInt getDurationMax(const IlcResource resource) const

This member function returns the longest duration of the activity of the invoking alternative resource constraint assuming resource is the selected resource.


getDurationMin

public IlcInt getDurationMin(const IlcResource resource) const

This member function returns the shortest duration of the activity of the invoking alternative resource constraint assuming resource is the selected resource.


getEndMax

public IlcInt getEndMax(const IlcResource resource) const

This member function returns the latest end time of the activity of the invoking alternative resource constraint assuming resource is the selected resource.


getEndMin

public IlcInt getEndMin(const IlcResource resource) const

This member function returns the earliest end time of the activity of the invoking alternative resource constraint assuming resource is the selected resource.


getImpl

public IlcAltResConstraintI * getImpl() const
This member function returns a pointer to the implementation object of the invoking handle.

getIndexVariable

public IlcIntVar getIndexVariable() const

This member function returns the variable that contains the indices of all the possible resources for the invoking constraint. The indices correspond to the indices of the resources in the instance of the class IlcAltResSet for which the invoking constraint was defined.


getNumberOfPossible

public IlcInt getNumberOfPossible() const

This member function returns the number of possible resources that could be selected for the activity associated with the invoking constraint. It returns 1 (one) if a resource has already been selected.


getProcessingTimeMax

public IlcInt getProcessingTimeMax(const IlcResource resource) const

This member function returns the longest processing time for the activity of the invoking alternative resource constraint assuming resource is the selected resource.


getProcessingTimeMin

public IlcInt getProcessingTimeMin(const IlcResource resource) const

This member function returns the shortest processing time for the activity of the invoking alternative resource constraint assuming resource is the selected resource.


getResourceConstraint

public IlcResourceConstraint getResourceConstraint(const IlcResource resource) const

This member function returns the resource constraint associated with resource in the invoking alternative resource constraint. If resource is possible but not yet selected, the minimal capacity of the resource constraint is set to 0 (zero). If resource is not possible, the maximal capacity of the resource constraint is set to 0 (zero), implying that the resource constraint does not use resource at all. The resource constraint is automatically added to the solver if resource is possible.


getSelected

public IlcCapResource getSelected() const

This member function returns the resource that has been selected for the activity associated with the invoking constraint. An instance of IloSolver::SolverErrorException is thrown if no resource has been selected.


getStartMax

public IlcInt getStartMax(const IlcResource resource) const

This member function returns the latest start time of the activity of the invoking alternative resource constraint assuming resource is the selected resource.


getStartMin

public IlcInt getStartMin(const IlcResource resource) const

This member function returns the earliest start time of the activity of the invoking alternative resource constraint assuming resource is the selected resource.


getTimeExtent

public IlcTimeExtent getTimeExtent() const

This member function returns the time extent of the activity associated with the invoking constraint.


isInwardConstraint

public IlcBool isInwardConstraint() const

This member function returns IlcTrue if and only if the occupancy of the selected resource by the invoking constraint is to be rounded inward toward the nearest valid time that corresponds to a time step. This rounding is important only when one of the timetables of the selected resource has a time step greater than 1 (one).


isPossible

public IlcBool isPossible(const IlcResource resource) const

This member function returns IlcTrue if resource can be selected for the activity associated with the invoking constraint. Otherwise, it returns IlcFalse.


isProvidingConstraint

public IlcBool isProvidingConstraint() const

This member function returns IlcTrue if and only if the invoking constraint was constructed by one of these member functions:IlcActivity::provides or IlcActivity::produces.


isResourceSelected

public IlcBool isResourceSelected() const

This member function returns IlcTrue if the activity associated with the invoking constraint has selected a resource as the only possible one. Otherwise, it returns IlcFalse.


isSelected

public IlcBool isSelected(const IlcResource resource) const

This member function returns IlcTrue if resource has been selected by the invoking constraint. Otherwise, it returns IlcFalse.


isVariableResourceConstraint

public IlcBool isVariableResourceConstraint() const

This member function returns IlcTrue if and only if the activity associated with the invoking constraint has a variable representing the required or provided quantity.


operator=

public void operator=(const IlcAltResConstraint & h)
This operator assigns an address to the handle pointer of the invoking object. That address is the location of the implementation object of the provided argument. After execution of this operator, the invoking object and the provided argument point to the same implementation object.

setCapacityMax

public void setCapacityMax(IlcResource resource, IlcInt max)

This member function states that max is the maximal capacity of the invoking alternative resource constraint if resource is the selected resource.


setCapacityMin

public void setCapacityMin(IlcResource resource, IlcInt min)

This member function states that min is the minimal capacity of the invoking alternative resource constraint if resource is the selected resource.


setDurationMax

public void setDurationMax(IlcResource resource, IlcInt max)

This member function states that max is the longest duration of the activity of the invoking alternative resource constraint if resource is the selected resource.


setDurationMin

public void setDurationMin(IlcResource resource, IlcInt min)

This member function states that min is the shortest duration of the activity of the invoking alternative resource constraint if resource is the selected resource.


setEndMax

public void setEndMax(IlcResource resource, IlcInt max)

This member function states that max is the latest end time of the activity of the invoking alternative resource constraint if resource is the selected resource.


setEndMin

public void setEndMin(IlcResource resource, IlcInt min)

This member function states that min is the earliest end time of the activity of the invoking alternative resource constraint if resource is the selected resource.


setNotPossible

public void setNotPossible(IlcResource resource)

This member function states that it is not possible for resource to be selected.


setProcessingTimeMax

public void setProcessingTimeMax(IlcResource resource, IlcInt max)

This member function states that max is the longest processing time for the activity of the invoking alternative resource constraint if resource is the selected resource.


setProcessingTimeMin

public void setProcessingTimeMin(IlcResource resource, IlcInt min)

This member function states that min is the shortest processing time for the activity of the invoking alternative resource constraint if resource is the selected resource.


setSelected

public void setSelected(IlcResource resource)

This member function states that resource has been selected for the activity associated with the invoking constraint. More precisely, it sets (if possible) the value of the index variable to:


setStartMax

public void setStartMax(IlcResource resource, IlcInt max)

This member function states that max is the latest start time of the activity of the invoking alternative resource constraint if resource is the selected resource.


setStartMin

public void setStartMin(IlcResource resource, IlcInt min)

This member function states that min is the earliest start time of the activity of the invoking alternative resource constraint if resource is the selected resource.


whenRange

public void whenRange(const IlcAltRCDemon g) const

This member function associates the demon g with the By Resource Domain propagation event of an alternative resource constraint. The demon is an instance of the class IlcAltRCDemon designed for this purpose. Whenever the propagation of the start, end, duration, processing time, and capacity range with respect to a possible resource occurs, the demon g is executed. Please refer to the Macro ILCALTRCDEMON for full information and an example.