Package org.drools.planner.core.event

Examples of org.drools.planner.core.event.SolverEventListener


    public Score getScore() {
        return guiScoreDirector.calculateScore();
    }

    public void registerForBestSolutionChanges(final SolverAndPersistenceFrame solverAndPersistenceFrame) {
        solver.addEventListener(new SolverEventListener() {
            // Not called on the event thread
            public void bestSolutionChanged(BestSolutionChangedEvent event) {
                // Avoid ConcurrentModificationException when there is an unprocessed ProblemFactChange
                // because the paint method uses the problem facts instances as the solver
                // unlike the planning entities which are cloned
View Full Code Here


    public void solve(final HttpSession session) {
        final Solver solver = (Solver) session.getAttribute(VrpSessionAttributeName.SOLVER);
        VrpSchedule unsolvedSolution = (VrpSchedule) session.getAttribute(VrpSessionAttributeName.SHOWN_SOLUTION);

        solver.setPlanningProblem(unsolvedSolution);
        solver.addEventListener(new SolverEventListener() {
            public void bestSolutionChanged(BestSolutionChangedEvent event) {
                VrpSchedule bestSolution = (VrpSchedule) event.getNewBestSolution();
                session.setAttribute(VrpSessionAttributeName.SHOWN_SOLUTION, bestSolution);
            }
        });
View Full Code Here

        constraintScoreMapDialog = new ConstraintScoreMapDialog(this);
        constraintScoreMapDialog.setSolutionBusiness(solutionBusiness);
    }

    private void registerListeners() {
        solutionBusiness.addSolverEventLister(new SolverEventListener() {
            public void bestSolutionChanged(BestSolutionChangedEvent event) {
                final Solution bestSolution = event.getNewBestSolution();
                SwingUtilities.invokeLater(new Runnable() {
                    public void run() {
                        resultLabel.setText("Latest best score: " + bestSolution.getScore());
View Full Code Here

    public boolean isSolving() {
        return solver.isSolving();
    }

    public void registerForBestSolutionChanges(final SolverAndPersistenceFrame solverAndPersistenceFrame) {
        solver.addEventListener(new SolverEventListener() {
            // Not called on the event thread
            public void bestSolutionChanged(BestSolutionChangedEvent event) {
                // Avoid ConcurrentModificationException when there is an unprocessed ProblemFactChange
                // because the paint method uses the problem facts instances as the solver
                // unlike the planning entities which are cloned
View Full Code Here

TOP

Related Classes of org.drools.planner.core.event.SolverEventListener

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.