Overview | Group | Tree | Graph | Index | Concepts |
An instance of the class IlcIntervalList
represents a list of
non-overlapping intervals. Each interval [timeMin, timeMax)
from the list is associated with a numerical type.
Such time intervals can be used, for instance, to represent breaks or shifts. As each interval can be associated with an integer type, some specific behaviors can be defined on activities (ignore shift or break interval, break interval possibly overlapped, and so forth).
Break and shift intervals can be attached to a calendar and then
associated with resources and resource constraints
(see IlcCalendar
).
Printing or Displaying Lists of Intervals
The printed representation of an instance of the class
IlcIntervalList
consists of its name, followed by the first
chronological interval and the last interval. For example:
<[20->40)
. . .[70->80)>
represents
a list of intervals whose first interval occurs in the time interval [20
40)
and whose last interval occurs in the time interval [70
80)
.
If the Solver trace is active and the resource is not named, the string
"IlcIntervalList"
is followed by the address of the implementation
object. The address will be enclosed in parentheses.
For more information, see Calendars.
See Also:
Constructor Summary | |
---|---|
public | IlcIntervalList() |
public | IlcIntervalList(IlcIntervalListI * impl) |
public | IlcIntervalList(const IlcSchedule schedule) |
Method Summary | |
---|---|
public void | addInterval(IlcInt start, IlcInt end, IlcInt type=OL) |
public void | addIntervalOnDuration(IlcInt start, IlcInt duration, IlcInt type=OL) |
public void | addPeriodicInterval(IlcInt start, IlcInt duration, IlcInt period) |
public void | addPeriodicInterval(IlcInt start, IlcInt duration, IlcInt period, IlcInt end, IlcInt type=0L) |
public void | close() |
public IlcIntervalListI * | getImpl() const |
public const char * | getName() const |
public IlcAny | getObject() const |
public IloSolver | getSolver() const |
public IloSolverI * | getSolverI() const |
public IlcBool | isClosed() const |
public IlcBool | isEmpty() const |
public void | open() |
public void | operator=(const IlcIntervalList & h) |
public void | removeInterval(IlcInt start, IlcInt end) |
public void | removeIntervalOnDuration(IlcInt start, IlcInt duration) |
public void | removePeriodicInterval(IlcInt start, IlcInt duration, IlcInt period, IlcInt end) |
public void | removePeriodicInterval(IlcInt start, IlcInt duration, IlcInt period) |
public void | setName(const char * name) const |
public void | setObject(IlcAny object) const |
Constructor Detail |
---|
This constructor creates a new instance of IlcIntervalList
and
adds it to the set of interval lists managed by the given schedule
. That newly
constructed list of intervals is initially empty.
Method Detail |
---|
This member function adds an interval of type type
to the
invoking list of intervals. The start time and end time of that newly added
interval are set to start
and end
. By default, the
type of the interval is 0.
An interval can be added to the interval list as long as it is not closed. The effect of this function is reversible.
Any attempt to add a new interval that overlaps with an already existing interval of a different type raises an error.
This member function adds an interval of type type
to the
invoking list of intervals. The start time of the newly added interval is
start
; its end time is start
+
duration
. By default, the type of the interval is 0.
An interval can be added to the interval list as long as it is not closed. The effect of this function is reversible.
Any attempt to add a new interval that overlaps with an already existing interval of a different type raises an error.
This member function adds a set of intervals of type 0 to the invoking list
of intervals. For every i >= 0
such that start + i *
period < horizon
, an interval [start + i * period, start +
duration + i * period)
is added. horizon
is the
time horizon of the schedule that was given as an argument to the
constructor of the invoking list of intervals. A periodic interval can be added to
the interval list as long as it is not closed. The effect of this function is
reversible.
Any attempt to add a new periodic interval that overlaps with an already existing interval of a different type raises an error.
This member function adds a set of intervals to the invoking list of intervals.
For every i >= 0
such that start + i * period
< end
, an interval [start + i * period, start + duration + i *
period)
is added. By default, the type of the interval is 0.
A periodic interval can be added to the interval list as long as it is not closed. The effect of these functions is reversible.
Any attempt to add a new interval that overlaps with an already existing interval of a different type raises an error.
This member function closes the interval list, which means that intervals can no longer be added or removed. The Scheduler Engine uses this knowledge to perform extra propagation. Closing an already closed interval list has no effect. This function is reversible.
Example
The following piece of code illustrates the extra propagation when a break list is closed.
//Must be during search (e.g., inside a goal) IloSolver solver = getSolver(); IlcScheduler schedule(solver,0,100); IlcUnaryResource res(schedule); IlcCalendar cal(schedule); IlcIntervalList bl(schedule); cal.setBreakList(bl); res.setCalendar(cal); IlcActivity act(schedule, 20, IlcTrue); solver.add(act.requires(res)); solver.add(act.startsAt(10)); solver.out() << act << endl; // [10 -- (20) 20..90 --> 30..100] bl.addInterval(20,50); solver.out() << act << endl; // [10 -- (20) 50..90 --> 60..100] bl.close(); solver.out() << act << endl; // [10 -- (20) 50 --> 60]
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 IlcTrue
if the invoking interval
list is closed. Otherwise, it returns IlcFalse
.
This member function returns IlcTrue
if the invoking interval
list is empty. Otherwise, it returns IlcFalse
.
This member function opens an interval list so that it is possible to add or remove intervals on it. Opening an already opened interval list has no effect.
This member function is available only outside the search. Trying to open an interval list in search raises an error.
This member function removes all intervals between start
and
end
. If start
is placed inside an interval
[start1, end1)
, that is, start1 < start <
end1
, this results in an interval [start1, start)
. If end
is
placed inside an interval [start2, end2)
this results in an interval
[end, end2)
. The interval list must be open. Trying to remove an
interval during the search or from a closed interval list raises an error.
This member function is available only outside the search.
This member function removes all intervals between start
and
start
+
duration
. The interval list must
be open. Trying to remove an interval during the search or from a closed interval
list raises an error.
This member function is available only outside the search.
These member functions remove intervals from the invoking interval list.
More precisely, for every i >= 0
such that start + i * period < end
,
these functions remove all intervals between start + i * period
and
start + duration + i * period
.
The invoking interval list must be open. Trying to remove a periodic
interval during the search or from a closed interval list raises an error.
This member function is available only outside the search.
These member functions remove intervals from the invoking interval list.
More precisely, for every i >= 0
such that start + i * period < horizon
,
these functions remove all intervals between start + i * period
and
start + duration + i * period
. horizon
is the time horizon of the
schedule that was given as an argument to the constructor of the invoking list.
The invoking interval list must be open. Trying to remove a periodic
interval during the search or from a closed interval list raises an error.
This member function is available only outside the search.