FRAMES NO FRAMES

Class IlcStateResource

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

An instance of the class IlcStateResource represents a resource of infinite capacity, the state of which can vary over time. Each activity may, throughout its execution, require a state resource to be in a given state (or in any of a given set of states). Consequently, two activities may not overlap if they require incompatible states during their execution. Two methods—similar to those used for discrete and unary resources—are available to take into account the constraints concerning the requirement or the provision of a state resource.

For state resources, you can define transition times with the second method.

State

In the context of an instance of IlcStateResource, a state is defined as a pointer to any type of object (that is, a pointer of type IlcAny). The class IlcAnyTimetable is used to represent the evolution of the state of the resource over time.

Printing or Displaying State Resources

The printed representation of an instance of the class IlcStateResource consists of its name, followed by a list of states. If there are more than 10 states, only the number of states is displayed.

For example:

[0x1, 0x2, 0x3] represents a state resource whose possible states are the ones represented by the pointers 0x1, 0x2, and 0x3.

[12 possible states] represents a state resource whose number of possible states is equal to 12.

If the Solver trace is active and the resource is not named, the string "IlcStateResource" is followed by the address of the implementation object. The address will be enclosed in parentheses.

Special Considerations for State Resources: Limitations of Disjunctive Constraints

Throughout this explanation, we have assumed that each activity which requires a state resource requires it in the same state (either a constant or a Solver variable) from the beginning to the end of its execution.

In addition, an activity may require a state resource in any of a given set of states, and yet allow the state to change during the execution of the activity, provided that it remains in the given set. Similarly, an activity may simply require the state resource not to be in a given state (or in any of a given set of states) throughout its execution.

A disjunctive constraint cannot manage these cases as well as a timetable.

For example, assume three activities A, B, and C intersect in time. Assume the resource constraints are as follows:

In such a case, the disjunctive constraint fails to detect the incompatibility of the three constraints because any two of these constraints are fully compatible.

In contrast, the timetable mechanism perfectly detects the incompatibility because the variable representing the state of the resource at the time at which the three activities intersect can assume no value. A disjunctive constraint may still be useful in such a case, as a redundant constraint for activities requiring only a state, or to take transition times into account.

More precisely, there are two types of resource constraints that can be posted to insist that an activity requires a state resource:

As explained before, a disjunctive constraint deals perfectly with constraints of the type requires. A disjunctive constraint deals imperfectly with constraints of the type requiresNot. Instead, a timetable is needed to deal with such constraints.

For more information, see Ranking , Disjunctive Constraint, Timetable, and Transition Time in Scheduler Engine.

See Also:

