Skip to main content
PREV CLASS NEXT CLASS FRAMES NO FRAMES

 

Class IloIntervalSequenceVar

IloIntervalSequenceVar

Description:

Iterating Properties: Default behavior.

Example:
using CP;

range R = 1..3;

dvar interval tia[i in R] size i;
dvar sequence seq in tia;

subject to {
  noOverlap(seq);

  before(seq, tia[2], tia[3]);
  prev(seq, tia[1], tia[3]);
}

execute {
  writeln(seq);
  writeln(seq.first() );
  writeln(seq.next(seq.first() ) );
  writeln(seq.last() );

  writeln("loop");
  var s=seq.first();
  for(var i in R)
  {
   writeln(s);
   s=seq.next(s) ;
  }
  writeln(s);
}
After execution the Scripting log shows:
<1 0 2 2>
<1 2 3 1>
<1 3 6 3>
loop
<1 0 2 2>
<1 2 3 1>
<1 3 6 3>
null
OPL type:
dvar sequence

Property Summary
Field Attributes Field Name and Description
 
The name of the interval sequence variable.
Method Summary
Method Attributes Method Name and Description
postprocessing
first()
Provides access to an interval sequence variable.
postprocessing
last()
Provides access to an interval sequence variable.
postprocessing
next(x)
Provides access to an interval sequence variable.
postprocessing
prev(x)
Provides access to an interval sequence variable.
Property Detail
name
{string} name
The name of the interval sequence variable.
Method Detail
first
{IloIntervalVar} first()
Provides access to an interval sequence variable.
Returns:
The first interval of the interval sequence.
Available for:
postprocessing

last
{IloIntervalVar} last()
Provides access to an interval sequence variable.
Returns:
The last interval of the interval sequence.
Available for:
postprocessing

next
{IloIntervalVar} next(x)
Provides access to an interval sequence variable.
Parameters:
x - An interval variable in the sequence.
Returns:
The successor of x in the interval sequence.
Available for:
postprocessing

prev
{IloIntervalVar} prev(x)
Provides access to an interval sequence variable.
Parameters:
x - An interval variable in the sequence.
Returns:
The predecessor of x in the interval sequence.
Available for:
postprocessing

©Copyright IBM Corp. 1987-2011.