Package org.ddolib.examples.layered.mcp
Class MCPGenerator
java.lang.Object
org.ddolib.examples.layered.mcp.MCPGenerator
Contains methods to generates and write instances.
-
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.
-
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 instancenumNodes- the number of nodes of the associated graphconnectedProba- each pair of node has a probability of1 / connectedProbato not be connectedsolve- 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 instancenumNodes- the number of nodes of the associated graphconnectedProba- each pair of node has a probability of1 / connectedProbato not be connectedsolve- 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
-