choco.cp.solver.constraints.global.automata.fast_multicostregular
Class SoftMultiCostRegular

java.lang.Object
  extended by choco.kernel.solver.propagation.Propagator
      extended by choco.kernel.solver.constraints.AbstractSConstraint<IntDomainVar>
          extended by choco.kernel.solver.constraints.integer.AbstractIntSConstraint
              extended by choco.kernel.solver.constraints.integer.AbstractLargeIntSConstraint
                  extended by choco.cp.solver.constraints.global.automata.fast_multicostregular.SoftMultiCostRegular
All Implemented Interfaces:
IExtensionnable, IPretty, SConstraint<IntDomainVar>, IntPropagator, Cloneable, EventListener

public class SoftMultiCostRegular
extends AbstractLargeIntSConstraint

Created by IntelliJ IDEA. User: julien Date: Apr 27, 2010 Time: 11:04:12 AM


Field Summary
 int[] lastLp
          The last computed Longest Path
 double lastLpValue
           
 int[] lastSp
          The last computed Shortest Path
 double lastSpValue
           
 gnu.trove.TObjectIntHashMap<IntDomainVar> map
          Map to retrieve rapidly the index of a given variable.
protected  gnu.trove.TIntStack toRemove
          Stack to store removed edges index, for delayed update
protected  gnu.trove.TIntStack[] toUpdateLeft
           
protected  gnu.trove.TIntStack[] toUpdateRight
           
 
Fields inherited from class choco.kernel.solver.constraints.AbstractSConstraint
cIndices, constraintType, extensions, vars
 
Fields inherited from class choco.kernel.solver.propagation.Propagator
active, constAwakeEvent, priority, propagationEngine
 
Fields inherited from interface choco.kernel.solver.constraints.SConstraint
LOGGER
 
Constructor Summary
SoftMultiCostRegular(IntDomainVar[] x, IntDomainVar[] y, IntDomainVar[] z, IntDomainVar Z, int[] indexes, IPenaltyFunction[] f, IAutomaton pi, int[][][][] costs, CPSolver solver)
           
 
Method Summary
 void awake()
          Propagation: Propagating the constraint for the very first time until local consistency is reached.
 void awakeOnInf(int idx)
          Default propagation on improved lower bound: propagation on domain revision.
 void awakeOnInst(int idx)
          Default propagation on instantiation: full constraint re-propagation.
 void awakeOnRem(int idx, int val)
          Default propagation on one value removal: propagation on domain revision.
 void awakeOnSup(int idx)
          Default propagation on improved upper bound: propagation on domain revision.
 void boundChange(int idx)
           
 boolean check()
           
 boolean check(int[] word)
           
 void checkWorld()
           
protected  boolean delayedGraphUpdate()
          Updates the graphs w.r.t. the caught event during event-based propagation
 int getFilteredEventMask(int idx)
           
 SoftStoredMultiValuedDirectedMultiGraph getGraph()
           
 double[] getInstantiatedLayerCosts(int layer)
           
 int[] getMinMaxPathCostForAssignment(int col, int val, int... resources)
           
 int getMinPathCost(int... resources)
           
 int getMinPathCostForAssignment(int col, int val, int... resources)
           
 void initGraph()
           
 boolean isSatisfied(int[] tuple)
          TEMPORARY: if not overriden by the constraint, throws an error to avoid bug using reified constraints in constraints that have not been changed to fulfill this api yet !
 void makeTableConstraints()
           
 boolean needPropagation()
           
 void propagate()
          Propagation: Propagating the constraint until local consistency is reached.
 boolean updateViolationLB()
           
 boolean updateViolationUB()
           
 
Methods inherited from class choco.kernel.solver.constraints.integer.AbstractIntSConstraint
awakeOnBounds, awakeOnRemovals, getConstraintType, isConsistent, isSatisfied
 
Methods inherited from class choco.kernel.solver.constraints.AbstractSConstraint
addExtension, addListener, clone, getAbstractSConstraintExtensionNumber, getConstraintIdx, getExtension, getFineDegree, getNbVarNotInst, getNbVars, getVar, getVarQuick, isCompletelyInstantiated, isEntailed, opposite, pretty, setConstraintIndex, setExtension, setVar, toString
 
Methods inherited from class choco.kernel.solver.propagation.Propagator
activate, constAwake, fail, getEvent, getPriority, isActive, setActive, setActiveSilently, setEntailed, setPassive, setPropagationEngine
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

map

