Overview | Group | Tree | Graph | Index | Concepts |
An instance of the class IlcAltResSet
represents a special
set of resources to which activities can be assigned. When an
activity requires an instance of this class, the activity requires exactly
one of the resources represented in that set. For convenience, an instance
of IlcAltResSet
behaves like a standard resource. To that end,
the class includes member functions that reproduce the properties and
behavior of a standard resource.
The set of resources (the alternatives) must consist of capacity
resources (that is, instances of IlcDiscreteEnergy
, IlcDiscreteResource
, IlcUnaryResource
, or IlcReservoir
).
Each resource in the set must be unique.
In case the elements of the set of alternative resources do not conform to these rules, an error will be raised when the set is constructed.
If you change the resources in the set during its use, you will produce unpredictable behavior; in fact, such changes may lead to erroneous behavior.
Redundant Resources
It is possible to consider the set of resources as a resource whose theoretical capacity is the sum of the capacities of the resources of the set. Let us call this resource the redundant resource of the set.
An alternative resource constraint on the set is a resource constraint on this redundant resource. Therefore, posting the timetable constraint or the edge finder constraint on the redundant resource may lead to more efficient propagation. Global and resource constraints on the redundant resource have exactly the same purpose as a redundant constraint in a Solver model.
Notice that if the resources of the set are instances of IlcUnaryResource
and if they have strictly identical
properties (the activities have the same processing time, do not require any
other resources, and there is no transition time), the redundant resource
gives exactly the same solution as the alternative resource. In such a case,
it is more efficient to represent the set of unary resources with a single
discrete resource rather than with a alternative resource set.
Printing or Displaying Sets of Resources
The printed representation of an instance of the class
IlcAltResSet
consists of its name, followed by the list of
resources. If there are more than 10 resources, only the number of resources
is displayed. For example:
[r1, r2, r3]
represents a set of resources containing the
three resources r1
, r2
, and r3
.
[size = 14]
represents a set of resources containing 14
resources.
If the Solver trace is active and the resource is not named, the string
"IlcAltResSet
" is followed by the address of the
implementation object. The address will be enclosed in parentheses.
See Also:
IlcAltResConstraint, IlcAltResSetIterator, IlcAssignAlternative, IlcDiscreteResource, IlcReservoir, IlcResource, IlcSchedule, IlcUnaryResource
Constructor Summary | |
---|---|
public | IlcAltResSet() |
public | IlcAltResSet(IlcAltResSetI * impl) |
public | IlcAltResSet(IlcSchedule schedule, IlcInt size) |
public | IlcAltResSet(IlcSchedule schedule, IlcResourceArray array) |
Method Summary | |
---|---|
public void | close() |
public IlcBool | contains(const IlcResource resource) const |
public IlcAltResSetI * | getImpl() const |
public IlcInt | getIndex(const IlcResource resource) const |
public const char * | getName() const |
public IlcAny | getObject() const |
public IlcCapResource | getRedundantResource() const |
public IlcSchedule | getSchedule() const |
public IlcInt | getSize() const |
public IloSolver | getSolver() const |
public IloSolverI * | getSolverI() const |
public IlcBool | hasRedundantResource() const |
public IlcBool | isClosed() const |
public void | makeRedundantResource(IlcBool timetable=IlcFalse) |
public IlcBool | operator!=(const IlcAltResSet & resource) const |
public void | operator=(const IlcAltResSet & h) |
public IlcBool | operator==(const IlcAltResSet & resource) const |
public IlcResource & | operator[](IlcInt index) |
public void | setFilled() |
public void | setName(const char * name) const |
public void | setObject(IlcAny object) const |
Constructor Detail |
---|
This constructor creates a new instance of IlcAltResSet
and
adds it to those managed by schedule
. The size of the set (that
is, the number of alternative capacity resources) is indicated by
size
. Before you use the new instance, you must initialize its
set with instances of capacity resources.
This constructor creates a new instance of IlcAltResSet
and adds it
to those managed by schedule
. The constructor initializes the set
with the resources of the resource array passed as argument.
Method Detail |
---|
This member function closes the invoking object; that is, it closes
all the resources present in the invoking instance of
IlcAltResSet
.
This member function returns IlcTrue
if
resource
belongs to the invoking instance of
IlcAltResSet
. Otherwise, it returns IlcFalse
.
This member function returns the index of resource
in the
invoking alternative capacity resource set.
This member function returns the redundant resource of the invoking set, if it has been previously created.
This member function returns the schedule to which the invoking instance
of IlcAltResSet
belongs. Each alternative resource in the set
belongs to the same schedule, an instance of IlcSchedule
.
This member function returns the number of alternative capacity resources
in the invoking instance of IlcAltResSet
.
This member function returns an instance of IloSolver
associated with the invoking object.
This member function returns a pointer to the implementation object of the solver where the invoking object was extracted.
This member function returns IlcTrue
if the redundant
resource of the invoking set has been created. Otherwise, it returns
IlcFalse
.
This member function returns IlcTrue
if all of the
capacity resources in the set of the invoking instance of
IlcAltResSet
have been closed. The member function returns
IlcFalse
otherwise.
This member function builds the redundant resource associated with the
invoking alternative resources set. When the redundant resource is created,
the resource constraints on the resources of the set and the alternative
resource constraints of the set are automatically added to the redundant
resource. If the argument timetable
is set to
IlcTrue
, the timetable constraint is added to the redundant
resource.
This operator returns IlcTrue
if the invoking instance
and the argument resource are not identical; that is,
they are handles of different implementation objects. Otherwise,
it returns IlcFalse
.
This operator returns IlcTrue
if the
invoking instance and the argument resource are identical;
that is, they are both handles with the same implementation object.
Otherwise, it returns IlcFalse
.
This operator returns a reference to the resource located at
index
in the invoking alternative resource set.
The call to this member function confirms that all alternative resources were added to the invoking alternative resource set. After calling this member function, no resources can be added to the set.
The use of this member function is mandatory only for alternative resource sets constructed on durable schedules.