|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectchoco.kernel.solver.propagation.Propagator
choco.kernel.solver.constraints.AbstractSConstraint<IntDomainVar>
choco.kernel.solver.constraints.integer.AbstractIntSConstraint
choco.kernel.solver.constraints.integer.AbstractLargeIntSConstraint
choco.cp.solver.constraints.global.automata.fast_multicostregular.MultiCostRegular
public final class MultiCostRegular
Created by IntelliJ IDEA. User: julien S Date: Jul 16, 2008 Time: 5:56:50 PM Multi-Cost-Regular is a propagator for the constraint ensuring that, given : an automaton Pi; a sequence of domain variables X; a set of bound variables Z; a assignment cost matrix for each bound variable C; The word formed by the sequence of assigned variables is accepted by Pi; for each z^k in Z, sum_i(C_i(x_k)k) = z^k AC is NP hard for such a constraint. The propagation is based on a Lagrangian Relaxation approach of the underlying Resource constrained shortest/longest path problems
Field Summary | |
---|---|
protected StoredDirectedMultiGraph |
graph
Layered graph of the unfolded automaton |
int[] |
lastLp
The last computed Longest Path |
double |
lastLpValue
|
int |
lastNbOfBacktracks
|
int |
lastNbOfRestarts
|
int[] |
lastSp
The last computed Shortest Path |
double |
lastSpValue
|
int |
lastWorld
|
gnu.trove.TObjectIntHashMap<IntDomainVar> |
map
Map to retrieve rapidly the index of a given variable. |
static int |
MAXBOUNDITER
Maximum number of iteration during a bound computation |
static int |
MAXNONIMPROVEITER
Maximum number of non improving iteration while computing a bound |
protected boolean[] |
modifiedBound
Boolean array which record whether a bound has been modified by the propagator |
protected int |
nbR
Store the number of resources = z.length |
protected ICostAutomaton |
pi
The finite automaton which defines the regular language the variable sequence must belong |
protected gnu.trove.TIntHashSet |
removed
Buffer to check whether an arc needs to be removed. |
static double |
RO
Lagrangian multiplier decreasing factor |
protected FastPathFinder |
slp
Instance of the class containing all path finding algorithms Also contains graph filtering algorithms |
protected gnu.trove.TIntStack |
toRemove
Stack to store removed edges index, for delayed update |
protected gnu.trove.TIntStack[] |
toUpdateLeft
|
protected gnu.trove.TIntStack[] |
toUpdateRight
|
static double |
U0
Constant coefficient of the lagrangian relaxation |
protected double[] |
uLb
Lagrangian multiplier container to compute a LB |
protected double[] |
uUb
Lagrangian multiplier container to compute an UB |
protected IntDomainVar[] |
vs
Decision variables |
IntDomainVar[] |
z
Cost variables |
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 | |
---|---|
MultiCostRegular(IntDomainVar[] vars,
IntDomainVar[] CR,
IAutomaton auto,
int[][][][] costs,
Solver solver)
Constructs a multi-cost-regular constraint propagator |
|
MultiCostRegular(IntDomainVar[] vars,
IntDomainVar[] CR,
IAutomaton auto,
int[][][] costs,
Solver solver)
Constructs a multi-cost-regular constraint propagator |
|
MultiCostRegular(IntDomainVar[] vars,
IntDomainVar[] CR,
ICostAutomaton pi,
Solver 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()
Necessary condition : checks whether the constraint is violted or not |
boolean |
check(int[] word)
|
protected void |
checkWorld()
|
void |
computeSharpBounds()
Iteratively compute upper and lower bound for the underlying RCSPP |
protected void |
delayedGraphUpdate()
Updates the graphs w.r.t. the caught event during event-based propagation |
protected void |
filterDown(double realsp)
Filters w.r.t. a given lower bound. |
protected void |
filterUp(double reallp)
Filters w.r.t. a given upper bound. |
void |
forcePathRecomputation()
|
int |
getFilteredEventMask(int idx)
|
StoredDirectedMultiGraph |
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)
|
int |
getRegret(int layer,
int value,
int... resources)
|
void |
initGraph()
|
boolean |
isGraphConsistent()
|
boolean |
isSatisfied()
Default implementation of the isSatisfied by delegating to the isSatisfied(int[] tuple) |
boolean |
isSatisfied(int[] word)
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 ! |
boolean |
needPropagation()
|
protected boolean |
prefilter()
Performs cost based filtering w.r.t. each cost dimension. |
void |
propagate()
Propagation: Propagating the constraint until local consistency is reached. |
void |
rebuildCostRegInfo()
|
protected void |
updateLowerBound()
Performs a lagrangian relaxation to compute a new Lower bound of the underlying RCSPP problem Each built subproblem is a shortest path one can use to perform cost based filtering |
protected void |
updateUpperBound()
Performs a lagrangian relaxation to compute a new Upper bound of the underlying RCSPP problem Each built subproblem is a longest path one can use to perform cost based filtering |
Methods inherited from class choco.kernel.solver.constraints.integer.AbstractIntSConstraint |
---|
awakeOnBounds, awakeOnRemovals, getConstraintType, isConsistent |
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 |
---|
public static int MAXBOUNDITER
public static int MAXNONIMPROVEITER
public static double U0
public static double RO
public final gnu.trove.TObjectIntHashMap<IntDomainVar> map
public int[] lastSp
public double lastSpValue
public int[] lastLp
public double lastLpValue
protected final IntDomainVar[] vs
public final IntDomainVar[] z
protected ICostAutomaton pi
protected StoredDirectedMultiGraph graph
protected final boolean[] modifiedBound
protected final double[] uUb
protected final double[] uLb
protected FastPathFinder slp
protected final int nbR
protected final gnu.trove.TIntStack toRemove
protected final gnu.trove.TIntStack[] toUpdateLeft
protected final gnu.trove.TIntStack[] toUpdateRight
protected final gnu.trove.TIntHashSet removed
public int lastWorld
public int lastNbOfBacktracks
public int lastNbOfRestarts
Constructor Detail |
---|
public MultiCostRegular(IntDomainVar[] vars, IntDomainVar[] CR, IAutomaton auto, int[][][] costs, Solver solver)
vars
- decision variablesCR
- cost variablesauto
- finite automatoncosts
- assignment cost arrayssolver
- solverpublic MultiCostRegular(IntDomainVar[] vars, IntDomainVar[] CR, IAutomaton auto, int[][][][] costs, Solver solver)
vars
- decision variablesCR
- cost variablesauto
- finite automatoncosts
- assignment cost arrayssolver
- solverpublic MultiCostRegular(IntDomainVar[] vars, IntDomainVar[] CR, ICostAutomaton pi, Solver solver)
Method Detail |
---|
public void initGraph()
protected void updateUpperBound() throws ContradictionException
ContradictionException
- if a domain becomes emptyprotected void updateLowerBound() throws ContradictionException
ContradictionException
- if a domain becomes emptyprotected boolean prefilter() throws ContradictionException
ContradictionException
- if a domain is emptiedprotected void filterDown(double realsp) throws ContradictionException
realsp
- a given lower bound
ContradictionException
- if the cost variable domain is emptiedprotected void filterUp(double reallp) throws ContradictionException
reallp
- a given upper bound
ContradictionException
- if the cost variable domain is emptiedprotected void checkWorld() throws ContradictionException
ContradictionException
protected void delayedGraphUpdate() throws ContradictionException
ContradictionException
- if removing an edge causes a domain to be emptiedpublic void computeSharpBounds() throws ContradictionException
ContradictionException
- if a domain gets emptypublic void awakeOnRem(int idx, int val) throws ContradictionException
AbstractIntSConstraint
awakeOnRem
in interface IntPropagator
awakeOnRem
in class AbstractIntSConstraint
ContradictionException
public final void awakeOnInst(int idx)
AbstractIntSConstraint
awakeOnInst
in interface IntPropagator
awakeOnInst
in class AbstractIntSConstraint
public final void awakeOnSup(int idx)
AbstractIntSConstraint
awakeOnSup
in interface IntPropagator
awakeOnSup
in class AbstractIntSConstraint
public final void awakeOnInf(int idx)
AbstractIntSConstraint
awakeOnInf
in interface IntPropagator
awakeOnInf
in class AbstractIntSConstraint
public void boundChange(int idx)
public void awake() throws ContradictionException
Propagator
awake
in class Propagator
ContradictionException
- contradiction exceptionpublic void propagate() throws ContradictionException
Propagator
propagate
in class Propagator
ContradictionException
- contradiction exceptionpublic void rebuildCostRegInfo() throws ContradictionException
ContradictionException
public final boolean needPropagation()
public boolean isGraphConsistent()
public final StoredDirectedMultiGraph getGraph()
public final int getRegret(int layer, int value, int... resources)
public boolean isSatisfied()
AbstractIntSConstraint
isSatisfied
in interface SConstraint<IntDomainVar>
isSatisfied
in class AbstractIntSConstraint
public boolean isSatisfied(int[] word)
AbstractIntSConstraint
isSatisfied
in interface IntPropagator
isSatisfied
in class AbstractIntSConstraint
public boolean check(int[] word)
public boolean check()
public int getFilteredEventMask(int idx)
getFilteredEventMask
in class Propagator
public int getMinPathCostForAssignment(int col, int val, int... resources)
public int[] getMinMaxPathCostForAssignment(int col, int val, int... resources)
public int getMinPathCost(int... resources)
public double[] getInstantiatedLayerCosts(int layer)
public void forcePathRecomputation() throws ContradictionException
ContradictionException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |