FRAMES NO FRAMES

Class IloResourceConstraint

Definition file: ilsched/iloresconstraint.h
Include file: <ilsched/iloscheduler.h>
Resource constraint.

Instances of the class IloResourceConstraint are resource constraints.

This class inherits from the IBM® ILOG® Concert Technology class IloConstraint. That class is documented in the IBM ILOG Concert Technology Reference Manual.

Instances of this class are created by these member functions:

The five elements of a resource constraint are an activity, an alternative resource set, a constant or variable demand, a time extent, and a rounding mode.

A resource constraint enforces the fact that on a certain time interval, exactly one resource from a set of alternatives that make up an instance of IloAltResSet is used to process the activity. The class IloActivity offers a set of member functions to create a resource constraint.

The demand type depends upon the resource. For example, a discrete capacity resource or a reservoir needs a positive numerical demand. The demand type for a state resource is a state or a set of states.

The time extent declares the period of time over which the availability of the resource is affected by the activity. Usually, the default value of the time extent is sufficient, since most activities will “require” a discrete capacity or a state resource from the start to the end of the activity. So in most cases, the time extent does not need to be declared. An activity can either produce or consume a reservoir.

The rounding mode tells the solver how to manage the use of the time buckets. Depending on the rounding mode, an activity that partially overlaps a time bucket is considered to either require the resource over the entire time bucket, or not require the resource during the time bucket at all.

Note that for resource constraints on continuous reservoirs, the time extent and the rounding mode have no meaning and are not used. This is because the time step of a timetable for a continuous reservoir is 1, so the returned resource constraint has no inward/outward rounding mode. Its time extent, which does not match any case of the enumeration IloTimeExtent, is not defined either.

The alternative resource set specifies the set of resources from which one resource must be selected. If the resource constraint has only one possible resource, then it requires an alternative resource set with a single element.

In order to better model interaction between activities and resources, it is possible to attach a specific calendar on a resource constraint. In such a case, the calendar of the resource constraint will subsume the calendar possibly attached to the corresponding resource. That is, even if a calendar is defined on the resource, it is not taken into account when a calendar is specified on the resource constraint.

The member functions of the class IloResourceConstraint allow retrieval of this data. In addition, the class IloResourceConstraint offers member functions to constrain the relative position of activities on the resource.

For more information, see Temporal Relations.

See Also:

Constructor Summary
public IloResourceConstraint()
public IloResourceConstraint(IloResourceConstraintI * impl)
Method Summary
public IloActivitygetActivity() const
public IloAltResSetgetAltResSet() const
public IloCalendargetCalendar() const
public IloNumgetCapacity() const
public IloNumgetCapacityMax(const IloResource resource) const
public IloNumgetCapacityMin(const IloResource resource) const
public IloNumVargetCapacityVariable() const
public IloNumgetDurationMax(const IloResource resource) const
public IloNumgetDurationMin(const IloResource resource) const
public IloNumgetEndMax(const IloResource resource) const
public IloNumgetEndMin(const IloResource resource) const
public IloResourceConstraintI *getImpl() const
public IloResourceConstraintgetNext() const
public IloNumgetProcessingTimeMax(const IloResource resource) const
public IloNumgetProcessingTimeMin(const IloResource resource) const
public IloResourcegetResource() const
public IloShapegetShape() const
public IloNumgetStartMax(const IloResource resource) const
public IloNumgetStartMin(const IloResource resource) const
public IloAnygetState() const
public IloAnySetgetStateSet() const
public IloAnySetVargetStateSetVariable() const
public IloAnyVargetStateVariable() const
public IloTimeExtentgetTimeExtent() const
public IloBoolhasAsNext(const IloResourceConstraint ct) const
public IloBoolhasCalendar() const
public IloBoolhasNext() const
public IloBoolhasShape() const
public IloBoolisCapacityConstraint() const
public IloBoolisInwardConstraint() const
public IloBoolisNegativeConstraint() const
public IloBoolisProvidingConstraint() const
public IloBoolisRejected(const IloResource resource) const
public IloBoolisSelected(const IloResource resource) const
public IloBoolisSetup() const
public IloBoolisStateConstraint() const
public IloBoolisStateSetConstraint() const
public IloBoolisSucceededBy(const IloResourceConstraint ct) const
public IloBoolisTeardown() const
public IloBoolisVariableResourceConstraint() const
public IloVariableSlopeShapemakeVariableSlopeShape(IloNumVar slope) const
public voidremoveShape() const
public IloResourceSelectionConstraintselect(const IloResource resource) const
public voidsetCalendar(IloCalendar calendar) const
public voidsetCapacityMax(const IloResource resource, IloNum max) const
public voidsetCapacityMin(const IloResource resource, IloNum min) const
public voidsetDurationMax(const IloResource resource, IloNum max) const
public voidsetDurationMin(const IloResource resource, IloNum min) const
public voidsetEndMax(const IloResource resource, IloNum max) const
public voidsetEndMin(const IloResource resource, IloNum min) const
public voidsetNext(const IloResourceConstraint ct) const
public voidsetNotNext(const IloResourceConstraint ct) const
public voidsetNotSetup() const
public voidsetNotTeardown() const
public voidsetProcessingTimeMax(const IloResource resource, IloNum max) const
public voidsetProcessingTimeMin(const IloResource resource, IloNum min) const
public voidsetRejected(const IloResource resource) const
public voidsetSelected(const IloResource resource) const
public voidsetSetup() const
public voidsetStartMax(const IloResource resource, IloNum max) const
public voidsetStartMin(const IloResource resource, IloNum min) const
public voidsetSuccessor(const IloResourceConstraint ct) const
public voidsetTeardown() const
public voidunsetNext(const IloResourceConstraint ct) const
public voidunsetSelection(const IloResource resource) const
public voidunsetSetup() const
public voidunsetSuccessor(const IloResourceConstraint ct) const
public voidunsetTeardown() const
Constructor Detail

