Class LazyCSTN
java.lang.Object
it.univr.di.cstnu.algorithms.lazy.LazyCSTN
public final class LazyCSTN extends Object
Simple class to represent and DC check Conditional Simple Temporal Network (CSTN) where the edge weight are signed integer or linear function of a common
symbolic parameter ∂. The value of ∂ is determined during the check in such a way the CSTN is DC (if it is possible).
The dynamic consistency check (DC check) is done assuming instantaneous DC semantics and using LP, R0, qR0, R3*, and qR3*
rules published at ICAPS 2018.
- Version:
- $Id: $Id
- Author:
- Roberto Posenato
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
LazyCSTN.DCSemantics
Value for dcSemanticsstatic class
LazyCSTN.EdgesToCheck
static class
LazyCSTN.LazyCSTNCheckStatus
Simple class to represent the status of the checking algorithm during an execution. -
Field Summary
Fields Modifier and Type Field Description static String
VERSIONandDATE
Version of the classboolean
withUnknown
DCChecking requires to use unknown literals to be complete.static String
ZeroNodeName
The name for the initial node. -
Constructor Summary
Constructors Constructor Description LazyCSTN(LabeledLazyWeightGraph g1)
LazyCSTN(LabeledLazyWeightGraph g1, int timeOut1)
-
Method Summary
Modifier and Type Method Description LazyCSTN.LazyCSTNCheckStatus
dynamicConsistencyCheck()
Checks the dynamic consistency of a CSTN instance within timeout seconds.LazyCSTN.LazyCSTNCheckStatus
getCheckStatus()
LabeledLazyWeightGraph
getG()
int
getMaxWeight()
static boolean
getMinimalDistanceGraph(LabeledLazyWeightGraph g)
Determines the minimal distance between all pair of vertexes modifying the given consistent graph.int
getReactionTime()
boolean
initAndCheck()
Help method to initialize and check the CSTN represented by graph g.static void
main(String[] args)
Just for using this class also from a terminal.void
printVersion()
Print version of the this class in System.out.void
setG(LabeledLazyWeightGraph g1)
Considers the given graph as the graph to check (graph will be modified).
-
Field Details
-
VERSIONandDATE
Version of the class- See Also:
- Constant Field Values
-
ZeroNodeName
The name for the initial node. -
withUnknown
public final boolean withUnknownDCChecking requires to use unknown literals to be complete. This flag can disable unknown literals if one want to verify if they are necessary for a specific check.- See Also:
- Constant Field Values
-
-
Constructor Details
-
LazyCSTN
- Parameters:
g1
- graph to check
-
LazyCSTN
- Parameters:
g1
- graph to checktimeOut1
- timeout for the check
-
-
Method Details
-
main
public static void main(String[] args) throws IOException, ParserConfigurationException, SAXExceptionJust for using this class also from a terminal.- Parameters:
args
- an array ofString
objects.- Throws:
SAXException
ParserConfigurationException
IOException
-
dynamicConsistencyCheck
Checks the dynamic consistency of a CSTN instance within timeout seconds. During the execution of this method, the given graph is modified.
If the check is successful, all constraints to node Z in g are minimized; otherwise, g contains a negative cycle at least.- Returns:
- the final status of the checking with some statistics.
- Throws:
WellDefinitionException
- if the nextGraph is not well defined (does not observe all well definition properties).
-
getCheckStatus
- Returns:
- the checkStatus
-
getG
- Returns:
- the g
-
getReactionTime
public int getReactionTime()- Returns:
- the reactionTime
-
getMaxWeight
public final int getMaxWeight()- Returns:
- the maxWeight
-
initAndCheck
Help method to initialize and check the CSTN represented by graph g. ThedynamicConsistencyCheck()
calls this method before to execute the check. If some constraints of the network does not observe well-definition properties AND they can be adjusted, then the method fixes them and logs such fixes in log system at WARNING level. Since the current DC checking algorithm is complete only if the CSTN instance contains an upper bound to the distance between Z (the first node) and each node, this procedure add such upper bound (= #nodes * max weight value) to each node.- Returns:
- true if the graph is a well formed
- Throws:
WellDefinitionException
- if the initial graph is not well defined.
-
printVersion
public void printVersion()Print version of the this class in System.out. -
setG
Considers the given graph as the graph to check (graph will be modified). Clear allmaxWeight
,horizon
andcheckStatus
.- Parameters:
g1
- set internal graph to g. It cannot be null.
-
getMinimalDistanceGraph
Determines the minimal distance between all pair of vertexes modifying the given consistent graph. If the graph contains a negative cycle, it returns false and the graph contains the edges that have determined the negative cycle.- Parameters:
g
- the graph- Returns:
- true if the graph is consistent, false otherwise. If the response is false, the edges do not represent the minimal distance between nodes.
-