Search in sources :

Example 6 with LinkedSections

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

the class CourseRequest method getEnrollmentsSkipSameTime.

/**
     * Return all possible enrollments, but pick only the first section of
     * the sections with the same time (of each subpart, {@link Section}
     * comparator is used).
     * @param assignment current assignment
     * @return computed enrollments 
     */
public List<Enrollment> getEnrollmentsSkipSameTime(Assignment<Request, Enrollment> assignment) {
    List<Enrollment> ret = new ArrayList<Enrollment>();
    int idx = 0;
    for (Course course : iCourses) {
        for (Config config : course.getOffering().getConfigs()) {
            boolean skipSameTime = true;
            for (LinkedSections link : getStudent().getLinkedSections()) if (link.getOfferings().contains(course.getOffering())) {
                skipSameTime = false;
                break;
            }
            computeEnrollments(assignment, ret, idx, 0, course, config, new HashSet<Section>(), 0, false, skipSameTime, false, false, getMaxDomainSize() <= 0 ? -1 : ret.size() + getMaxDomainSize());
        }
        idx++;
    }
    return ret;
}
Also used : LinkedSections(org.cpsolver.studentsct.constraint.LinkedSections) ArrayList(java.util.ArrayList)

Aggregations

LinkedSections (org.cpsolver.studentsct.constraint.LinkedSections)6 ArrayList (java.util.ArrayList)3 Offering (org.cpsolver.studentsct.model.Offering)2 Section (org.cpsolver.studentsct.model.Section)2 Subpart (org.cpsolver.studentsct.model.Subpart)2 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Hashtable (java.util.Hashtable)1 Set (java.util.Set)1 TreeSet (java.util.TreeSet)1 AssignmentMap (org.cpsolver.ifs.assignment.AssignmentMap)1 StudentPreferencePenalties (org.cpsolver.studentsct.StudentPreferencePenalties)1 DistanceConflict (org.cpsolver.studentsct.extension.DistanceConflict)1 TimeOverlapsCounter (org.cpsolver.studentsct.extension.TimeOverlapsCounter)1 BranchBoundNeighbour (org.cpsolver.studentsct.heuristics.selection.BranchBoundSelection.BranchBoundNeighbour)1 Config (org.cpsolver.studentsct.model.Config)1 Course (org.cpsolver.studentsct.model.Course)1 CourseRequest (org.cpsolver.studentsct.model.CourseRequest)1 Enrollment (org.cpsolver.studentsct.model.Enrollment)1 FreeTimeRequest (org.cpsolver.studentsct.model.FreeTimeRequest)1