- java.lang.Object
-
- org.chocosolver.util.objects.graphs.MultivaluedDecisionDiagram
-
public class MultivaluedDecisionDiagram extends Object
A Multi-valued Decision Diagram (MDD for short) to storeCreated by cprudhom on 30/10/14.
-
-
Constructor Summary
Constructors Constructor Description MultivaluedDecisionDiagram(int[][] FLATDOM, Tuples TUPLES)
Create an MDD based on an array of flatten domains and a set of tuplesMultivaluedDecisionDiagram(int[][] FLATDOM, Tuples TUPLES, boolean compactOnce, boolean sortTuple)
Create an MDD based on an array of flatten domains and a set of tuplesMultivaluedDecisionDiagram(IntVar[] VARIABLES, int[][] TRANSITIONS)
Create an MDD based on an array of flatten domains and a set of transitions.MultivaluedDecisionDiagram(IntVar[] VARIABLES, Tuples TUPLES)
Create an MDD based on an array of flatten domains and a set of tuplesMultivaluedDecisionDiagram(IntVar[] VARIABLES, Tuples TUPLES, boolean compactOnce, boolean sortTuple)
Create an MDD based on an array of flatten domains and a set of tuples
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
addTuple(int[] TUPLE)
Add a tuple to the MDDboolean
addTuples(Tuples TUPLES)
Add all tuples within the MDDboolean
exists(int... PATH)
Return true is PATH has a support in the mddint[]
getDiagram()
Return the diagram (not a copy) of the MDDint
getEdge(int k)
Return the edge valued in the k^th cell of the diagramint
getNodeSize(int layer)
Return the initial domain size of the variable in layerint
getOffset(int layer)
Return the initial LB of the variable in layerprotected int
searchClosest(int[] a, int key)
-
-
-
Field Detail
-
TERMINAL
public static final int TERMINAL
The terminal node. An extreme (likely unused) value is set- See Also:
- Constant Field Values
-
EMPTY
public static final int EMPTY
Express "no edge" information- See Also:
- Constant Field Values
-
-
Constructor Detail
-
MultivaluedDecisionDiagram
public MultivaluedDecisionDiagram(IntVar[] VARIABLES, Tuples TUPLES)
Create an MDD based on an array of flatten domains and a set of tuples- Parameters:
VARIABLES
- array of flatten domainsTUPLES
- set of (allowed) tuples
-
MultivaluedDecisionDiagram
public MultivaluedDecisionDiagram(IntVar[] VARIABLES, Tuples TUPLES, boolean compactOnce, boolean sortTuple)
Create an MDD based on an array of flatten domains and a set of tuples- Parameters:
VARIABLES
- array of flatten domainsTUPLES
- set of (allowed) tuplescompactOnce
- set to true to compact the MDD after having added all the TUPLES, set to false to try to compact the MDD after each tuple additionsortTuple
- set to true to sort the TUPLES in increasing order before adding them
-
MultivaluedDecisionDiagram
public MultivaluedDecisionDiagram(int[][] FLATDOM, Tuples TUPLES)
Create an MDD based on an array of flatten domains and a set of tuples- Parameters:
FLATDOM
- array of flatten domainsTUPLES
- set of (allowed) tuples
-
MultivaluedDecisionDiagram
public MultivaluedDecisionDiagram(int[][] FLATDOM, Tuples TUPLES, boolean compactOnce, boolean sortTuple)
Create an MDD based on an array of flatten domains and a set of tuples- Parameters:
FLATDOM
- array of flatten domainsTUPLES
- set of (allowed) tuplescompactOnce
- set to true to compact the MDD after having added all the TUPLES, set to false to try to compact the MDD after each tuple additionsortTuple
- set to true to sort the TUPLES in increasing order before adding them
-
MultivaluedDecisionDiagram
public MultivaluedDecisionDiagram(IntVar[] VARIABLES, int[][] TRANSITIONS)
Create an MDD based on an array of flatten domains and a set of transitions. The first of the graph has to be labeled '0' and the last node of the graph has to be labeled '-1'. Then, a transition is triplewhich denotes an arc from node 'f' to node 't' valued to 'v'. - Parameters:
VARIABLES
- array of flatten domainsTRANSITIONS
- list of transitions
-
-
Method Detail
-
addTuples
public boolean addTuples(Tuples TUPLES)
Add all tuples within the MDD- Parameters:
TUPLES
- tuples to add
-
addTuple
public boolean addTuple(int[] TUPLE)
Add a tuple to the MDD- Parameters:
TUPLE
- tuple to add
-
searchClosest
protected int searchClosest(int[] a, int key)
-
getDiagram
public int[] getDiagram()
Return the diagram (not a copy) of the MDD
-
getNodeSize
public int getNodeSize(int layer)
Return the initial domain size of the variable in layer- Parameters:
layer
- index of the variable- Returns:
- original domain size
-
getOffset
public int getOffset(int layer)
Return the initial LB of the variable in layer- Parameters:
layer
- index of the variable- Returns:
- original offset
-
getEdge
public int getEdge(int k)
Return the edge valued in the k^th cell of the diagram- Parameters:
k
- index of the cell
-
exists
public boolean exists(int... PATH)
Return true is PATH has a support in the mdd- Parameters:
PATH
- array of value- Returns:
- true if PATH is valid
-
-