Class MCPGenerator

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

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

    • MCPGenerator

      public MCPGenerator()
  • 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.