Package org.drools.planner.core.localsearch

Examples of org.drools.planner.core.localsearch.LocalSearchSolverScope.calculateScoreFromWorkingMemory()


        Examination examination = (Examination) new ExaminationDaoImpl().readSolution(getClass().getResourceAsStream(
                "/org/drools/planner/examples/examination/data/testExaminationScoreRules.xml"));
        localSearchSolverScope.setWorkingSolution(examination);
        WorkingMemory workingMemory = localSearchSolverScope.getWorkingMemory();

        localSearchSolverScope.calculateScoreFromWorkingMemory();
        // do RoomChangeMove
        Exam exam = findExamById(examination, 123L);
        Room room = findRoomById(examination, 0L);
        ExaminationMoveHelper.moveRoom(workingMemory, exam, room);
        Score score = localSearchSolverScope.calculateScoreFromWorkingMemory();
View Full Code Here


        localSearchSolverScope.calculateScoreFromWorkingMemory();
        // do RoomChangeMove
        Exam exam = findExamById(examination, 123L);
        Room room = findRoomById(examination, 0L);
        ExaminationMoveHelper.moveRoom(workingMemory, exam, room);
        Score score = localSearchSolverScope.calculateScoreFromWorkingMemory();
        localSearchSolverScope.assertWorkingScore(score);
    }

    private RuleBase buildRuleBase() {
        PackageBuilder packageBuilder = new PackageBuilder();
View Full Code Here

        NurseRoster nurseRoster = (NurseRoster) new NurseRosteringDaoImpl().readSolution(getClass().getResourceAsStream(
                "/org/drools/planner/examples/nurserostering/data/testNurseRosteringScoreRules.xml"));
        localSearchSolverScope.setWorkingSolution(nurseRoster);
        WorkingMemory workingMemory = localSearchSolverScope.getWorkingMemory();

        Score firstScore = localSearchSolverScope.calculateScoreFromWorkingMemory();
        // do AssignmentSwitchMove
        Employee leftEmployee = findEmployeeById(nurseRoster, 0L);
        Assignment leftAssignment = findAssignmentById(nurseRoster, 200204001L);
        assertEquals(leftEmployee, leftAssignment.getEmployee());
        Employee rightEmployee = findEmployeeById(nurseRoster, 12L);
View Full Code Here

        Employee rightEmployee = findEmployeeById(nurseRoster, 12L);
        Assignment rightAssignment = findAssignmentById(nurseRoster, 200204002L);
        assertEquals(rightEmployee, rightAssignment.getEmployee());
        NurseRosteringMoveHelper.moveEmployee(workingMemory, leftAssignment, rightEmployee);
        NurseRosteringMoveHelper.moveEmployee(workingMemory, rightAssignment, leftEmployee);
        localSearchSolverScope.calculateScoreFromWorkingMemory();
        // undo AssignmentSwitchMove;
        NurseRosteringMoveHelper.moveEmployee(workingMemory, rightAssignment, rightEmployee);
        NurseRosteringMoveHelper.moveEmployee(workingMemory, leftAssignment, leftEmployee);
        Score secondScore = localSearchSolverScope.calculateScoreFromWorkingMemory();
        assertEquals(firstScore, secondScore);
View Full Code Here

        NurseRosteringMoveHelper.moveEmployee(workingMemory, rightAssignment, leftEmployee);
        localSearchSolverScope.calculateScoreFromWorkingMemory();
        // undo AssignmentSwitchMove;
        NurseRosteringMoveHelper.moveEmployee(workingMemory, rightAssignment, rightEmployee);
        NurseRosteringMoveHelper.moveEmployee(workingMemory, leftAssignment, leftEmployee);
        Score secondScore = localSearchSolverScope.calculateScoreFromWorkingMemory();
        assertEquals(firstScore, secondScore);
    }

    private RuleBase buildRuleBase() {
        PackageBuilder packageBuilder = new PackageBuilder();
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.