IloResourceConstraint

public IloResourceConstraint()
This constructor creates an instance that 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.

IloResourceConstraint

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

Method Detail

getActivity

public IloActivity getActivity() const

This member function returns the activity of the invoking resource constraint.


getAltResSet

public IloAltResSet getAltResSet() const

This member function returns the instance of IloAltResSet associated with the invoking constraint. If the resource constraint was constructed with a single resource, rather than an IloAltResSet, this function returns an IloAltResSet containing only that resource. The alternative resource set, denoted ARS here, is local to the invoking resource constraint. That is, it is not shared with any other resource constraint unless a new resource constraint is subsequently as requiring ARS.


getCalendar

public IloCalendar getCalendar() const

This member function returns the calendar attached to the invoking resource constraint, if such an object exists.


getCapacity

public IloNum getCapacity() const

This member function returns the required or provided quantity of the invoking resource constraint.


getCapacityMax

public IloNum getCapacityMax(const IloResource resource) const

This member function returns the maximal required or provided quantity of the invoking resource constraint assuming resource is the selected resource.


getCapacityMin

public IloNum getCapacityMin(const IloResource resource) const

This member function returns the minimal required or provided quantity of the invoking resource constraint assuming resource is the selected resource.


getCapacityVariable

public IloNumVar getCapacityVariable() const

This member function returns the variable representing the required or provided quantity of the invoking resource constraint.


getDurationMax

public IloNum getDurationMax(const IloResource resource) const

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


getDurationMin

public IloNum getDurationMin(const IloResource resource) const

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


getEndMax

public IloNum getEndMax(const IloResource resource) const

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


getEndMin

public IloNum getEndMin(const IloResource resource) const

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


getImpl

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

getNext

public IloResourceConstraint getNext() const

This member function returns the next resource constraint that affects the availability of the resource after the invoking resource constraint.


getProcessingTimeMax

public IloNum getProcessingTimeMax(const IloResource resource) const

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


getProcessingTimeMin

public IloNum getProcessingTimeMin(const IloResource resource) const

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


getResource

public IloResource getResource() const

This member function returns the resource of the invoking resource constraint. This method throws an exception if the invoking resource constraint has an alternative resource set that does not contain exactly one element.


getShape

public IloShape getShape() const

This function returns the instance of IloShape associated with the resource constraint.


getStartMax

public IloNum getStartMax(const IloResource resource) const

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


getStartMin

public IloNum getStartMin(const IloResource resource) const

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


getState

public IloAny getState() const

This member function returns the required state of the invoking resource constraint.


getStateSet

public IloAnySet getStateSet() const

This member function returns the required set of states of the invoking resource constraint.


getStateSetVariable

public IloAnySetVar getStateSetVariable() const

This member function returns the variable representing the required set of states of the invoking resource constraint.


getStateVariable

public IloAnyVar getStateVariable() const

This member function returns the variable representing the required state of the invoking resource constraint.


getTimeExtent

public IloTimeExtent getTimeExtent() const

This member function returns the time extent of the invoking resource constraint.


hasAsNext

public IloBool hasAsNext(const IloResourceConstraint ct) const

