Search in sources :

Example 1 with BranchBoundSelection

use of org.cpsolver.studentsct.heuristics.selection.BranchBoundSelection in project cpsolver by UniTime.

the class StudentSctBBTest method getSolution.

/**
     * Compute and return the sectioning solution. It contains only the given
     * student with his/her schedule
     * @return current solution
     */
public Solution<Request, Enrollment> getSolution() {
    if (iSolution == null) {
        iSolution = new Solution<Request, Enrollment>(this, new DefaultSingleAssignment<Request, Enrollment>());
        BranchBoundSelection.Selection selection = new BranchBoundSelection(new DataProperties()).getSelection(iSolution.getAssignment(), getStudent());
        Neighbour<Request, Enrollment> neighbour = selection.select();
        if (neighbour != null)
            neighbour.assign(iSolution.getAssignment(), 0);
        iTime = selection.getTime();
        iTimeoutReached = selection.isTimeoutReached();
    }
    return iSolution;
}
Also used : BranchBoundSelection(org.cpsolver.studentsct.heuristics.selection.BranchBoundSelection) CourseRequest(org.cpsolver.studentsct.model.CourseRequest) Request(org.cpsolver.studentsct.model.Request) DataProperties(org.cpsolver.ifs.util.DataProperties) Enrollment(org.cpsolver.studentsct.model.Enrollment) DefaultSingleAssignment(org.cpsolver.ifs.assignment.DefaultSingleAssignment)

Example 2 with BranchBoundSelection

use of org.cpsolver.studentsct.heuristics.selection.BranchBoundSelection in project cpsolver by UniTime.

the class StudentSctNeighbourSelection method setup.

public void setup(Solver<Request, Enrollment> solver) {
    if (iMPP)
        registerSelection(new AssignInitialSelection(solver.getProperties()));
    // Phase 1: section all students using incremental branch & bound (no
    // unassignments)
    registerSelection(iUseConstruction ? new PriorityConstructionSelection(solver.getProperties()) : new BranchBoundSelection(solver.getProperties()));
    // Phase 2: pick a student (one by one) with an incomplete schedule, try
    // to find an improvement
    registerSelection(new SwapStudentSelection(solver.getProperties()));
    // Phase 3: use standard value selection for some time
    registerSelection(new StandardSelection(solver.getProperties(), getVariableSelection(), getValueSelection()));
    // Phase 4: use backtrack neighbour selection
    registerSelection(new BacktrackSelection(solver.getProperties()));
    // Phase 5: pick a student (one by one) with an incomplete schedule, try
    // to find an improvement, identify problematic students
    SwapStudentSelection swapStudentSelection = new SwapStudentSelection(solver.getProperties());
    registerSelection(swapStudentSelection);
    // Phase 6: random unassignment of some problematic students
    registerSelection(new RndUnProblStudSelection(solver.getProperties(), swapStudentSelection));
    // Phase 7: resection incomplete students
    registerSelection(new ResectionIncompleteStudentsSelection(solver.getProperties()));
    // Phase 8: resection of students that were unassigned in step 6
    registerSelection(new ResectionUnassignedStudentsSelection(solver.getProperties()));
    // Phase 9: pick a student (one by one) with an incomplete schedule, try
    // to find an improvement
    registerSelection(new SwapStudentSelection(solver.getProperties()));
    // Phase 10: use standard value selection for some time
    registerSelection(new StandardSelection(solver.getProperties(), new RouletteWheelRequestSelection(solver.getProperties()), getValueSelection()));
    // Phase 11: pick a student (one by one) with an incomplete schedule,
    // try to find an improvement
    registerSelection(new SwapStudentSelection(solver.getProperties()));
    // Phase 12: use backtrack neighbour selection
    registerSelection(new BacktrackSelection(solver.getProperties()));
    if (iShuffleStudentsSelection) {
        // Phase 13: try shuffling students around request groups
        registerSelection(new ShuffleStudentsSelection(solver.getProperties()));
        // Phase 14: use backtrack neighbour selection to fix unassignments from the previous phase
        registerSelection(new BacktrackSelection(solver.getProperties()));
    }
    // Phase 15: random unassignment of some students
    registerSelection(new RandomUnassignmentSelection(solver.getProperties()));
}
Also used : PriorityConstructionSelection(org.cpsolver.studentsct.heuristics.selection.PriorityConstructionSelection) ResectionIncompleteStudentsSelection(org.cpsolver.studentsct.heuristics.selection.ResectionIncompleteStudentsSelection) ShuffleStudentsSelection(org.cpsolver.studentsct.heuristics.selection.ShuffleStudentsSelection) StandardSelection(org.cpsolver.studentsct.heuristics.selection.StandardSelection) RandomUnassignmentSelection(org.cpsolver.studentsct.heuristics.selection.RandomUnassignmentSelection) BacktrackSelection(org.cpsolver.studentsct.heuristics.selection.BacktrackSelection) ResectionUnassignedStudentsSelection(org.cpsolver.studentsct.heuristics.selection.ResectionUnassignedStudentsSelection) BranchBoundSelection(org.cpsolver.studentsct.heuristics.selection.BranchBoundSelection) RndUnProblStudSelection(org.cpsolver.studentsct.heuristics.selection.RndUnProblStudSelection) AssignInitialSelection(org.cpsolver.studentsct.heuristics.selection.AssignInitialSelection) SwapStudentSelection(org.cpsolver.studentsct.heuristics.selection.SwapStudentSelection)

Aggregations

BranchBoundSelection (org.cpsolver.studentsct.heuristics.selection.BranchBoundSelection)2 DefaultSingleAssignment (org.cpsolver.ifs.assignment.DefaultSingleAssignment)1 DataProperties (org.cpsolver.ifs.util.DataProperties)1 AssignInitialSelection (org.cpsolver.studentsct.heuristics.selection.AssignInitialSelection)1 BacktrackSelection (org.cpsolver.studentsct.heuristics.selection.BacktrackSelection)1 PriorityConstructionSelection (org.cpsolver.studentsct.heuristics.selection.PriorityConstructionSelection)1 RandomUnassignmentSelection (org.cpsolver.studentsct.heuristics.selection.RandomUnassignmentSelection)1 ResectionIncompleteStudentsSelection (org.cpsolver.studentsct.heuristics.selection.ResectionIncompleteStudentsSelection)1 ResectionUnassignedStudentsSelection (org.cpsolver.studentsct.heuristics.selection.ResectionUnassignedStudentsSelection)1 RndUnProblStudSelection (org.cpsolver.studentsct.heuristics.selection.RndUnProblStudSelection)1 ShuffleStudentsSelection (org.cpsolver.studentsct.heuristics.selection.ShuffleStudentsSelection)1 StandardSelection (org.cpsolver.studentsct.heuristics.selection.StandardSelection)1 SwapStudentSelection (org.cpsolver.studentsct.heuristics.selection.SwapStudentSelection)1 CourseRequest (org.cpsolver.studentsct.model.CourseRequest)1 Enrollment (org.cpsolver.studentsct.model.Enrollment)1 Request (org.cpsolver.studentsct.model.Request)1