Package solver.search.loop

Examples of solver.search.loop.ISearchLoop


        throw new UnsupportedOperationException();
    }

    @Override
    public void apply() throws ContradictionException {
        ISearchLoop mSearchLoop = dynamicBacktracking.getSolver().getSearchLoop();
        IEnvironment environment = dynamicBacktracking.getSolver().getEnvironment();
        Decision dec;
        // retrieve the decision applied BEFORE the decision to refute, which is the last one in the decision_path
        Decision dec2ref = decision_path.getLast();

        Decision previous = dec2ref.getPrevious();
        int swi = dec2ref.getWorldIndex();
        //assert swi ==environment.getWorldIndex();

        // simulate open_node and rebuild decisions history
        dec = decision_path.pollFirst();
        dec.setPrevious(previous);
        dec.setWorldIndex(swi++);
        mSearchLoop.setLastDecision(dec);
        dec.buildNext();

        // then simulate down_branch
        dec.apply();
        mSearchLoop.getSMList().afterDownLeftBranch();
        previous = dec;

        // iterate over decisions
        while (!decision_path.isEmpty()) {

            // simulate open_node and rebuild decisions history
            dec = decision_path.pollFirst();
            dec.setPrevious(previous);
            dec.setWorldIndex(swi++);
            mSearchLoop.setLastDecision(dec);
            dec.buildNext();

            // then simulate down_branch
            mSearchLoop.getSMList().beforeDownLeftBranch();
            environment.worldPush();
            dec.apply();
            mSearchLoop.getSMList().afterDownLeftBranch();

            previous = dec;
        }
    }
View Full Code Here


        try {
            // plug monitor to communicate bounds (should not be added in the sequential phasis)
            solver = model.getSolver();

      // communication
      final ISearchLoop searchLoop = solver.getSearchLoop();
      searchLoop.plugSearchMonitor(new IMonitorSolution() {
        @Override
        public void onSolution() {
          ObjectiveManager om = searchLoop.getObjectiveManager();
          int val = om.getPolicy() == ResolutionPolicy.SATISFACTION ? 1 : om.getBestSolutionValue().intValue();
          master.newSol(val, om.getPolicy());
        }
      });
View Full Code Here

TOP

Related Classes of solver.search.loop.ISearchLoop

Copyright © 2018 www.massapicom. 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.