Пример #1
0
 public static void main(String[] args) {
   long[][] stats = new long[2][3];
   for (AbstractProblem problem : problems) {
     // System.out.printf("%s", problem.getClass().getName());
     for (int i = 0; i < 1; i++) {
       for (PropagationEngineFactory pe : engines) {
         //                    System.out.printf(".");
         problem.createSolver();
         Solver solver = problem.getSolver();
         problem.buildModel();
         problem.configureSearch();
         solver.set(pe.make(solver));
         // SMF.toCSV(solver, problem.getClass().getCanonicalName() + ";" + pe.name(),
         // "/Users/kyzrsoze/Sandbox/pren/pe.csv");
         problem.solve();
         switch (pe) {
           case PROPAGATORDRIVEN_7QD:
             stats[0][0] = problem.solver.getMeasures().getSolutionCount();
             stats[0][1] = problem.solver.getMeasures().getNodeCount();
             stats[0][2] = problem.solver.getMeasures().getFailCount();
             break;
           case TWOBUCKETPROPAGATIONENGINE:
             stats[1][0] = problem.solver.getMeasures().getSolutionCount();
             stats[1][1] = problem.solver.getMeasures().getNodeCount();
             stats[1][2] = problem.solver.getMeasures().getFailCount();
             break;
         }
       }
       Assert.assertEquals(
           stats[0],
           stats[1],
           problem.getClass().getCanonicalName()
               + ":"
               + Arrays.toString(stats[0])
               + "!="
               + Arrays.toString(stats[1]));
     }
     // System.out.printf("OK\n");
   }
 }
Пример #2
0
  @Test(groups = "1m")
  public void mainTest() {
    LoggerFactory.getLogger("test").info(this.toString());
    prob.readArgs(args);
    prob.solver =
        new Solver(
            environment,
            prob.getClass().getSimpleName()); // required for testing, to pass properties
    prob.solver.set(
        new Settings() {
          @Override
          public boolean plugExplanationIn() {
            return true;
          }
        });
    prob.buildModel();
    prob.configureSearch();
    efact.plugin(prob.solver, false, false);
    prob.solver.findAllSolutions();

    Assert.assertEquals(
        nbSol, prob.getSolver().getMeasures().getSolutionCount(), "incorrect nb solutions");
  }