choco.global
Class Cumulative

java.lang.Object
  extended by choco.AbstractEntity
      extended by choco.AbstractConstraint
          extended by choco.integer.constraints.AbstractIntConstraint
              extended by choco.integer.constraints.AbstractLargeIntConstraint
                  extended by choco.global.Cumulative
All Implemented Interfaces:
Constraint, Entity, IntConstraint, IntVarEventListener, VarEventListener, Propagator, java.lang.Cloneable, java.util.EventListener

public class Cumulative
extends AbstractLargeIntConstraint

Created by IntelliJ IDEA. Author: Hadrien Date: 29 juil. 2005


Nested Class Summary
protected  class Cumulative.EndingDateComparator
           
protected  class Cumulative.Event
           
protected  class Cumulative.EventComparator
           
protected  class Cumulative.IntList
           
protected  class Cumulative.StartingDateComparator
           
 
Field Summary
protected  int capaMax
           
protected  int[] contributions
           
static boolean debug
           
protected  IntDomainVar[] durations
           
protected  java.util.Comparator endComp
           
protected  IntDomainVar[] ends
           
protected  java.util.ArrayList<Cumulative.Event> events
          first data structure of the sweep algorithm event point series : list of Event
protected  java.util.Comparator evtComp
           
protected  boolean fixPoint
           
protected  int[] heights
           
protected  int nbTask
           
protected  IntDomainVar[] starts
           
protected  java.util.Comparator stComp
           
protected  int sum_height
          data structures of the sweep algorithm sweep line status
static boolean taskInter
           
protected  Cumulative.IntList taskToPrune
           
protected  java.util.ArrayList<java.lang.Integer> Xtasks
           
protected  java.util.ArrayList<java.lang.Integer> Ytasks
           
 
Fields inherited from class choco.integer.constraints.AbstractLargeIntConstraint
cIndices, cste, vars
 
Fields inherited from class choco.integer.constraints.AbstractIntConstraint
logger
 
Fields inherited from class choco.AbstractConstraint
active, constAwakeEvent, hook, priority
 
Fields inherited from class choco.AbstractEntity
problem
 
Constructor Summary
Cumulative(IntDomainVar[] starts, IntDomainVar[] ends, IntDomainVar[] duration, int[] h, int Capa)
           
 
Method Summary
 void awakeOnBounds(int varIndex)
           
 void awakeOnInst(int idx)
          Default propagation on instantiation: full constraint re-propagation.
 void awakeOnRemovals(int idx, IntIterator deltaDomain)
          The default implementation of propagation when a variable has been modified consists in iterating all values that have been removed (the delta domain) and propagate them one after another, incrementally.
 void filter()
           
 boolean generateEvents()
           
 int getEE(int i)
          return earliest end of task i
 int getES(int i)
          return earliest start of task i
 int getLE(int i)
          return latest start of task i
 int getLS(int i)
          return latest start of task i
 void initMainIteration()
           
 java.lang.Boolean isEntailed()
          Checks whether the constraint is definitely satisfied, no matter what further restrictions occur to the domain of its variables.
 boolean isSatisfied()
          Semantic: Testing if the constraint is satisfied.
 boolean isScheduled(int i)
           
 void propagate()
          Propagates the constraint awake events.
 void prune(int low, int up)
           
 void sweep()
           
 void taskIntervals()
           
 void updateCompulsoryPart()
           
 
Methods inherited from class choco.integer.constraints.AbstractLargeIntConstraint
assignIndices, clone, getConstraintIdx, getIntVar, getNbVars, getVar, isCompletelyInstantiated, setConstraintIndex, setVar
 
Methods inherited from class choco.integer.constraints.AbstractIntConstraint
awakeOnInf, awakeOnRem, awakeOnSup, getSelfIndex, isConsistent
 
Methods inherited from class choco.AbstractConstraint
addListener, awake, awakeOnVar, connectVar, constAwake, delete, fail, getEvent, getPlugIn, getPriority, getProblem, getVarIdxInOpposite, isActive, isEquivalentTo, opposite, setActive, setEntailed, setPassive, setPlugIn, substituteVar
 
Methods inherited from class choco.AbstractEntity
pretty
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface choco.Propagator
awake, awakeOnVar, constAwake, delete, getEvent, getPlugIn, getPriority
 