public final gnu.trove.TObjectIntHashMap<IntDomainVar> map
Map to retrieve rapidly the index of a given variable.


lastSp

public int[] lastSp
The last computed Shortest Path


lastSpValue

public double lastSpValue

lastLp

public int[] lastLp
The last computed Longest Path


lastLpValue

public double lastLpValue

toRemove

protected final gnu.trove.TIntStack toRemove
Stack to store removed edges index, for delayed update


toUpdateLeft

protected final gnu.trove.TIntStack[] toUpdateLeft

toUpdateRight

protected final gnu.trove.TIntStack[] toUpdateRight
Constructor Detail

SoftMultiCostRegular

public SoftMultiCostRegular(IntDomainVar[] x,
                            IntDomainVar[] y,
                            IntDomainVar[] z,
                            IntDomainVar Z,
                            int[] indexes,
                            IPenaltyFunction[] f,
                            IAutomaton pi,
                            int[][][][] costs,
                            CPSolver solver)
Method Detail

initGraph

public void initGraph()

updateViolationLB

public boolean updateViolationLB()
                          throws ContradictionException
Throws:
ContradictionException

updateViolationUB

public boolean updateViolationUB()
                          throws ContradictionException
Throws:
ContradictionException

makeTableConstraints

public void makeTableConstraints()
                          throws ContradictionException
Throws:
ContradictionException

checkWorld

public void checkWorld()
                throws ContradictionException
Throws:
ContradictionException

awake

public void awake()
           throws ContradictionException
Description copied from class: Propagator
Propagation: Propagating the constraint for the very first time until local consistency is reached.

Overrides:
awake in class Propagator
Throws:
ContradictionException - contradiction exception

awakeOnRem

public void awakeOnRem(int idx,
                       int val)
                throws ContradictionException
Description copied from class: AbstractIntSConstraint
Default propagation on one value removal: propagation on domain revision.

Specified by:
awakeOnRem in interface IntPropagator
Overrides:
awakeOnRem in class AbstractIntSConstraint
Throws:
ContradictionException

awakeOnInst

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

Specified by:
awakeOnInst in interface IntPropagator
Overrides:
awakeOnInst in class AbstractIntSConstraint
Throws:
ContradictionException

awakeOnSup

public void awakeOnSup(int idx)
                throws ContradictionException
Description copied from class: AbstractIntSConstraint
Default propagation on improved upper bound: propagation on domain revision.

Specified by:
awakeOnSup in interface IntPropagator
Overrides:
awakeOnSup in class AbstractIntSConstraint
Throws:
ContradictionException

awakeOnInf

public void awakeOnInf(int idx)
                throws ContradictionException
Description copied from class: AbstractIntSConstraint
Default propagation on improved lower bound: propagation on domain revision.

Specified by:
awakeOnInf in interface IntPropagator
Overrides:
awakeOnInf in class AbstractIntSConstraint
Throws:
ContradictionException

boundChange

public void boundChange(int idx)

propagate

public void propagate()
               throws ContradictionException
Description copied from class: Propagator
Propagation: Propagating the constraint until local consistency is reached.

Specified by:
propagate in class Propagator
Throws:
ContradictionException - contradiction exception

delayedGraphUpdate

protected boolean delayedGraphUpdate()
                              throws ContradictionException
Updates the graphs w.r.t. the caught event during event-based propagation

Throws:
ContradictionException - if removing an edge causes a domain to be emptied

getFilteredEventMask

public int getFilteredEventMask(int idx)
Overrides:
getFilteredEventMask in class Propagator

check

public boolean check()

check

public boolean check(int[] word)

isSatisfied

public boolean isSatisfied(int[] tuple)
Description copied from class: AbstractIntSConstraint
TEMPORARY: if not overriden by the constraint, throws an error to avoid bug using reified constraints in constraints that have not been changed to fulfill this api yet !

Specified by:
isSatisfied in interface IntPropagator
Overrides:
isSatisfied in class AbstractIntSConstraint

needPropagation

public final boolean needPropagation()

getGraph

public SoftStoredMultiValuedDirectedMultiGraph getGraph()

getMinPathCostForAssignment

public int getMinPathCostForAssignment(int col,
                                       int val,
                                       int... resources)

getMinMaxPathCostForAssignment

public int[] getMinMaxPathCostForAssignment(int col,
                                            int val,
                                            int... resources)

getMinPathCost

public int getMinPathCost(int... resources)

getInstantiatedLayerCosts

public double[] getInstantiatedLayerCosts(int layer)


Copyright © 2012. All Rights Reserved.