Class Max2SatGenerator

java.lang.Object
org.ddolib.examples.layered.max2sat.Max2SatGenerator

public class Max2SatGenerator extends Object
Methods to generate random instance of the Max2Sat problem.
  • 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 instance
      numVar - the number of variables in the problem
      nbClauses - the number of disjunctive clauses in the problem
      seed - 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 instance
      numVar - the number of variables in the problem
      nbClauses - the number of disjunctive clauses in the problem
      Throws:
      IOException - if something goes wrong while writing the file
    • main

      public static void main(String[] args) throws IOException
      Entry point of the program. Generates a random Max2Sat instance with 42 variables and 500 clauses and writes it to data/Max2Sat/wcnf_var_42.txt.
      Parameters:
      args - command-line arguments (not used)
      Throws:
      IOException - if something goes wrong while writing the file