Class OSTNURandomGenerator

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

public class OSTNURandomGenerator extends Object
Allows one to build random OSTNU instances specifying:
  • number of wanted DC/NOT DC instances
And the following parameters that characterize each generated instance:
  • 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 Details

    • VERSIONandDATE

      public static final String VERSIONandDATE
      Version of the class
      See Also:
    • OSTNU_SUFFIX

      static final String OSTNU_SUFFIX
      See Also:
    • BASE_DIR_NAME

      static final String BASE_DIR_NAME
      Name of the root directory
      See Also:
    • DC_SUB_DIR_NAME

      static final String DC_SUB_DIR_NAME
      Name of subdirectory containing DC instances
      See Also:
    • EDGE_NAME_PREFIX

      static final String EDGE_NAME_PREFIX
      Default edge name prefix
      See Also:
    • EDGE_PROBABILITY

      static final double EDGE_PROBABILITY
      Default edge probability for each pair of nodes
      See Also:
    • LANES

      static final int LANES
      Default lane number
      See Also:
    • LOG

      static final Logger LOG
      logger
    • MAX_CHECKS

      static final int MAX_CHECKS
      Maximum checks for a network
      See Also:
    • MAX_CONTINGENT_RANGE

      static final int MAX_CONTINGENT_RANGE
      Max distance between lower and upper value in a contingent link
      See Also:
    • MAX_CONTINGENT_WEIGHT

      static final int MAX_CONTINGENT_WEIGHT
      Max weight value
      See Also:
    • MIN_MAX_WEIGHT

      static final int MIN_MAX_WEIGHT
      Min max weight value
      See Also:
    • MIN_NODES

      static final int MIN_NODES
      Min number of nodes
      See Also:
    • NODE_NAME_PREFIX

      static final String NODE_NAME_PREFIX
      Default node name prefix
      See Also:
    • NOT_DC_SUB_DIR_NAME

      static final String NOT_DC_SUB_DIR_NAME
      Name of sub dir containing NOT DC instances
      See Also:
    • SON_PROBABILITY

      static final double SON_PROBABILITY
      Default son probability
      See Also:
    • WEIGHT_MODIFICATION_FACTOR

      static final double WEIGHT_MODIFICATION_FACTOR
      Default factor for modifying an edge
      See Also:
    • X_SHIFT

      static final double X_SHIFT
      Default x shift for node position
      See Also:
    • Y_SHIFT

      static final double Y_SHIFT
      Default y shift for node position
      See Also:
    • baseDirName

      String baseDirName
      Base 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 instances
      givenNotDCInstances - the wanted not-DC instances
      nodes - the number of nodes
      nCtgNodes1 - the number of contingent nodes
      edgeProbability - the probability of an edge between two nodes
      givenMaxWeight - the maximum edge weight
      givenMaxContingentWeight - max contingent duration
      Throws:
      IllegalArgumentException - if one or more parameters has/have invalid value/s.
      IllegalArgumentException - if any.
  • Method Details

    • main

      public static void main(String[] args) throws FileNotFoundException, IOException
      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

      public File getNotDCSubDir()

      Getter for the field notDCSubDir.

      Returns:
      the notDCSubDir
    • getObsQLoopNumber

      public int getObsQLoopNumber()

      getObsQLoopNumber.

      Returns:
      the nObsQLoop
    • getVersionAndCopyright

      public String getVersionAndCopyright()
      Returns:
      version and copyright string