NO FRAMES

Class IloIntervalList

Definition file: ilconcert/ilointervals.h
Represents a list of nonoverlapping intervals.

An instance of the class IloIntervalList represents a list of nonoverlapping intervals. Each interval [timeMin, timeMax) from the list is associated with a numeric type.

Note that if n is the number of intervals in the list, the random access to a given interval (see the member functions IloIntervalList::addInterval, IloIntervalList::contains, and IloIntervalList::removeInterval) has a worst-case complexity in O(log(n)).

Furthermore, when two consecutive intervals of the list have the same types, these intervals are merged so that the list is always represented with the minimal number of intervals.

See Also:

Constructor Summary
public IloIntervalList(const IloEnv env, IloNum min=-IloInfinity, IloNum max=+IloInfinity, const char * name=0)
public IloIntervalList(const IloEnv env, const IloNumArray times, const IloNumArray types, const char * name=0)
Method Summary
public voidaddInterval(IloNum start, IloNum end, IloNum type=0L) const
public voidaddPeriodicInterval(IloNum start, IloNum duration, IloNum period, IloNum end, IloNum type=0L) const
public IloBoolcontains(const IloIntervalList intervals) const
public IloIntervalListcopy() const
public voiddilate(IloNum k) const
public voidempty() const
public IloNumgetDefinitionIntervalMax() const
public IloNumgetDefinitionIntervalMin() const
public IloBoolisEmpty() const
public IloBoolisKeptOpen() const
public voidkeepOpen(IloBool val=IloTrue) const
public voidremoveInterval(IloNum start, IloNum end) const
public voidremoveIntervalOnDuration(IloNum start, IloNum duration) const
public voidremovePeriodicInterval(IloNum start, IloNum duration, IloNum period, IloNum end) const
public voidsetDifference(const IloIntervalList intervals) const
public voidsetPeriodic(const IloIntervalList intervals, IloNum x0, IloNum n=IloInfinity) const
public voidsetUnion(const IloIntervalList intervals) const
public voidshift(IloNum dx) const
Constructor Detail

IloIntervalList

public IloIntervalList(const IloEnv env, IloNum min=-IloInfinity, IloNum max=+IloInfinity, const char * name=0)

This constructor creates a new instance of IloIntervalList and adds it to the set of interval lists managed in the given environment. The arguments min and max respectively represent the origin and the horizon of the interval list. The new interval list does not contain any intervals.


IloIntervalList

public IloIntervalList(const IloEnv env, const IloNumArray times, const IloNumArray types, const char * name=0)

This constructor creates an interval list whose intervals are defined by the two arrays times and types. More precisely, if n is the size of array times, then the size of array types must be n-1 and the following contiguous intervals are created on the interval list: [times[i],times[i+1]) with type types[i] for all i in [0, n-1].


Method Detail

addInterval

public void addInterval(IloNum start, IloNum end, IloNum type=0L) const

This member function adds an interval of type type to the invoking interval list. 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. Adding a new interval that overlaps with an already existing interval of a different type will override the existing type on the intersection.


addPeriodicInterval

public void addPeriodicInterval(IloNum start, IloNum duration, IloNum period, IloNum end, IloNum type=0L) const

This member function adds a set of intervals to the invoking interval list. For every i >= 0 such that start + i * period < end, an interval of [start + i * period, start + duration + i * period) is added. By default, the type of these intervals is 0. Adding a new interval that overlaps with an already existing interval of a different type will override the existing type on the intersection.


contains

public IloBool contains(const IloIntervalList intervals) const

This member function returns IloTrue if and only if each interval of intervals is included in an interval of the invoking interval list, regardless of interval type.


copy

public IloIntervalList copy() const

This member function creates and returns a new interval list that is a copy of the invoking interval list.


dilate

public void dilate(IloNum k) const

This member function multiplies by k the scale of times for the invoking interval list. k must be a positive number.


empty

public void empty() const

This member function removes all the intervals from the invoking interval list.


getDefinitionIntervalMax

public IloNum getDefinitionIntervalMax() const

This member function returns the right most point (horizon) of the definition interval of the invoking interval list.


getDefinitionIntervalMin

public IloNum getDefinitionIntervalMin() const

This member function returns the left most point (origin) of the definition interval of the invoking interval list.


isEmpty

public IloBool isEmpty() const

This member function returns IloTrue if and only if the invoking interval list is empty.


isKeptOpen

public IloBool isKeptOpen() const

This member function returns IloTrue if the interval list must be kept open. Otherwise, it returns IloFalse.


keepOpen

public void keepOpen(IloBool val=IloTrue) const

If the argument val is equal to IloTrue, this member function states that the invoking interval list must be kept open during the search for a solution to the problem. It means that additional intervals may be added during the search. Otherwise, if the argument val is equal to IloFalse, it states that all the intervals of the invoking interval list will be defined in the model before starting to solve the problem. By default, it is supposed that all the intervals of the invoking interval list are defined in the model before starting to solve the problem.


removeInterval

public void removeInterval(IloNum start, IloNum end) const

This member function removes all intervals on the invoking interval list 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).


removeIntervalOnDuration

public void removeIntervalOnDuration(IloNum start, IloNum duration) const

This member function removes all intervals on the invoking resource between start and start+duration.


removePeriodicInterval

public void removePeriodicInterval(IloNum start, IloNum duration, IloNum period, IloNum end) const

This member function removes intervals from the invoking interval list. More precisely, for every i >= 0 such that start + i * period < end, this function removes all intervals between start + i * period and start + duration + i * period.


setDifference

public void setDifference(const IloIntervalList intervals) const

This member function removes from the invoking interval list all the intervals contained in the interval list intervals. The definition interval of the invoking interval list is not changed.


setPeriodic

public void setPeriodic(const IloIntervalList intervals, IloNum x0, IloNum n=IloInfinity) const

This member function initializes the invoking interval list as an interval list that repeats the interval list intervals n times after x0.


setUnion

public void setUnion(const IloIntervalList intervals) const

This member function sets the invoking interval list to be the union between the current interval list and the interval list intervals. An instance of IloException is thrown if two intervals with different types overlap. The definition interval of the invoking interval list is set to the union between the current definition interval and the definition interval of intervals.


shift

public void shift(IloNum dx) const

This member function shifts the intervals of the invoking interval list from dx to the right if dx > 0 or from -dx to the left if dx < 0. It has no effect if dx = 0.