FRAMES NO FRAMES

Class IlcGranularFunction

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

An instance of IlcGranularFunction holds a description of a granular step-wise function.

The granular function must respect the following properties:

These properties are checked when starting to solve the problem, and an exception will be thrown if necessary.

The positive granularity parameter is used as a scaling factor when computing the integral of the function. This allows limited representation of non-integer function values. This is particularly the case for integral expressions or constraints built with IlcGranularFunction (see Functional and Integral Constraints on Resources for more information).

When computing the integral of the function over a given interval (for example, the start and end time of an activity), the result is divided by the granularity, and the result rounded:

Four rounding modes are available when dividing by granularity. See Functional and Integral Constraints on Resources for more information.

Note that the member function IlcGranularFunction::getValue does not use the granularity, but returns the actual value stored in the function, without any scaling.

For more information, see Functional and Integral Constraints on Resources.

See Also:

Constructor Summary
public IlcGranularFunction()
public IlcGranularFunction(IlcGranularFunctionI * impl)
public IlcGranularFunction(IlcManager m, IlcInt xmin, IlcInt xmax, IlcInt granularity=1, IlcGranularFunctionRoundingMode rounding=IlcGranularFunctionRoundUpward)
Method Summary
public voidclose() const
public IlcIntgetDefinitionIntervalMax() const
public IlcIntgetDefinitionIntervalMin() const
public IlcIntgetGranularity() const
public IlcGranularFunctionI *getImpl() const
public const char *getName() const
public IlcAnygetObject() const
public IlcGranularFunctionRoundingModegetRoundingMode() const
public IloSolvergetSolver() const
public IloSolverI *getSolverI() const
public IlcIntgetValue(IlcInt x) const
public IlcBoolisClosed() const
public IlcIntExpoperator()(const IlcIntVar x) const
public voidoperator=(const IlcGranularFunction & h)
public voidsetName(const char * name) const
public voidsetObject(IlcAny object) const
public voidsetRoundingMode(IlcGranularFunctionRoundingMode rounding) const
public voidsetValue(IlcInt x1, IlcInt x2, IlcInt value) const
Constructor Detail

IlcGranularFunction

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

IlcGranularFunction

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

IlcGranularFunction

public IlcGranularFunction(IlcManager m, IlcInt xmin, IlcInt xmax, IlcInt granularity=1, IlcGranularFunctionRoundingMode rounding=IlcGranularFunctionRoundUpward)

This constructor creates a new instance of IlcGranularFunction, with granularity equal to granularity. The initial function is on the interval [xmin, xmax), and will be set to a constant initial value of granularity over this interval. The parameter rounding selects the default rounding mode applicable for an integral constraint built with this instance.


Method Detail

close

public void close() const

This member function closes the invoking function. That is, it states that the function is known so constraint propagation can proceed. This is a reversible operation. Any modification of a closed function will raise an error.


getDefinitionIntervalMax

public IlcInt getDefinitionIntervalMax() const

This member function returns the right-most point of the interval of definition of the invoking granular function.


getDefinitionIntervalMin

public IlcInt getDefinitionIntervalMin() const

This member function returns the left-most point of the interval of definition of the invoking granular function.


getGranularity

public IlcInt getGranularity() const

This member function returns the value of the granularity.


getImpl

public IlcGranularFunctionI * 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.

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.

getRoundingMode

public IlcGranularFunctionRoundingMode getRoundingMode() const

This member function returns the current rounding mode of the invoking granular function.


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.


getValue

public IlcInt getValue(IlcInt x) const

This member function returns the current value of the granular function at point x. This point must be inside the range [xmin, xmax). Otherwise, an exception is thrown.


isClosed

public IlcBool isClosed() const

This member function returns IlcTrue if the invoking object is closed. Otherwise, it returns IlcFalse.


operator()

public IlcIntExp operator()(const IlcIntVar x) const

This function creates and returns an integer expression constrained to be the value of the function at the value of variable x. The granularity of the function must be equal to 1, otherwise, an error will be raised.


operator=

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

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.

setRoundingMode

public void setRoundingMode(IlcGranularFunctionRoundingMode rounding) const

This member function selects the rounding mode that will be used when creating an integral constraint with the invoking granular function.


setValue

public void setValue(IlcInt x1, IlcInt x2, IlcInt value) const

This member function sets the value of the granular function to value over the interval [x1, x2). The IlcGranularFunction must not be closed. The arguments x1 and x2 must respect xmin <= x1 < x2 <= xmax, and value must be non-negative. Otherwise, an exception will be thrown.