This function returns IloTrue if and only if a next relation has been added with the member function IloResourceConstraint::setNext.


hasCalendar

public IloBool hasCalendar() const

This member function returns IloTrue if a calendar has been attached to the invoking resource constraint. Otherwise, it returns IloFalse.


hasNext

public IloBool hasNext() const

This function returns IloTrue if and only if there exists a unique resource constraint, ct, that has been constrained to be next after the invoking resource constraint with the member function IloResourceConstraint::setNext.


hasShape

public IloBool hasShape() const

This function returns IlcTrue if a shape has been associated with the resource constraint


isCapacityConstraint

public IloBool isCapacityConstraint() const

This member function returns IloTrue if and only if the invoking resource constraint indicates that a quantity (and thus not a state) is required or provided.


isInwardConstraint

public IloBool isInwardConstraint() const

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


isNegativeConstraint

public IloBool isNegativeConstraint() const

This member function returns IloTrue if and only if the invoking constraint was constructed by the member function IloActivity::requiresNot


isProvidingConstraint

public IloBool isProvidingConstraint() const

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


isRejected

public IloBool isRejected(const IloResource resource) const

This member function returns IloTrue if resource cannot be selected for the activity associated with the invoking resource constraint (see member function IloResourceConstraint::setRejected). Otherwise, it returns IloFalse.


isSelected

public IloBool isSelected(const IloResource resource) const

This member function returns IloTrue if resource must be selected by the invoking constraint (see member function IloResourceConstraint::setRejected). Otherwise, it returns IloFalse.


isSetup

public IloBool isSetup() const

This member function returns IloTrue if and only if the invoking resource constraint has been constrained to be a setup resource constraint with the member function IloResourceConstraint::setSetup.


isStateConstraint

public IloBool isStateConstraint() const

This member function returns IloTrue if and only if the invoking resource constraint indicates that a single state (and thus not a quantity or one of a set of states) is required.


isStateSetConstraint

public IloBool isStateSetConstraint() const

This member function returns IloTrue if and only if the invoking resource constraint indicates that one of a set of states (and thus not a quantity or a single state) is required.


isSucceededBy

public IloBool isSucceededBy(const IloResourceConstraint ct) const

This member function returns IloTrue if and only if a successor relation has been added with the member function IloResourceConstraint::setSuccessor.


isTeardown

public IloBool isTeardown() const

This member function returns IloTrue if and only if the invoking resource constraint has been constrained to be a teardown resource constraint with the member function IloResourceConstraint::setTeardown.


isVariableResourceConstraint

public IloBool isVariableResourceConstraint() const

This member function returns IloTrue if and only if the invoking resource constraint has a variable representing the required quantity or state or provided quantity.


makeVariableSlopeShape

public IloVariableSlopeShape makeVariableSlopeShape(IloNumVar slope) const

This function associates an instance of IloVariableSlopeShape with the resource constraint. Shapes are only available on continuous reservoirs. If the resource constraint already has a shape, that shape is discarded and replaced by the newly created one. An exception will be thrown at extraction time if the minimal value of the slope variable is strictly negative.

See Also:


removeShape

public void removeShape() const

This function removes the instance of IloShape associated with the resource constraint.


select

public IloResourceSelectionConstraint select(const IloResource resource) const

This member function creates and returns a constraint that specifies that resource must be selected for the invoking resource constraint.

The fact that a given resource r must not be selected for a resource constraint rct can be expressed by the negation of this constraint, as follows:


 model.add(!rct.select(r))

setCalendar

public void setCalendar(IloCalendar calendar) const

This member function attaches the calendar calendar to the invoking resource constraint. Notice that calendars can be shared between resource constraints, and that setCalendar does not imply that a local copy of the calendar is made. One should be aware of the fact that any change to a shared calendar (using IloCalendar member functions with the calendar that comes from getCalendar) applies to all resource constraints sharing the calendar.


setCapacityMax

public void setCapacityMax(const IloResource resource, IloNum max) const

This member function states that if resource is the selected resource, then the maximal required or provided quantity of the invoking resource constraint is max.


setCapacityMin

public void setCapacityMin(const IloResource resource, IloNum min) const

This member function states that if resource is the selected resource, then the minimal required or provided quantity of the invoking resource constraint is min.


setDurationMax

public void setDurationMax(const IloResource resource, IloNum max) const

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


setDurationMin

public void setDurationMin(const IloResource resource, IloNum min) const

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


setEndMax

public void setEndMax(const IloResource resource, IloNum max) const

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


