Overview | Group | Tree | Graph | Index | Concepts |
An instance of IloGranularFunction
holds the description of
granular step-wise functions.
The granular function must respect the following properties:
[xmin,xmax)
, and takes only integer values.
xmax-xmin
of its definition interval must be less than the largest
integer value that can be represented by the machine's integer
representation.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:
IloResource, IloGranularFunctionRoundingMode
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 IloNum | getDefinitionIntervalMax() const |
public IloNum | getDefinitionIntervalMin() const |
public IloNum | getGranularity() const |
public IloGranularFunctionI * | getImpl() const |
public IloGranularFunctionRoundingMode | getRoundingMode() const |
public IloNum | getValue(IloNum x) const |
public void | setRoundingMode(IloGranularFunctionRoundingMode rounding=IloGranularFunctionRoundUpward) const |
public void | setValue(IloNum x1, IloNum x2, IloNum value) const |
Inner Class |
---|
IloGranularFunction::Cursor |
Constructor Detail |
---|
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 |
---|
This member function returns the right-most point of the interval of definition of the invoking granular function.
This member function returns the left-most point of the interval of definition of the invoking granular function.
This member function returns the value of the granularity.
This member function returns the current rounding mode of the invoking granular function.
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.
This member function selects the rounding mode that will be used when creating an integral constraint with the invoking granular function.
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.