FRAMES NO FRAMES

Class IloGranularFunction

Definition file: ilsched/ilogfbase.h
Include file: <ilsched/iloscheduler.h>

An instance of IloGranularFunction holds the description of granular step-wise functions.

The granular function must respect the following properties:

These properties are checked at extraction time, and an exception will be thrown if necessary.

The positive granularity parameter is optionally 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 IloGranularFunction (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 then rounded:

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

Four rounding modes are available when dividing by granularity. Refer to Functional and Integral Constraints on Resources for a detailed description of each rounding mode.

See Also:

Constructor Summary
public IloGranularFunction()
public IloGranularFunction(IloGranularFunctionI * impl)
public IloGranularFunction(const IloEnv env, IloNum xmin, IloNum xmax, IloNum granularity=1.0, const char * name=0)
Method Summary
public IloNumgetDefinitionIntervalMax() const
public IloNumgetDefinitionIntervalMin() const
public IloNumgetGranularity() const
public IloGranularFunctionI *getImpl() const
public IloGranularFunctionRoundingModegetRoundingMode() const
public IloNumgetValue(IloNum x) const
public voidsetRoundingMode(IloGranularFunctionRoundingMode rounding=IloGranularFunctionRoundUpward) const
public voidsetValue(IloNum x1, IloNum x2, IloNum value) const
Inner Class
IloGranularFunction::Cursor
Constructor Detail

IloGranularFunction

public IloGranularFunction()
This constructor creates an instance that 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.

IloGranularFunction

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

IloGranularFunction

public IloGranularFunction(const IloEnv env, IloNum xmin, IloNum xmax, IloNum granularity=1.0, const char * name=0)

This constructor creates a new instance of IloGranularFunction, with granularity equal to granularity. The initial function is on the interval [xmin, xmax), and is set to a constant initial value of granularity over this interval.


Method Detail

getDefinitionIntervalMax

public IloNum getDefinitionIntervalMax() const

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


getDefinitionIntervalMin

public IloNum getDefinitionIntervalMin() const

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


getGranularity

public IloNum getGranularity() const

This member function returns the value of the granularity.


getImpl

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

getRoundingMode

public IloGranularFunctionRoundingMode getRoundingMode() const

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


getValue

public IloNum getValue(IloNum 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.


setRoundingMode

public void setRoundingMode(IloGranularFunctionRoundingMode rounding=IloGranularFunctionRoundUpward) 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(IloNum x1, IloNum x2, IloNum value) const

This member function sets the value of the granular function to value over the interval [x1, x2). x1 and x2 must respect xmin <= x1 < x2 <= xmax, or an exception will be thrown.

In addition, the granular function must respect the properties listed in the Introduction to this class.