Class CSTNRandomGenerator

java.lang.Object
it.univr.di.cstnu.util.CSTNRandomGenerator

public class CSTNRandomGenerator extends Object
Allows one to build random CSTN instances specifying:
 - # of wanted DC/NOT DC instances
 And the following parameters that characterize each generated instance:
 - # nodes
 - # propositions
 - # negative qLoops
 - # nodes in each qLoop
 - # observation nodes in each qLoop
 - max weight for each edge
 - probability to have an edge between any pair of nodes
 

The class generates the wanted instances, building each one randomly and, then, DC checking it for stating its DC property.

Version:
$Rev: 732 $
Author:
posenato
  • Field Details

  • Constructor Details

    • CSTNRandomGenerator

      public CSTNRandomGenerator(int givenDcInstances, int givenNotDCInstances, int nodes, int propositions, int qLoops, int nodesInQloop, int obsInQLoop, double edgeProbability, int givenMaxWeight)
      Parameters:
      givenDcInstances - the wanted dc instances.
      givenNotDCInstances - the wanted not-dc instances.
      nodes - the wanted number of nodes.
      propositions - the wanted number of propositions.
      qLoops - the wanted number of qLoops.
      nodesInQloop - the wanted number of nodes in each qLoop.
      obsInQLoop - the wanted number of observation nodes in each qLoop.
      edgeProbability - the probability of an edge between any pair of ndoes.
      givenMaxWeight - the maximum weight for an edge.
      Throws:
      IllegalArgumentException - if one or more parameters has/have not valid value/s.
      IllegalArgumentException - if any.
  • Method Details

    • main

      public static void main(String[] args) throws FileNotFoundException, IOException

      main.

      Parameters:
      args - an array of String objects.
      Throws:
      FileNotFoundException - if any.
      IOException - if any.
    • getVersionAndCopyright

      public String getVersionAndCopyright()
      Returns:
      version and copyright string
    • buildAPairRndCSTNInstances

      public ObjectPair<TNGraph<CSTNEdge>> buildAPairRndCSTNInstances(boolean alsoNotDcInstance)
      Builds a pair of DC and not DC of CSTN instances using the building parameters. The not DC instance is build adding one or more constraints to the previous generated DC instance.
      Parameters:
      alsoNotDcInstance - false if the not DC instances is required. If false, the returned not DC instance is an empty tNGraph.
      Returns:
      a pair of DC and not DC of CSTN instances. If the first member is null, it means that a generic error in the building has occurred. If alsoNotDcInstance is false, the returned not DC instance is null.
    • setDifference

      static char[] setDifference(char[] s1, char[] s2)
      Parameters:
      s1 - first set
      s2 - second set
      Returns:
      an array that is the s1 / s2. s1 and s2 are not modified.
    • getDcInstances

      public int getDcInstances()
      Getter for the field dcInstances.
      Returns:
      the dcInstances
    • getEdgeProb

      public double getEdgeProb()
      Getter for the field edgeProb.
      Returns:
      the edgeProb
    • getMaxWeight

      public int getMaxWeight()

      Getter for the field maxWeight.

      Returns:
      the maxWeight
    • getNotDCInstances

      public int getNotDCInstances()
      Getter for the field notDCInstances.
      Returns:
      the notDCInstances
    • getNotDCSubDir

      public File getNotDCSubDir()
      Getter for the field notDCSubDir.
      Returns:
      the notDCSubDir
    • getnNodes

      public int getnNodes()
      Getter for the field nNodes.
      Returns:
      the nNodes
    • getnNodesQLoop

      public int getnNodesQLoop()
      Getter for the field nNodesQLoop.
      Returns:
      the nNodesQLoop
    • getnObsQLoop

      public int getnObsQLoop()
      Getter for the field nObsQLoop.
      Returns:
      the nObsQLoop
    • getnPropositions

      public int getnPropositions()
      Getter for the field nPropositions.
      Returns:
      the nPropositions
    • getnQLoops

      public int getnQLoops()
      Getter for the field nQLoops.
      Returns:
      the nQLoops