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
Modifier and TypeFieldDescription(package private) static final String
Name of the root directory(package private) String
Base directory for saving the random instances.(package private) static final String
Name of sub dir containing DC instances(package private) static final String
Default edge name prefix(package private) static final double
Default edge probability for each pair of nodes(package private) static final int
Default lane number(package private) static final Logger
logger(package private) static final int
Maximum checks for a network(package private) static final int
Max distance between lower and upper value in a contingent link(package private) static final int
Max weight value(package private) static final int
Min max weight value(package private) static final int
Min number of nodes(package private) static final String
Default node name prefix(package private) static final String
Name of sub dir containing NOT DC instances(package private) static final String
(package private) static final double
Default son probabilitystatic final String
Version of the class(package private) static final double
Default factor for modifying an edge(package private) static final double
Default x shift for node position(package private) static final double
Default y shift for node position -
Constructor Summary
ConstructorDescriptionOSTNURandomGenerator
(int givenDcInstances, int givenNotDCInstances, int nodes, int nCtgNodes1, double edgeProbability, int givenMaxWeight, int givenMaxContingentWeight) -
Method Summary
Modifier and TypeMethodDescriptionint
getDcInstanceNumber.double
Getter for the fieldedgeProb
.int
Getter for the fieldmaxWeight
.int
getNodeNumber.int
getNotDCInstanceNumber.Getter for the fieldnotDCSubDir
.int
getObsQLoopNumber.static void
-
Field Details
-
VERSIONandDATE
-
OSTNU_SUFFIX
- See Also:
-
BASE_DIR_NAME
-
DC_SUB_DIR_NAME
-
EDGE_NAME_PREFIX
-
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
-
NOT_DC_SUB_DIR_NAME
-
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 not valid 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
-
getObsQLoopNumber
public int getObsQLoopNumber()getObsQLoopNumber.
- Returns:
- the nObsQLoop
-
getVersionAndCopyright
- Returns:
- version and copyright string
-