Overview | Group | Tree | Graph | Index | Concepts |
An instance of IlcGranularFunction
holds a description of a
granular step-wise function.
The granular function must respect the following properties:
[xmin,xmax)
, and takes only integer values.xmax-xmin
of its definition interval must remain in the range
[0,IlcIntMax)
, in order to not overflow the platform integer
representation.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:
IlcResource, IlcFunctionalExp, IlcActivityIntegralExp, IlcGranularFunctionRoundingMode
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 void | close() const |
public IlcInt | getDefinitionIntervalMax() const |
public IlcInt | getDefinitionIntervalMin() const |
public IlcInt | getGranularity() const |
public IlcGranularFunctionI * | getImpl() const |
public const char * | getName() const |
public IlcAny | getObject() const |
public IlcGranularFunctionRoundingMode | getRoundingMode() const |
public IloSolver | getSolver() const |
public IloSolverI * | getSolverI() const |
public IlcInt | getValue(IlcInt x) const |
public IlcBool | isClosed() const |
public IlcIntExp | operator()(const IlcIntVar x) const |
public void | operator=(const IlcGranularFunction & h) |
public void | setName(const char * name) const |
public void | setObject(IlcAny object) const |
public void | setRoundingMode(IlcGranularFunctionRoundingMode rounding) const |
public void | setValue(IlcInt x1, IlcInt x2, IlcInt value) const |
Constructor Detail |
---|
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 |
---|
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.
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 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 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 returns IlcTrue
if the invoking object
is closed. Otherwise, it returns IlcFalse
.
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.
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)
. 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.