Overview | Group | Tree | Graph | Index | Concepts |
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:
IlcUnaryResource
for which a
light precedence graph
constraint has been added to the solver so that its ranking properties
will be respected and the transition time taken into account.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:
IlcActivity, IlcAltResConstraintIterator, IlcAltResSet, IlcAssign, IlcAssignAlternative, IlcPossibleAltResIterator, IlcResource, IlcTimeExtent
Constructor Summary | |
---|---|
public | IlcAltResConstraint() |
public | IlcAltResConstraint(IlcAltResConstraintI * impl) |
Method Summary | |
---|---|
public IlcActivity | getActivity() const |
public IlcAltResSet | getAltResSet() const |
public IlcInt | getCapacity() const |
public IlcInt | getCapacityMax(const IlcResource resource) const |
public IlcInt | getCapacityMin(const IlcResource resource) const |
public IlcIntVar | getCapacityVariable() const |
public IlcInt | getDurationMax(const IlcResource resource) const |
public IlcInt | getDurationMin(const IlcResource resource) const |
public IlcInt | getEndMax(const IlcResource resource) const |
public IlcInt | getEndMin(const IlcResource resource) const |
public IlcAltResConstraintI * | getImpl() const |
public IlcIntVar | getIndexVariable() const |
public IlcInt | getNumberOfPossible() const |
public IlcInt | getProcessingTimeMax(const IlcResource resource) const |
public IlcInt | getProcessingTimeMin(const IlcResource resource) const |
public IlcResourceConstraint | getResourceConstraint(const IlcResource resource) const |
public IlcCapResource | getSelected() const |
public IlcInt | getStartMax(const IlcResource resource) const |
public IlcInt | getStartMin(const IlcResource resource) const |
public IlcTimeExtent | getTimeExtent() const |
public IlcBool | isInwardConstraint() const |
public IlcBool | isPossible(const IlcResource resource) const |
public IlcBool | isProvidingConstraint() const |
public IlcBool | isResourceSelected() const |
public IlcBool | isSelected(const IlcResource resource) const |
public IlcBool | isVariableResourceConstraint() const |
public void | operator=(const IlcAltResConstraint & h) |
public void | setCapacityMax(IlcResource resource, IlcInt max) |
public void | setCapacityMin(IlcResource resource, IlcInt min) |
public void | setDurationMax(IlcResource resource, IlcInt max) |
public void | setDurationMin(IlcResource resource, IlcInt min) |
public void | setEndMax(IlcResource resource, IlcInt max) |
public void | setEndMin(IlcResource resource, IlcInt min) |
public void | setNotPossible(IlcResource resource) |
public void | setProcessingTimeMax(IlcResource resource, IlcInt max) |
public void | setProcessingTimeMin(IlcResource resource, IlcInt min) |
public void | setSelected(IlcResource resource) |
public void | setStartMax(IlcResource resource, IlcInt max) |
public void | setStartMin(IlcResource resource, IlcInt min) |
public void | whenRange(const IlcAltRCDemon g) const |
Constructor Detail |
---|
Method Detail |
---|
This member function returns the activity associated with the invoking constraint.
This member function returns the instance of IlcAltResSet
associated with the invoking constraint.
This member function returns the quantity required or provided by the activity associated with the invoking constraint.
This member function returns the maximal capacity of the invoking
alternative resource constraint assuming resource
is the
selected resource.
This member function returns the minimal capacity of the invoking
alternative resource constraint assuming resource
is the
selected resource.
This member function returns the constrained variable representing the quantity required or provided by the activity associated with the invoking constraint.
This member function returns the longest duration of the activity of the
invoking alternative resource constraint assuming resource
is
the selected resource.
This member function returns the shortest duration of the activity of the
invoking alternative resource constraint assuming resource
is
the selected resource.
This member function returns the latest end time of the activity of the
invoking alternative resource constraint assuming resource
is
the selected resource.
This member function returns the earliest end time of the activity of the
invoking alternative resource constraint assuming resource
is
the selected resource.
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.
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.
This member function returns the longest processing time for the activity
of the invoking alternative resource constraint assuming
resource
is the selected resource.
This member function returns the shortest processing time for the
activity of the invoking alternative resource constraint assuming
resource
is the selected resource.
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.
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.
This member function returns the latest start time of the activity of the
invoking alternative resource constraint assuming resource
is
the selected resource.
This member function returns the earliest start time of the activity of
the invoking alternative resource constraint assuming resource
is the selected resource.
This member function returns the time extent of the activity associated with the invoking constraint.
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).
This member function returns IlcTrue
if
resource
can be selected for the activity associated with the
invoking constraint. Otherwise, it returns IlcFalse
.
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
.
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
.
This member function returns IlcTrue
if
resource
has been selected by the invoking constraint.
Otherwise, it returns IlcFalse
.
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.
This member function states that max
is the maximal capacity
of the invoking alternative resource constraint if resource
is
the selected resource.
This member function states that min
is the minimal capacity
of the invoking alternative resource constraint if resource
is
the selected resource.
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.
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.
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.
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.
This member function states that it is not possible for
resource
to be selected.
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.
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.
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:
resource
if
resource
is in the alternative resource set (so that the invoking
constraint becomes or stays
true).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.
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.
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.