Class MCPGenerator

java.lang.Object
org.ddolib.examples.layered.mcp.MCPGenerator

public class MCPGenerator extends Object
Contains methods to generates and write instances.
  • Method Details

    • writeRandomInstance

      public static void writeRandomInstance(String fileName, int numNodes, int connectedProba, boolean solve, long seed) throws IOException
      Randomly generates and save instance of MCP into the given file.
      Parameters:
      fileName - the file where saving the instance
      numNodes - the number of nodes of the associated graph
      connectedProba - each pair of node has a probability of 1 / connectedProba to not be connected
      solve - whether the optimal solution must be computed and saved. Warning, the problem is solved naively. Be sure the set to true only on small instances.
      seed - the seed used by the random number generator
      Throws:
      IOException - if something goes wrong while writing files
    • writeRandomInstance

      public static void writeRandomInstance(String fileName, int numNodes, int connectedProba, boolean solve) throws IOException
      Randomly generates and save instance of MCP into the given file.
      Parameters:
      fileName - the file where saving the instance
      numNodes - the number of nodes of the associated graph
      connectedProba - each pair of node has a probability of 1 / connectedProba to not be connected
      solve - whether the optimal solution must be computed and saved. Warning, the problem is solved naively. Be sure the set to true only on small instances.
      Throws:
      IOException - if something goes wrong while writing files