Search in sources :

Example 1 with RandomizedBacktrackNeighbourSelection

use of org.cpsolver.studentsct.heuristics.RandomizedBacktrackNeighbourSelection in project cpsolver by UniTime.

the class BacktrackSelection method init.

public void init(Solver<Request, Enrollment> solver, String name) {
    List<Request> variables = new ArrayList<Request>(iIncludeAssignedRequests ? solver.currentSolution().getModel().variables() : solver.currentSolution().getModel().unassignedVariables(solver.currentSolution().getAssignment()));
    Collections.shuffle(variables);
    iRequests = new LinkedList<Request>(variables);
    if (iRBtNSel == null) {
        try {
            iRBtNSel = new RandomizedBacktrackNeighbourSelection(solver.getProperties());
            iRBtNSel.init(solver);
        } catch (Exception e) {
            throw new RuntimeException(e.getMessage(), e);
        }
    }
    Progress.getInstance(solver.currentSolution().getModel()).setPhase(name, variables.size());
}
Also used : RandomizedBacktrackNeighbourSelection(org.cpsolver.studentsct.heuristics.RandomizedBacktrackNeighbourSelection) ArrayList(java.util.ArrayList) Request(org.cpsolver.studentsct.model.Request)

Aggregations

ArrayList (java.util.ArrayList)1 RandomizedBacktrackNeighbourSelection (org.cpsolver.studentsct.heuristics.RandomizedBacktrackNeighbourSelection)1 Request (org.cpsolver.studentsct.model.Request)1