Class Max2SatGenerator
java.lang.Object
org.ddolib.examples.layered.max2sat.Max2SatGenerator
Methods to generate random instance of the Max2Sat problem.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidgenerateRandomInstance(String fileName, int numVar, int nbClauses) Generates and writes a random instance of the Max2Sat.static voidgenerateRandomInstance(String fileName, int numVar, int nbClauses, long seed) Generates and writes a random instance of the Max2Sat.static voidEntry point of the program.
-
Method Details
-
generateRandomInstance
public static void generateRandomInstance(String fileName, int numVar, int nbClauses, long seed) throws IOException Generates and writes a random instance of the Max2Sat.- Parameters:
fileName- the file to save the instancenumVar- the number of variables in the problemnbClauses- the number of disjunctive clauses in the problemseed- the seed of the random number generator- Throws:
IOException- if something goes wrong while writing the file
-
generateRandomInstance
public static void generateRandomInstance(String fileName, int numVar, int nbClauses) throws IOException Generates and writes a random instance of the Max2Sat.- Parameters:
fileName- the file to save the instancenumVar- the number of variables in the problemnbClauses- the number of disjunctive clauses in the problem- Throws:
IOException- if something goes wrong while writing the file
-
main
Entry point of the program. Generates a random Max2Sat instance with 42 variables and 500 clauses and writes it todata/Max2Sat/wcnf_var_42.txt.- Parameters:
args- command-line arguments (not used)- Throws:
IOException- if something goes wrong while writing the file
-