setEndMin

public void setEndMin(const IloResource resource, IloNum min) const

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


setNext

public void setNext(const IloResourceConstraint ct) const

This member function states that if the invoking resource constraint and ct affect the same resource, then ct is next after the invoking resource constraint. There cannot exist any other resource constraint that affects the availability of the resource and starts or finishes between the end of the invoking resource constraint and the start of ct.

At extraction time if there is an empty intersection between the alternative resource set for the invoking resource constraint and the alternative resource set for ct, this function has no effect, as the condition that the two resource constraints must affect the same resource cannot be true.


setNotNext

public void setNotNext(const IloResourceConstraint ct) const

This member function states that ct is not next after the invoking resource constraint. This means that if the invoking resource constraint and ct both affect the availability of the resource, then there must be another resource constraint that affects the availability of the resource and it starts or finishes between the end of the invoking resource constraint and the start of ct.

At extraction time if there is an empty intersection between the alternative resource set for the invoking resource constraint and the alternative resource set for ct, this function has no effect, as the condition that the two resource constraints must affect the same resource cannot be true.


setNotSetup

public void setNotSetup() const

This member function states that the invoking resource constraint is not a setup resource constraint. This means that if the invoking resource constraint affects the availability of the resource, there must be a different resource constraint previous to it that also affects the availability of the resource.


setNotTeardown

public void setNotTeardown() const

This member function states that the invoking resource constraint is not a teardown resource constraint. This means that if the invoking resource affects the availability of the resource, then there must be a different resource constraint that also affects the availability of the resource and occurs after the invoking resource constraint.


setProcessingTimeMax

public void setProcessingTimeMax(const IloResource resource, IloNum max) const

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


setProcessingTimeMin

public void setProcessingTimeMin(const IloResource resource, IloNum min) const

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


setRejected

public void setRejected(const IloResource resource) const

This member function states that it is not possible for resource to be selected. If resource is not a member of the alternative resource set of the invoking resource constraint, this method has no effect.


setSelected

public void setSelected(const IloResource resource) const

This member function states that resource must be selected for the activity associated with the invoking constraint. If resource is not a member of the alternative resource set of the invoking resource constraint, this method will result in an inconsistent model. Any attempt to solve such a model will fail.


setSetup

public void setSetup() const

This member function states that the invoking resource constraint is a setup resource constraint. This means that if the invoking resource constraint affects the availability of the resource, no other resource constraint that affects the availability of the resource can be previous to it.


setStartMax

public void setStartMax(const IloResource resource, IloNum max) const

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


setStartMin

public void setStartMin(const IloResource resource, IloNum min) const

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


setSuccessor

public void setSuccessor(const IloResourceConstraint ct) const

This member function states that the invoking resource constraint has the resource constraint ct as successor. This means that if the invoking resource constraint and ct both affect the availability of the resource, then the activity of ct is constrained to execute after the activity of the invoking resource constraint.

At extraction time if there is an empty intersection between the alternative resource set for the invoking resource constraint and the alternative resource set for ct, this function has no effect, as the condition that the two resource constraints must affect the same resource cannot be true.


setTeardown

public void setTeardown() const

This member function states that the invoking resource constraint is a teardown resource constraint. This means that if the invoking resource constraint affects the availability of the resource, then no resource constraint can exist that affects the availability of the resource after the invoking resource constraint.


unsetNext

public void unsetNext(const IloResourceConstraint ct) const

This member function removes all information regarding the next relation between the invoking resource constraint and ct. That is, the information specified by both of the member functions IloResourceConstraint::setNext and IloResourceConstraint::setNotNext is removed from the model.


unsetSelection

public void unsetSelection(const IloResource resource) const

This member function states that resource is a possible resource for the activity associated with the invoking constraint, but not necessarily the one selected. This member function removes the information added to the model by the IloResourceConstraint::setSelected and IloResourceConstraint::setRejected member functions.


unsetSetup

public void unsetSetup() const

This member function removes all setup information from the invoking resource constraint. That is, this member function removes all information added to the model by the member functions IloResourceConstraint::setSetup and setNotSetup.


unsetSuccessor

public void unsetSuccessor(const IloResourceConstraint ct) const

This member function removes all information regarding the successor relation between the invoking resource constraint and ct. That is, the information specified by the member function setSuccessor(ct) is removed from the model.


unsetTeardown

public void unsetTeardown() const

This member function removes all teardown information from the invoking resource constraint. That is, this member function removes all information added to the model by the member functions IloResourceConstraint::setTeardown and setNotTeardown.