2

I have just starting to use the Sat4j libraries. Can you direct me how to calculate the time taken to parse and simplify a given CNF input.

i have used

ISolver solver = SolverFactory.newDefault();
Reader reader = new DimacsReader(solver);
IProblem problem = reader.parseInstance(filename.cnf);
boolean check=problem.isSatisfiable(); 

i wish to calculate the time taken by the reader to parse and isSatisfiable. if possible kindly direct me to find the information in the image for every cnf file processed screenshot of the details i look to collect using sat4j lib Thank you for your time in advance.

1 Answers1

0

I try to embedded your source code in an old fashion way to get the execution time.

Date startDate = Calendar.getInstance().getTime();
long d_StartTime = new Date().getTime();

    ISolver solver = SolverFactory.newDefault();
    Reader reader = new DimacsReader(solver);
    IProblem problem = reader.parseInstance(filename.cnf);

Date endDate = Calendar.getInstance().getTime();
long d_endTime = new Date().getTime();

System.out.format("Milli = %s, ( D_Start : %s, D_End : %s ) \n", (d_endTime - d_StartTime),d_StartTime, d_endTime);

boolean check=problem.isSatisfiable(); 

With this, the time in milliseconds to parse the instance will appear :). I hope this help !

Valentin Montmirail
  • 2,594
  • 1
  • 25
  • 53