FRAMES NO FRAMES

Class IlcAltResSet

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

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:

Constructor Summary
public IlcAltResSet()
public IlcAltResSet(IlcAltResSetI * impl)
public IlcAltResSet(IlcSchedule schedule, IlcInt size)
public IlcAltResSet(IlcSchedule schedule, IlcResourceArray array)
Method Summary
public voidclose()
public IlcBoolcontains(const IlcResource resource) const
public IlcAltResSetI *getImpl() const
public IlcIntgetIndex(const IlcResource resource) const
public const char *getName() const
public IlcAnygetObject() const
public IlcCapResourcegetRedundantResource() const
public IlcSchedulegetSchedule() const
public IlcIntgetSize() const
public IloSolvergetSolver() const
public IloSolverI *getSolverI() const
public IlcBoolhasRedundantResource() const
public IlcBoolisClosed() const
public voidmakeRedundantResource(IlcBool timetable=IlcFalse)
public IlcBooloperator!=(const IlcAltResSet & resource) const
public voidoperator=(const IlcAltResSet & h)
public IlcBooloperator==(const IlcAltResSet & resource) const
public IlcResource &operator[](IlcInt index)
public voidsetFilled()
public voidsetName(const char * name) const
public voidsetObject(IlcAny object) const
Constructor Detail

IlcAltResSet

public IlcAltResSet()
This constructor creates an empty handle. You must initialize it before you use it.

IlcAltResSet

public IlcAltResSet(IlcAltResSetI * impl)
This constructor creates a handle object from a pointer to an implementation object.

IlcAltResSet

public IlcAltResSet(IlcSchedule schedule, IlcInt size)

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.


IlcAltResSet

public IlcAltResSet(IlcSchedule schedule, IlcResourceArray array)

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

close

public void close()

This member function closes the invoking object; that is, it closes all the resources present in the invoking instance of IlcAltResSet.


contains

public IlcBool contains(const IlcResource resource) const

This member function returns IlcTrue if resource belongs to the invoking instance of IlcAltResSet. Otherwise, it returns IlcFalse.


getImpl

public IlcAltResSetI * getImpl() const
This constructor creates an object by copying another one. This constructor creates an object by copying another one. This member function returns a pointer to the implementation object of the invoking handle.

getIndex

public IlcInt getIndex(const IlcResource resource) const

This member function returns the index of resource in the invoking alternative capacity resource set.


getName

public const char * getName() const
This member function returns the name of the invoking object.

getObject

public IlcAny getObject() const
This member function returns a pointer to the external object associated with the invoking object, if there is such an association. It returns 0 (zero) otherwise.

getRedundantResource

public IlcCapResource getRedundantResource() const

This member function returns the redundant resource of the invoking set, if it has been previously created.


getSchedule

public IlcSchedule getSchedule() const

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.


getSize

public IlcInt getSize() const

This member function returns the number of alternative capacity resources in the invoking instance of IlcAltResSet.


getSolver

public IloSolver getSolver() const

This member function returns an instance of IloSolver associated with the invoking object.


getSolverI

public IloSolverI * getSolverI() const

This member function returns a pointer to the implementation object of the solver where the invoking object was extracted.


hasRedundantResource

public IlcBool hasRedundantResource() const

This member function returns IlcTrue if the redundant resource of the invoking set has been created. Otherwise, it returns IlcFalse.


isClosed

public IlcBool isClosed() const

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.


makeRedundantResource

public void makeRedundantResource(IlcBool timetable=IlcFalse)

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.


operator!=

public IlcBool operator!=(const IlcAltResSet & resource) const

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.


operator=

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

operator==

public IlcBool operator==(const IlcAltResSet & resource) const

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.


operator[]

public IlcResource & operator[](IlcInt index)

This operator returns a reference to the resource located at index in the invoking alternative resource set.


setFilled

public void setFilled()

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.


setName

public void setName(const char * name) const
This member function sets the name of the invoking object to a copy of name. This assignment is a reversible action.

setObject

public void setObject(IlcAny object) const
This member function establishes a link between the invoking object and an external object of which the invoking object might be a data member.