This method assumes that state function f is fixed. It returns the number of segments of the state function f.

Namespace: ILOG.CP
Assembly: ILOG.CP (in ILOG.CP.dll)

Syntax

C#
public int GetNumberOfSegments(
	IStateFunction f
)
Visual Basic
Public Function GetNumberOfSegments ( _
	f As IStateFunction _
) As Integer

Remarks

A segment is an interval [start, end) on which the value of f is constant. If the state function is not defined, the value is CP.NoState, elsewhere the value is a non-negative integer. An assertion is violated if state function f is not fixed.

This method can be used to print the content of a state function as illustrated by the following code sample.

Examples

for (int i=0; i < cp.GetNumberOfSegments(f); ++i) Console.WriteLine("[" + cp.GetSegmentStart(f, i) + "," + cp.GetSegmentEnd(f, i) + "):" + cp.GetSegmentValue(f, i) );

For more information on state function see the concept State Functions in the C++ Reference Manual.

See Also