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
  • Field Details

    • VERSIONandDATE

      public static final String VERSIONandDATE
      Version of the class
      See Also:
      Constant Field Values
    • ZeroNodeName

      public static String ZeroNodeName
      The name for the initial node.
    • withUnknown

      public final boolean withUnknown
      DCChecking 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

      public LazyCSTN​(LabeledLazyWeightGraph g1)
      Parameters:
      g1 - graph to check
    • LazyCSTN

      public LazyCSTN​(LabeledLazyWeightGraph g1, int timeOut1)
      Parameters:
      g1 - graph to check
      timeOut1 - timeout for the check
  • Method Details

    • main

      public static void main​(String[] args) throws IOException, ParserConfigurationException, SAXException
      Just for using this class also from a terminal.
      Parameters:
      args - an array of String objects.
      Throws:
      SAXException
      ParserConfigurationException
      IOException
    • dynamicConsistencyCheck

      public LazyCSTN.LazyCSTNCheckStatus dynamicConsistencyCheck() throws WellDefinitionException
      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

      public LazyCSTN.LazyCSTNCheckStatus getCheckStatus()
      Returns:
      the checkStatus
    • getG

      public final LabeledLazyWeightGraph getG()
      Returns:
      the g
    • getReactionTime

      public int getReactionTime()
      Returns:
      the reactionTime
    • getMaxWeight

      public final int getMaxWeight()
      Returns:
      the maxWeight
    • initAndCheck

      public boolean initAndCheck() throws WellDefinitionException
      Help method to initialize and check the CSTN represented by graph g. The dynamicConsistencyCheck() 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

      public void setG​(LabeledLazyWeightGraph g1)
      Considers the given graph as the graph to check (graph will be modified). Clear all maxWeight, horizon and checkStatus.
      Parameters:
      g1 - set internal graph to g. It cannot be null.
    • getMinimalDistanceGraph

      public static boolean getMinimalDistanceGraph​(LabeledLazyWeightGraph g)
      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.