Constructor Summary
public IlcStateResource()
public IlcStateResource(IlcStateResourceI * impl)
public IlcStateResource(IlcSchedule schedule, IlcAnySet states, IlcBool timeTable=IlcTrue)
public IlcStateResource(IlcSchedule schedule, IlcAnySet states, IlcTransitionTimeObject ttobj, IlcBool disjAndTimetable=IlcTrue)
Method Summary
public IlcStateResourceI *getImpl() const
public IlcAnygetState(IlcInt time) const
public IlcAnyTimetablegetTimetable() const
public IlcAnyTimetablegetTimetable(IlcInt time) const
public IlcConstraintgetTypeTimetableConstraint() const
public IlcBoolhasTypeTimetableConstraint() const
public IlcBoolisAlwaysInUse(IlcInt timeMin, IlcInt timeMax) const
public IlcBoolisAlwaysPossible(IlcAny state, IlcInt timeMin, IlcInt timeMax) const
public IlcBoolisAlwaysRequired(IlcAny state, IlcInt timeMin, IlcInt timeMax) const
public IlcBoolisBound(IlcInt time) const
public IlcBoolisEverInUse(IlcInt timeMin, IlcInt timeMax) const
public IlcBoolisEverPossible(IlcAny state, IlcInt timeMin, IlcInt timeMax) const
public IlcBoolisEverRequired(IlcAny state, IlcInt timeMin, IlcInt timeMax) const
public IlcBoolisInUse(IlcInt time) const
public IlcBoolisPossible(IlcAny state, IlcInt time) const
public IlcBoolisRequired(IlcAny state, IlcInt time) const
public IlcConstraintmakeDisjunctiveConstraint()
public IlcConstraintmakeTimetableConstraint(IlcInt timeMin, IlcInt timeMax, IlcInt timeStep, IlcAnySet states)
public IlcConstraintmakeTimetableConstraint(IlcInt timeStep=1)
public IlcConstraintmakeTypeTimetableConstraint(IlcBool useBatch=IlcFalse)
public voidoperator=(const IlcStateResource & h)
public voidremovePossibleStates(IlcInt timeMin, IlcInt timeMax, IlcAnySet states)
public voidremoveState(IlcInt timeMin, IlcInt timeMax, IlcAny state)
public voidsetMustBeInUse(IlcInt timeMin, IlcInt timeMax)
public voidsetPossibleStates(IlcInt timeMin, IlcInt timeMax, IlcAnySet states)
public voidsetState(IlcInt timeMin, IlcInt timeMax, IlcAny state)
Inherited Methods from IlcResource
close, getCalendar, getDisjunctiveConstraint, getDurableSchedule, getImpl, getLastRankedFirstRC, getLastRankedLastRC, getLastSurelyContributingRankedFirstRC, getLastSurelyContributingRankedLastRC, getName, getObject, getOldLastRankedFirstRC, getOldLastRankedLastRC, getPrecedenceGraphConstraint, getSchedule, getSolver, getSolverI, getTimetableConstraint, getTransitionTime, hasCalendar, hasDisjunctiveConstraint, hasLightPrecedenceGraphConstraint, hasPrecedenceGraphConstraint, hasPrecedenceInfo, hasRankInfo, hasTimetableConstraint, isCapacityResource, isClosed, isContinuousReservoir, isDiscreteEnergy, isDiscreteResource, isDurable, isReservoir, isStateResource, isTransitionTimeSuspended, isUnaryResource, makeFunctionalConstraint, makeIntegralConstraint, makeLightPrecedenceGraphConstraint, makePrecedenceGraphConstraint, operator!=, operator=, operator==, setCalendar, setName, setObject, setTransitionTimeObject, setTransitionTimeSuspended, whenContribution, whenDirectPredecessors, whenDirectSuccessors, whenNext, whenPossibleNext, whenPossiblePrevious, whenPredecessors, whenPrevious, whenRankedFirstRC, whenRankedLastRC, whenSuccessors
Constructor Detail

IlcStateResource

public IlcStateResource()
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.

IlcStateResource

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

IlcStateResource

public IlcStateResource(IlcSchedule schedule, IlcAnySet states, IlcBool timeTable=IlcTrue)

This constructor creates a new instance of IlcStateResource and adds it to the set of resources managed in the given schedule. The argument states is the set of pointers that can be accepted as possible states for the resource. The argument timeTable indicates whether the standard timetable constraint manages the profile of possible states of the resource from the time origin to the time horizon of the given schedule; if so, it allows this set of possible states to change at any point in time; that is, it defines a time step of 1 (one).


IlcStateResource

public IlcStateResource(IlcSchedule schedule, IlcAnySet states, IlcTransitionTimeObject ttobj, IlcBool disjAndTimetable=IlcTrue)

This constructor creates a new instance of IlcStateResource and adds it to the set of resources managed in the given schedule. The argument states is the set of pointers that can be accepted as possible states for the resource. The argument ttobj indicates which transition time function will be used for the invoking resource. The argument disjAndTimetable indicates whether both the standard timetable constraint and the disjunctive constraint will be added to the solver.

Transition times are taken into account when the timetable or the disjunctive constraint are posted. Transition times are only propagated between two activities that are incompatible. As the disjunctive constraint defines incompatibility based on the resource demand of the activities and the type timetable constraint defines incompatibility based on the transition types of the activities, they do not propagate in the same manner. Please see Transition Time in Scheduler Engine and Type Timetable Constraint for more information.

If the argument ttobj has not been built with an instance of IlcTransitionTable, the type timetable constraint will be unable to take the transition times into account. Please see Type Timetable Constraint for more information.

The standard timetable constraint manages the profile of possible states of the resource from the time origin to the time horizon of the given schedule; it allows this set of possible states to change at any point in time; that is, it defines a time step of 1 (one).


Method Detail

getImpl

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

getState

public IlcAny getState(IlcInt time) const

