Class IntervalVar
- java.lang.Object
-
- com.google.ortools.constraintsolver.BaseObject
-
- com.google.ortools.constraintsolver.PropagationBaseObject
-
- com.google.ortools.constraintsolver.IntervalVar
-
public class IntervalVar extends PropagationBaseObject
Interval variables are often used in scheduling. The main characteristics
of an IntervalVar are the start position, duration, and end
date. All these characteristics can be queried and set, and demons can
be posted on their modifications.
An important aspect is optionality: an IntervalVar can be performed or not.
If unperformed, then it simply does not exist, and its characteristics
cannot be accessed any more. An interval var is automatically marked
as unperformed when it is not consistent anymore (start greater
than end, duration < 0...)
-
-
Field Summary
-
Fields inherited from class com.google.ortools.constraintsolver.BaseObject
swigCMemOwn
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedIntervalVar(long cPtr, boolean cMemoryOwn)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(ModelVisitor visitor)Accepts the given visitor.booleancannotBePerformed()voiddelete()IntExprdurationExpr()longdurationMax()longdurationMin()These methods query, set, and watch the duration of the interval var.IntExprendExpr()longendMax()longendMin()These methods query, set, and watch the end position of the interval var.protected voidfinalize()protected static longgetCPtr(IntervalVar obj)static longgetKMaxValidValue()The largest acceptable value to be returned by EndMax()static longgetKMinValidValue()The smallest acceptable value to be returned by StartMin()booleanisPerformedBound()booleanmayBePerformed()booleanmustBePerformed()These methods query, set, and watch the performed status of the
interval var.longoldDurationMax()longoldDurationMin()longoldEndMax()longoldEndMin()longoldStartMax()longoldStartMin()IntExprperformedExpr()IntExprsafeDurationExpr(long unperformed_value)IntExprsafeEndExpr(long unperformed_value)IntExprsafeStartExpr(long unperformed_value)These methods create expressions encapsulating the start, end
and duration of the interval var.voidsetDurationMax(long m)voidsetDurationMin(long m)voidsetDurationRange(long mi, long ma)voidsetEndMax(long m)voidsetEndMin(long m)voidsetEndRange(long mi, long ma)voidsetPerformed(boolean val)voidsetStartMax(long m)voidsetStartMin(long m)voidsetStartRange(long mi, long ma)IntExprstartExpr()These methods create expressions encapsulating the start, end
and duration of the interval var.longstartMax()longstartMin()These methods query, set, and watch the start position of the
interval var.protected static longswigRelease(IntervalVar obj)booleanwasPerformedBound()voidwhenAnything(Demon d)Attaches a demon awakened when anything about this interval changes.voidwhenAnything(java.lang.Runnable closure)Attaches a closure awakened when anything about this interval changes.voidwhenDurationBound(Demon d)voidwhenDurationBound(java.lang.Runnable closure)voidwhenDurationRange(Demon d)voidwhenDurationRange(java.lang.Runnable closure)voidwhenEndBound(Demon d)voidwhenEndBound(java.lang.Runnable closure)voidwhenEndRange(Demon d)voidwhenEndRange(java.lang.Runnable closure)voidwhenPerformedBound(Demon d)voidwhenPerformedBound(java.lang.Runnable closure)voidwhenStartBound(Demon d)voidwhenStartBound(java.lang.Runnable closure)voidwhenStartRange(Demon d)voidwhenStartRange(java.lang.Runnable closure)-
Methods inherited from class com.google.ortools.constraintsolver.PropagationBaseObject
baseName, enqueueDelayedDemon, enqueueVar, freezeQueue, getCPtr, hasName, name, reset_action_on_fail, set_variable_to_clean_on_fail, setName, solver, swigRelease, toString, unfreezeQueue
-
Methods inherited from class com.google.ortools.constraintsolver.BaseObject
getCPtr, swigRelease
-
-
-
-
Method Detail
-
getCPtr
protected static long getCPtr(IntervalVar obj)
-
swigRelease
protected static long swigRelease(IntervalVar obj)
-
finalize
protected void finalize()
- Overrides:
finalizein classPropagationBaseObject
-
delete
public void delete()
- Overrides:
deletein classPropagationBaseObject
-
getKMinValidValue
public static long getKMinValidValue()
The smallest acceptable value to be returned by StartMin()
-
getKMaxValidValue
public static long getKMaxValidValue()
The largest acceptable value to be returned by EndMax()
-
startMin
public long startMin()
These methods query, set, and watch the start position of the
interval var.
-
startMax
public long startMax()
-
setStartMin
public void setStartMin(long m)
-
setStartMax
public void setStartMax(long m)
-
setStartRange
public void setStartRange(long mi, long ma)
-
oldStartMin
public long oldStartMin()
-
oldStartMax
public long oldStartMax()
-
whenStartRange
public void whenStartRange(Demon d)
-
whenStartRange
public void whenStartRange(java.lang.Runnable closure)
-
whenStartBound
public void whenStartBound(Demon d)
-
whenStartBound
public void whenStartBound(java.lang.Runnable closure)
-
durationMin
public long durationMin()
These methods query, set, and watch the duration of the interval var.
-
durationMax
public long durationMax()
-
setDurationMin
public void setDurationMin(long m)
-
setDurationMax
public void setDurationMax(long m)
-
setDurationRange
public void setDurationRange(long mi, long ma)
-
oldDurationMin
public long oldDurationMin()
-
oldDurationMax
public long oldDurationMax()
-
whenDurationRange
public void whenDurationRange(Demon d)
-
whenDurationRange
public void whenDurationRange(java.lang.Runnable closure)
-
whenDurationBound
public void whenDurationBound(Demon d)
-
whenDurationBound
public void whenDurationBound(java.lang.Runnable closure)
-
endMin
public long endMin()
These methods query, set, and watch the end position of the interval var.
-
endMax
public long endMax()
-
setEndMin
public void setEndMin(long m)
-
setEndMax
public void setEndMax(long m)
-
setEndRange
public void setEndRange(long mi, long ma)
-
oldEndMin
public long oldEndMin()
-
oldEndMax
public long oldEndMax()
-
whenEndRange
public void whenEndRange(Demon d)
-
whenEndRange
public void whenEndRange(java.lang.Runnable closure)
-
whenEndBound
public void whenEndBound(Demon d)
-
whenEndBound
public void whenEndBound(java.lang.Runnable closure)
-
mustBePerformed
public boolean mustBePerformed()
These methods query, set, and watch the performed status of the
interval var.
-
mayBePerformed
public boolean mayBePerformed()
-
cannotBePerformed
public boolean cannotBePerformed()
-
isPerformedBound
public boolean isPerformedBound()
-
setPerformed
public void setPerformed(boolean val)
-
wasPerformedBound
public boolean wasPerformedBound()
-
whenPerformedBound
public void whenPerformedBound(Demon d)
-
whenPerformedBound
public void whenPerformedBound(java.lang.Runnable closure)
-
whenAnything
public void whenAnything(Demon d)
Attaches a demon awakened when anything about this interval changes.
-
whenAnything
public void whenAnything(java.lang.Runnable closure)
Attaches a closure awakened when anything about this interval changes.
-
startExpr
public IntExpr startExpr()
These methods create expressions encapsulating the start, end
and duration of the interval var. Please note that these must not
be used if the interval var is unperformed.
-
durationExpr
public IntExpr durationExpr()
-
endExpr
public IntExpr endExpr()
-
performedExpr
public IntExpr performedExpr()
-
safeStartExpr
public IntExpr safeStartExpr(long unperformed_value)
These methods create expressions encapsulating the start, end
and duration of the interval var. If the interval var is
unperformed, they will return the unperformed_value.
-
safeDurationExpr
public IntExpr safeDurationExpr(long unperformed_value)
-
safeEndExpr
public IntExpr safeEndExpr(long unperformed_value)
-
accept
public void accept(ModelVisitor visitor)
Accepts the given visitor.
-
-