Search in sources :

Example 1 with StudentConflict

use of org.cpsolver.studentsct.constraint.StudentConflict in project cpsolver by UniTime.

the class StudentSectioningModel method removeStudent.

/**
     * Remove a student from the model
     * @param student a student to be removed from the problem
     */
public void removeStudent(Student student) {
    iStudents.remove(student);
    if (student.isDummy())
        iNrDummyStudents--;
    StudentConflict conflict = null;
    for (Request request : student.getRequests()) {
        for (Constraint<Request, Enrollment> c : request.constraints()) {
            if (c instanceof StudentConflict) {
                conflict = (StudentConflict) c;
                break;
            }
        }
        if (conflict != null)
            conflict.removeVariable(request);
        removeVariable(request);
    }
    if (conflict != null)
        removeConstraint(conflict);
}
Also used : StudentConflict(org.cpsolver.studentsct.constraint.StudentConflict) Request(org.cpsolver.studentsct.model.Request) CourseRequest(org.cpsolver.studentsct.model.CourseRequest) Enrollment(org.cpsolver.studentsct.model.Enrollment)

Aggregations

StudentConflict (org.cpsolver.studentsct.constraint.StudentConflict)1 CourseRequest (org.cpsolver.studentsct.model.CourseRequest)1 Enrollment (org.cpsolver.studentsct.model.Enrollment)1 Request (org.cpsolver.studentsct.model.Request)1