This member function returns the state of the invoking resource at time.


getTimetable

public IlcAnyTimetable getTimetable() const

This member function returns the first (in chronological order) timetable of the invoking resource. An instance of IloSolver::SolverErrorException is thrown if no timetable exists for the invoking resource.


getTimetable

public IlcAnyTimetable getTimetable(IlcInt time) const

This member function returns the timetable which includes time. An instance of IloSolver::SolverErrorException is thrown if no timetable is defined at time.


getTypeTimetableConstraint

public IlcConstraint getTypeTimetableConstraint() const

This member function returns the type timetable constraint of the invoking resource.


hasTypeTimetableConstraint

public IlcBool hasTypeTimetableConstraint() const

This member function returns IlcTrue if the invoking resource has a type timetable constraint. Otherwise, it returns IlcFalse.


isAlwaysInUse

public IlcBool isAlwaysInUse(IlcInt timeMin, IlcInt timeMax) const

This member function returns IlcTrue if the resource is constantly in use over the interval [timeMin, timeMax); that is, the resource is never idle in that interval. Otherwise, it returns IlcFalse.

An instance of IloSolver::SolverErrorException is thrown if the timetables of the invoking resource do not cover the complete interval [timeMin, timeMax).


isAlwaysPossible

public IlcBool isAlwaysPossible(IlcAny state, IlcInt timeMin, IlcInt timeMax) const

This member function returns IlcTrue if and only if it is possible that the invoking resource is in the given stateover the entire interval [timeMin, timeMax). Otherwise, it returns IlcFalse.

An instance of IloSolver::SolverErrorException is thrown if the timetables of the invoking resource do not cover the complete interval [timeMin, timeMax).


isAlwaysRequired

public IlcBool isAlwaysRequired(IlcAny state, IlcInt timeMin, IlcInt timeMax) const

This member function returns IlcTrue if and only if it is certain that the invoking resource is in the given stateover the entire interval [timeMin, timeMax). Otherwise, it returns IlcFalse.

An instance of IloSolver::SolverErrorException is thrown if the timetables of the invoking resource do not cover the complete interval [timeMin, timeMax).


isBound

public IlcBool isBound(IlcInt time) const

This member function returns IlcTrue if and only if the state of the invoking resource at the given time is known. Otherwise, it returns IlcFalse.

An instance of IloSolver::SolverErrorException is thrown if the timetables of the invoking resource do not cover time.


isEverInUse

public IlcBool isEverInUse(IlcInt timeMin, IlcInt timeMax) const

This member function returns IlcTrue if the invoking resource is ever in use over the interval [timeMin, timeMax); that is, there is ever a time in the interval when the invoking resource is not idle. Otherwise, the member function returns IlcFalse.

An instance of IloSolver::SolverErrorException is thrown if the timetables of the invoking resource do not cover the complete interval [timeMin, timeMax).


isEverPossible

public IlcBool isEverPossible(IlcAny state, IlcInt timeMin, IlcInt timeMax) const

This member function returns IlcTrue if and only if it is possible that the invoking resource is in the given stateat some point in the interval [timeMin, timeMax). Otherwise, it returns IlcFalse.

An instance of IloSolver::SolverErrorException is thrown if the timetables of the invoking resource do not cover the complete interval [timeMin, timeMax).


isEverRequired

public IlcBool isEverRequired(IlcAny state, IlcInt timeMin, IlcInt timeMax) const

This member function returns IlcTrue if and only if it is certain that the invoking resource is in the given stateat some point in the interval [timeMin, timeMax). Otherwise, it returns IlcFalse.

An instance of IloSolver::SolverErrorException is thrown if the timetables of the invoking resource do not cover the complete interval [timeMin, timeMax).


isInUse

public IlcBool isInUse(IlcInt time) const

This member function returns IlcTrue if the invoking resource is in use at the time indicated by time; that is, the resource is not idle at time. Otherwise, it returns IlcFalse.

An instance of IloSolver::SolverErrorException is thrown if the timetables of the invoking resource do not cover time.


isPossible

public IlcBool isPossible(IlcAny state, IlcInt time) const

This member function returns IlcTrue if and only if it is possible that the invoking resource is in the given state at the given time. Otherwise, it returns IlcFalse.

An instance of IloSolver::SolverErrorException is thrown if the timetables of the invoking resource do not cover time.


