Package it.univr.di.cstnu.util
Class OSTNURandomGenerator
java.lang.Object
it.univr.di.cstnu.util.OSTNURandomGenerator
Allows one to build random OSTNU instances specifying:
- number of wanted DC/NOT DC instances
- number nodes
- number of contingent nodes
- number of oracles
- max weight for each edge
- max weight for each contingent link (upper value)
- max in-degree for each node
- max out-degree for each node
- 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:
- 1.0
- Author:
- posenato
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final StringName of the root directory(package private) StringBase directory for saving the random instances.(package private) static final StringName of subdirectory containing DC instances(package private) static final StringDefault edge name prefix(package private) static final doubleDefault edge probability for each pair of nodes(package private) static final intDefault lane number(package private) static final Loggerlogger(package private) static final intMaximum checks for a network(package private) static final intMax distance between lower and upper value in a contingent link(package private) static final intMax weight value(package private) static final intMin max weight value(package private) static final intMin number of nodes(package private) static final StringDefault node name prefix(package private) static final StringName of sub dir containing NOT DC instances(package private) static final String(package private) static final doubleDefault son probabilitystatic final StringVersion of the class(package private) static final doubleDefault factor for modifying an edge(package private) static final doubleDefault x shift for node position(package private) static final doubleDefault y shift for node position -
Constructor Summary
ConstructorsConstructorDescriptionOSTNURandomGenerator(int givenDcInstances, int givenNotDCInstances, int nodes, int nCtgNodes1, double edgeProbability, int givenMaxWeight, int givenMaxContingentWeight) -
Method Summary
Modifier and TypeMethodDescriptionintgetDcInstanceNumber.doubleGetter for the fieldedgeProb.intGetter for the fieldmaxWeight.intgetNodeNumber.intgetNotDCInstanceNumber.Getter for the fieldnotDCSubDir.intgetObsQLoopNumber.static void
-
Field Details
-
VERSIONandDATE
Version of the class- See Also:
-
OSTNU_SUFFIX
- See Also:
-
BASE_DIR_NAME
Name of the root directory- See Also:
-
DC_SUB_DIR_NAME
Name of subdirectory containing DC instances- See Also:
-
EDGE_NAME_PREFIX
Default edge name prefix- See Also:
-
EDGE_PROBABILITY
static final double EDGE_PROBABILITYDefault edge probability for each pair of nodes- See Also:
-
LANES
static final int LANESDefault lane number- See Also:
-
LOG
logger -
MAX_CHECKS
static final int MAX_CHECKSMaximum checks for a network- See Also:
-
MAX_CONTINGENT_RANGE
static final int MAX_CONTINGENT_RANGEMax distance between lower and upper value in a contingent link- See Also:
-
MAX_CONTINGENT_WEIGHT
static final int MAX_CONTINGENT_WEIGHTMax weight value- 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:
-
NODE_NAME_PREFIX
Default node name prefix- See Also:
-
NOT_DC_SUB_DIR_NAME
Name of sub dir containing NOT DC instances- See Also:
-
SON_PROBABILITY
static final double SON_PROBABILITYDefault son probability- See Also:
-
WEIGHT_MODIFICATION_FACTOR
static final double WEIGHT_MODIFICATION_FACTORDefault factor for modifying an edge- See Also:
-
X_SHIFT
static final double X_SHIFTDefault x shift for node position- See Also:
-
Y_SHIFT
static final double Y_SHIFTDefault y shift for node position- See Also:
-
baseDirName
String baseDirNameBase directory for saving the random instances.
-
-
Constructor Details
-
OSTNURandomGenerator
public OSTNURandomGenerator(int givenDcInstances, int givenNotDCInstances, int nodes, int nCtgNodes1, double edgeProbability, int givenMaxWeight, int givenMaxContingentWeight) - Parameters:
givenDcInstances- the wanted DC instancesgivenNotDCInstances- the wanted not-DC instancesnodes- the number of nodesnCtgNodes1- the number of contingent nodesedgeProbability- the probability of an edge between two nodesgivenMaxWeight- the maximum edge weightgivenMaxContingentWeight- max contingent duration- Throws:
IllegalArgumentException- if one or more parameters has/have invalid value/s.IllegalArgumentException- if any.
-
-
Method Details
-
main
- Parameters:
args- input args- Throws:
FileNotFoundException- if any.IOException- if any.
-
getDcInstanceNumber
public int getDcInstanceNumber()getDcInstanceNumber.
- 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
-
getNodeNumber
public int getNodeNumber()getNodeNumber.
- Returns:
- the nNodes
-
getNotDCInstanceNumber
public int getNotDCInstanceNumber()getNotDCInstanceNumber.
- Returns:
- the notDCInstances
-
getNotDCSubDir
Getter for the field
notDCSubDir.- Returns:
- the notDCSubDir
-
getObsQLoopNumber
public int getObsQLoopNumber()getObsQLoopNumber.
- Returns:
- the nObsQLoop
-
getVersionAndCopyright
- Returns:
- version and copyright string
-