Examples of Solver


Examples of org.boblycat.abbots.Solver

        Socket sock = new Socket("munkeliv.ath.cx", 50000);
        Client client = new Client(sock);
        client.sendAndReceive("iama", "Oracle-powered Evil Daemon [" + cpus + " threads]");
        Board board = client.start();
        System.out.println("Got board:\n" + board);
        Solver solver = new Solver(board, true);
        String solution = solver.solveMultiThreaded(cpus, "");
        //System.out.println("Solution: " + solution);
        String servertime = client.solve(solution);
        System.out.println("Server time: " + servertime + " ms");
    }
View Full Code Here

Examples of org.drools.planner.core.Solver

    public void benchmark(XStream xStream) { // TODO refactor out xstream
        benchmarkingStarted();
        // LinkedHashMap because order of unsolvedSolutionFile should be respected in output
        Map<File, SolverStatistic> unsolvedSolutionFileToStatisticMap = new LinkedHashMap<File, SolverStatistic>();
        for (SolverBenchmark solverBenchmark : solverBenchmarkList) {
            Solver solver = solverBenchmark.getLocalSearchSolverConfig().buildSolver();
            for (SolverBenchmarkResult result : solverBenchmark.getSolverBenchmarkResultList()) {
                File unsolvedSolutionFile = result.getUnsolvedSolutionFile();
                Solution unsolvedSolution = readUnsolvedSolution(xStream, unsolvedSolutionFile);
                solver.setStartingSolution(unsolvedSolution);
                if (solverStatisticType != SolverStatisticType.NONE) {
                    SolverStatistic statistic = unsolvedSolutionFileToStatisticMap.get(unsolvedSolutionFile);
                    if (statistic == null) {
                        statistic = solverStatisticType.create();
                        unsolvedSolutionFileToStatisticMap.put(unsolvedSolutionFile, statistic);
                    }
                    statistic.addListener(solver, solverBenchmark.getName());
                }
                solver.solve();
                result.setTimeMillisSpend(solver.getTimeMillisSpend());
                Solution solvedSolution = solver.getBestSolution();
                result.setScore(solvedSolution.getScore());
                if (solverStatisticType != SolverStatisticType.NONE) {
                    SolverStatistic statistic = unsolvedSolutionFileToStatisticMap.get(unsolvedSolutionFile);
                    statistic.removeListener(solver, solverBenchmark.getName());
                }
View Full Code Here

Examples of org.drools.solver.core.Solver


    public void testSmoke() {
        XmlSolverConfigurer configurer = new XmlSolverConfigurer();
        configurer.configure(SOLVER_CONFIG);
        Solver solver = configurer.buildSolver();
        SolutionDao solutionDao = new XstreamSolutionDaoImpl();
        Solution startingSolution = solutionDao.readSolution(getClass().getResourceAsStream(UNSOLVED_DATA));
        solver.setStartingSolution(startingSolution);
        solver.solve();
        Solution bestSolution = solver.getBestSolution();
        assertNotNull(bestSolution);
        double bestScore = solver.getBestScore();
        assertEquals(0.0, bestScore);
    }
View Full Code Here

Examples of org.jakstab.solver.Solver

        RTLExpression assumption = stmt.getAssumption();

        // First analysis to use yices, demo implementation
       
        Solver solver = Solver.createSolver();
        solver.addAssertion(s.getStateFormula());
        solver.addAssertion(assumption);

        if (!solver.isSatisfiable()) {
          logger.info("Infeasible CFA edge: " + stmt);
          return Collections.emptySet();
        }
       
        SignState post = new SignState(s);
        for (RTLVariable v : assumption.getUsedVariables()) {
          // Check if we can restrict this variable
          if (s.getValue(v).isTop()) {

            solver.push();
            RTLExpression f = ExpressionFactory.createLessOrEqual(v, ExpressionFactory.createNumber(0, v.getBitWidth()));
            solver.addAssertion(f);
            if (!solver.isSatisfiable()) {
              post.setValue(v, SignElement.POSITIVE);
              logger.debug("Restricting state from " + s + " through " + assumption + " to " + post);
            } else {
              solver.pop();
              solver.push();
              f = ExpressionFactory.createNot(ExpressionFactory.createEqual(v, ExpressionFactory.createNumber(0, v.getBitWidth())));
              solver.addAssertion(f);
              if (!solver.isSatisfiable()) {
                post.setValue(v, SignElement.ZERO);
                logger.debug("Restricting state from " + s + " through " + assumption + " to " + post);
              } else {
                solver.pop();
                solver.push();
                f = ExpressionFactory.createLessOrEqual(ExpressionFactory.createNumber(0, v.getBitWidth()), v);
                solver.addAssertion(f);
                if (!solver.isSatisfiable()) {
                  post.setValue(v, SignElement.NEGATIVE);
                  logger.debug("Restricting state from " + s + " through " + assumption + " to " + post);
                }
              }
            }
            solver.pop();
          }
        }
        return Collections.singleton((AbstractState)post);
       
        /*
 
View Full Code Here

Examples of org.moxie.Solver

    }
    folder.mkdirs();
    System.setProperty("mx.root", folder.getAbsolutePath());
    System.out.println("mx.root=" + folder.getAbsolutePath());
    BuildConfig config = new BuildConfig(new File("test.moxie"), null);
    Solver solver = new Solver(new Console(), config);
    return solver;
  }
View Full Code Here

Examples of org.optaplanner.core.api.solver.Solver

    }

    @Override
    protected void onExchange(Exchange exchange) throws Exception {
        ObjectHelper.notNull(solverFactory, "solverFactory");
        Solver solver = solverFactory.buildSolver();

        Solution planningProblem = exchange.getIn().getMandatoryBody(Solution.class);

        solver.setPlanningProblem(planningProblem);
        solver.solve();
        Solution bestSolution = solver.getBestSolution();

        exchange.getOut().setBody(bestSolution);
        // propagate headers and attachments
        exchange.getOut().setHeaders(exchange.getIn().getHeaders());
        exchange.getOut().setAttachments(exchange.getIn().getAttachments());
View Full Code Here

Examples of solver.Solver

  // METHODS
  //***********************************************************************************

  @Override
  public void createSolver() {
    solver = new Solver("Pareto sample");
  }
View Full Code Here

Examples of solver.Solver

    IntVar objective;


    @Override
    public void createSolver() {
        solver = new Solver("BACP");
    }
View Full Code Here

Examples of solver.Solver

    Constraint alldiff;
    Constraint[] distances;

    @Override
    public void createSolver() {
        solver = new Solver("Golomb Ruler");
    }
View Full Code Here

Examples of solver.Solver

   * Make a and constraint
   * @param BOOLS an array of boolean variable
   * @return a constraint and ensuring that variables in BOOLS are all set to true
   */
  public static Constraint and(BoolVar... BOOLS){
    Solver s = BOOLS[0].getSolver();
    IntVar sum = VariableFactory.bounded(StringUtils.randomName(),0,BOOLS.length,s);
    s.post(IntConstraintFactory.sum(BOOLS,sum));
    return IntConstraintFactory.arithm(sum,"=",BOOLS.length);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.