isRequired

public IlcBool isRequired(IlcAny state, IlcInt time) const

This member function returns IlcTrue if and only if it is certain that the invoking resource is in the given state at the given time. Otherwise, it returns IlcFalse.

An instance of IloSolver::SolverErrorException is thrown if the timetables of the invoking resource do not cover time.


makeDisjunctiveConstraint

public IlcConstraint makeDisjunctiveConstraint()

This member function creates and returns the global disjunctive constraint associated with the invoking resource. For more information see Disjunctive Constraint.


makeTimetableConstraint

public IlcConstraint makeTimetableConstraint(IlcInt timeMin, IlcInt timeMax, IlcInt timeStep, IlcAnySet states)

This member function creates and returns a new timetable constraint for the invoking resource. The argument states indicates the set of possible states. From timeMin to timeMax, the state of the resource is allowed to change only at times timeMin + i * timeStep. The state must remain constant over each interval [t (t + timeStep)) with t = timeMin + i * timeStep and t at least as great as timeMin and strictly less than timeMax.

An instance of IloSolver::SolverErrorException is thrown if any of the following conditions occur:


makeTimetableConstraint

public IlcConstraint makeTimetableConstraint(IlcInt timeStep=1)

This member function creates and returns a new timetable constraint for the invoking resource. The set of possible states is given by the set passed to the IlcStateResource constructor. From the time origin timeMin to the time horizon, the state of the resource is allowed to change only at times timeMin + i * timeStep. The state must remain constant over each interval [t (t + timeStep)) with t = timeMin + i * timeStep and t at least as great as the time origin and less than the time horizon.

An instance of IloSolver::SolverErrorException is thrown if any of the following conditions occur:


makeTypeTimetableConstraint

public IlcConstraint makeTypeTimetableConstraint(IlcBool useBatch=IlcFalse)

This member function attaches a type timetable constraint to the resource and returns it.

The type timetable constraint uses the transition time object that was passed to the constructor of the invoking resource to propagate the transition times. This transition time object needs to have been built with an instance of IlcTransitionTable. An instance of IloSolver::SolverErrorException is thrown if no transition time object was passed to the constructor of the resource or if the transition time object was not built with an instance of IlcTransitionTable.


operator=

public void operator=(const IlcStateResource & 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.

removePossibleStates

public void removePossibleStates(IlcInt timeMin, IlcInt timeMax, IlcAnySet states)

This member function states that the invoking resource must not be in any of the given states at any time in the interval [timeMin, timeMax). The set of “impossible” states can be provided as an instance of IlcAnySet. That class is documented in the IBM ILOG Solver Reference Manual.

An instance of IloSolver::SolverErrorException is thrown if the timetables of the invoking resource do not cover the complete interval [timeMin, timeMax).


removeState

public void removeState(IlcInt timeMin, IlcInt timeMax, IlcAny state)

This member function states that the invoking resource must not be in the given state at any time in the interval [timeMin, timeMax).

An instance of IloSolver::SolverErrorException is thrown if the timetables of the invoking resource do not cover the complete interval [timeMin, timeMax).


setMustBeInUse

public void setMustBeInUse(IlcInt timeMin, IlcInt timeMax)

This member function states that the invoking resource must be in use and that it cannot be idle over the interval [timeMin, timeMax).

The resource must be closed to propagate.

An instance of IloSolver::SolverErrorException is thrown if the timetables of the invoking resource do not cover the complete interval [timeMin, timeMax).


setPossibleStates

public void setPossibleStates(IlcInt timeMin, IlcInt timeMax, IlcAnySet states)

This member function states that the invoking resource must be in some of the given states at all times in the interval [timeMin, timeMax). The set of possible states can be provided as an instance of IlcAnySet. That class is documented in the Solver Reference Manual.

An instance of IloSolver::SolverErrorException is thrown if the timetables of the invoking resource do not cover the complete interval [timeMin, timeMax).


setState

public void setState(IlcInt timeMin, IlcInt timeMax, IlcAny state)

This member function states that the invoking resource must be in the given state at all times in the interval [timeMin, timeMax).

An instance of IloSolver::SolverErrorException is thrown if the timetable of the invoking resource does not cover the complete interval [timeMin, timeMax).