Class CSTNRandomGenerator
java.lang.Object
it.univr.di.cstnu.util.CSTNRandomGenerator
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 Summary
Modifier and TypeFieldDescription(package private) static final String
Name of the root directory(package private) static final Class
<CSTNPotential> Checker(package private) static final String
Name of sub dir containing DC instances(package private) static final Logger
logger(package private) static final int
Maximum checks for a network(package private) static final int
Min max weight value(package private) static final int
Min number of nodes(package private) static final int
Min number of nodes in a qLoop(package private) static final int
Min number of propositions(package private) static final String
Name of sub dir containing NOT DC instances(package private) static final int
Default negative value of each qLoopstatic final String
Version of the class(package private) static final double
Default factor for modifying an edge -
Constructor Summary
ConstructorDescriptionCSTNRandomGenerator
(int givenDcInstances, int givenNotDCInstances, int nodes, int propositions, int qLoops, int nodesInQloop, int obsInQLoop, double edgeProbability, int givenMaxWeight) -
Method Summary
Modifier and TypeMethodDescriptionbuildAPairRndCSTNInstances
(boolean alsoNotDcInstance) Builds a pair of DC and not DC of CSTN instances using the building parameters.int
Getter for the fielddcInstances
.double
Getter for the fieldedgeProb
.int
Getter for the fieldmaxWeight
.int
Getter for the fieldnNodes
.int
Getter for the fieldnNodesQLoop
.int
Getter for the fieldnObsQLoop
.int
Getter for the fieldnotDCInstances
.Getter for the fieldnotDCSubDir
.int
Getter for the fieldnPropositions
.int
Getter for the fieldnQLoops
.static void
main.(package private) static char[]
setDifference
(char[] s1, char[] s2)
-
Field Details
-
VERSIONandDATE
-
BASE_DIR_NAME
-
CSTN_CLASS
Checker -
DC_SUB_DIR_NAME
-
LOG
logger -
MAX_CHECKS
static final int MAX_CHECKSMaximum checks for a network- See Also:
-
MIN_MAX_WEIGHT
static final int MIN_MAX_WEIGHTMin max weight value- See Also:
-
MIN_NODES
static final int MIN_NODESMin number of nodes- See Also:
-
MIN_NODES_QLOOP
static final int MIN_NODES_QLOOPMin number of nodes in a qLoop- See Also:
-
MIN_PROPOSITIONS
static final int MIN_PROPOSITIONSMin number of propositions- See Also:
-
NOT_DC_SUB_DIR_NAME
-
QLOOP_VALUE
static final int QLOOP_VALUEDefault negative value of each qLoop- See Also:
-
WEIGHT_MODIFICATION_FACTOR
static final double WEIGHT_MODIFICATION_FACTORDefault factor for modifying an edge- See Also:
-
-
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 nodes.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
main.
- Parameters:
args
- an array ofString
objects.- Throws:
FileNotFoundException
- if any.IOException
- if any.
-
getVersionAndCopyright
- Returns:
- version and copyright string
-
buildAPairRndCSTNInstances
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 sets2
- second set- Returns:
- an array that is the s1 / s2. s1 and s2 are not modified.
-
getDcInstances
public int getDcInstances()Getter for the fielddcInstances
.- Returns:
- the dcInstances
-
getEdgeProb
public double getEdgeProb()Getter for the fieldedgeProb
.- Returns:
- the edgeProb
-
getMaxWeight
public int getMaxWeight()Getter for the field
maxWeight
.- Returns:
- the maxWeight
-
getNotDCInstances
public int getNotDCInstances()Getter for the fieldnotDCInstances
.- Returns:
- the notDCInstances
-
getNotDCSubDir
-
getnNodes
public int getnNodes()Getter for the fieldnNodes
.- Returns:
- the nNodes
-
getnNodesQLoop
public int getnNodesQLoop()Getter for the fieldnNodesQLoop
.- Returns:
- the nNodesQLoop
-
getnObsQLoop
public int getnObsQLoop()Getter for the fieldnObsQLoop
.- Returns:
- the nObsQLoop
-
getnPropositions
public int getnPropositions()Getter for the fieldnPropositions
.- Returns:
- the nPropositions
-
getnQLoops
public int getnQLoops()Getter for the fieldnQLoops
.- Returns:
- the nQLoops
-