Methods inherited from interface choco.prop.VarEventListener
addListener, isActive, setActive, setPassive
 
Methods inherited from interface choco.prop.VarEventListener
addListener, isActive, setActive, setPassive
 

Field Detail

debug

public static boolean debug

taskInter

public static boolean taskInter

nbTask

protected int nbTask

capaMax

protected int capaMax

events

protected java.util.ArrayList<Cumulative.Event> events
first data structure of the sweep algorithm event point series : list of Event


evtComp

protected java.util.Comparator evtComp

sum_height

protected int sum_height
data structures of the sweep algorithm sweep line status


taskToPrune

protected Cumulative.IntList taskToPrune

starts

protected IntDomainVar[] starts

ends

protected IntDomainVar[] ends

durations

protected IntDomainVar[] durations

heights

protected int[] heights

contributions

protected int[] contributions

fixPoint

protected boolean fixPoint

Xtasks

protected java.util.ArrayList<java.lang.Integer> Xtasks

stComp

protected java.util.Comparator stComp

Ytasks

protected java.util.ArrayList<java.lang.Integer> Ytasks

endComp

protected java.util.Comparator endComp
Constructor Detail

Cumulative

public Cumulative(IntDomainVar[] starts,
                  IntDomainVar[] ends,
                  IntDomainVar[] duration,
                  int[] h,
                  int Capa)
Method Detail

awakeOnBounds

public void awakeOnBounds(int varIndex)
                   throws ContradictionException
Specified by:
awakeOnBounds in interface IntConstraint
Overrides:
awakeOnBounds in class AbstractIntConstraint
Throws:
ContradictionException

awakeOnRemovals

public void awakeOnRemovals(int idx,
                            IntIterator deltaDomain)
                     throws ContradictionException
Description copied from class: AbstractIntConstraint
The default implementation of propagation when a variable has been modified consists in iterating all values that have been removed (the delta domain) and propagate them one after another, incrementally.

Specified by:
awakeOnRemovals in interface IntConstraint
Overrides:
awakeOnRemovals in class AbstractIntConstraint
Throws:
ContradictionException

awakeOnInst

public void awakeOnInst(int idx)
                 throws ContradictionException
Description copied from class: AbstractIntConstraint
Default propagation on instantiation: full constraint re-propagation.

Specified by:
awakeOnInst in interface IntVarEventListener
Overrides:
awakeOnInst in class AbstractIntConstraint
Throws:
ContradictionException

propagate

public void propagate()
               throws ContradictionException
Description copied from class: AbstractLargeIntConstraint
Propagates the constraint awake events.

Specified by:
propagate in interface Propagator
Overrides:
propagate in class AbstractLargeIntConstraint
Throws:
ContradictionException

isSatisfied

public boolean isSatisfied()
Description copied from interface: Constraint
Semantic: Testing if the constraint is satisfied. Note that all variables involved in the constraint must be instantiated when this method is called.


isEntailed

public java.lang.Boolean isEntailed()
Description copied from interface: Propagator
Checks whether the constraint is definitely satisfied, no matter what further restrictions occur to the domain of its variables.

Specified by:
isEntailed in interface Propagator
Overrides:
isEntailed in class AbstractConstraint

isScheduled

public boolean isScheduled(int i)

getES

public int getES(int i)
return earliest start of task i

Parameters:
i -

getLS

public int getLS(int i)
return latest start of task i

Parameters:
i -

getEE

public int getEE(int i)
return earliest end of task i

Parameters:
i -

getLE

public int getLE(int i)
return latest start of task i

Parameters:
i -

generateEvents

public boolean generateEvents()

initMainIteration

public void initMainIteration()

filter

public void filter()
            throws ContradictionException
Throws:
ContradictionException

sweep

public void sweep()
           throws ContradictionException
Throws:
ContradictionException

prune

public void prune(int low,
                  int up)
           throws ContradictionException
Throws:
ContradictionException

updateCompulsoryPart

public void updateCompulsoryPart()
                          throws ContradictionException
Throws:
ContradictionException

taskIntervals

public void taskIntervals()
                   throws ContradictionException
Throws:
ContradictionException