Clover coverage report -
Coverage timestamp: jeu. juin 15 2006 08:24:33 CEST
file stats: LOC: 76   Methods: 2
NCLOC: 48   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
MoreThanSAT.java 0% 0% 0% 0%
coverage
 1    package org.sat4j;
 2   
 3    import java.io.FileNotFoundException;
 4    import java.io.IOException;
 5   
 6    import org.sat4j.minisat.SolverFactory;
 7    import org.sat4j.reader.InstanceReader;
 8    import org.sat4j.reader.ParseFormatException;
 9    import org.sat4j.reader.Reader;
 10    import org.sat4j.specs.ContradictionException;
 11    import org.sat4j.specs.IProblem;
 12    import org.sat4j.specs.ISolver;
 13    import org.sat4j.specs.IVecInt;
 14    import org.sat4j.specs.TimeoutException;
 15    import org.sat4j.tools.RemiUtils;
 16    import org.sat4j.tools.SolutionCounter;
 17   
 18    /*
 19    * Created on 21 dï¿œc. 2004
 20    *
 21    * TODO To change the template for this generated file go to
 22    * Window - Preferences - Java - Code Style - Code Templates
 23    */
 24   
 25    /**
 26    * This is an example of use of the SAT4J library for computing the backbone of
 27    * a CNF or to compute the number of solutions of a CNF. We do not claim that
 28    * those tools are very efficient: they were simple to write and they helped us
 29    * on small examples.
 30    *
 31    * @author leberre
 32    */
 33    public class MoreThanSAT {
 34   
 35    /**
 36    * This constructor is private to prevent people
 37    * to use instances of that class.
 38    *
 39    */
 40  0 private MoreThanSAT() {
 41    // to silent PMD audit
 42    }
 43   
 44  0 public static void main(String[] args) {
 45  0 ISolver solver = SolverFactory.newMiniLearning();
 46  0 SolutionCounter sc = new SolutionCounter(solver);
 47  0 solver.setTimeout(3600); // 1 hour timeout
 48  0 Reader reader = new InstanceReader(solver);
 49   
 50    // filename is given on the command line
 51  0 try {
 52  0 IProblem problem = reader.parseInstance(args[0]);
 53  0 if (problem.isSatisfiable()) {
 54  0 System.out.println(Messages.getString("MoreThanSAT.0")); //$NON-NLS-1$
 55  0 System.out.println(reader.decode(problem.model()));
 56  0 IVecInt backbone = RemiUtils.backbone(solver);
 57  0 System.out.println(Messages.getString("MoreThanSAT.1") + backbone); //$NON-NLS-1$
 58  0 System.out.println(Messages.getString("MoreThanSAT.2")); //$NON-NLS-1$
 59  0 System.out.println(Messages.getString("MoreThanSAT.3") //$NON-NLS-1$
 60    + sc.countSolutions());
 61    } else {
 62  0 System.out.println(Messages.getString("MoreThanSAT.4")); //$NON-NLS-1$
 63    }
 64    } catch (FileNotFoundException e) {
 65  0 e.printStackTrace();
 66    } catch (ParseFormatException e) {
 67  0 e.printStackTrace();
 68    } catch (IOException e) {
 69  0 e.printStackTrace();
 70    } catch (ContradictionException e) {
 71  0 System.out.println(Messages.getString("MoreThanSAT.5")); //$NON-NLS-1$
 72    } catch (TimeoutException e) {
 73  0 System.out.println(Messages.getString("MoreThanSAT.6")); //$NON-NLS-1$
 74    }
 75    }
 76    }