Package org.ddolib.examples.mcp
Class MCPGenerator
java.lang.Object
org.ddolib.examples.mcp.MCPGenerator
Contains methods to generates and write instances.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidwriteRandomInstance(String fileName, int numNodes, int connectedProba, boolean solve) Randomly generates and save instance of MCP into the given file.static voidwriteRandomInstance(String fileName, int numNodes, int connectedProba, boolean solve, long seed) Randomly generates and save instance of MCP into the given file.
-
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 of1 / connectedProbato not be connected.solve- Whether the optimal solution must be computed and saved. Warning, the problem is solved naively. Be sure the set totrueonly 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 of1 / connectedProbato not be connected.solve- Whether the optimal solution must be computed and saved. Warning, the problem is solved naively. Be sure the set totrueonly on small instances.- Throws:
IOException- If something goes wrong while writing files.
-