Search in sources :

Example 6 with Lecture

use of org.cpsolver.coursett.model.Lecture in project cpsolver by UniTime.

the class TimePreferences method getBounds.

@Override
public double[] getBounds(Assignment<Lecture, Placement> assignment, Collection<Lecture> variables) {
    double[] bounds = new double[] { 0.0, 0.0 };
    for (Lecture lect : variables) {
        if (lect.isCommitted())
            continue;
        double[] p = lect.getMinMaxTimePreference();
        bounds[1] += lect.getWeight() * (p[1] - p[0]);
    }
    return bounds;
}
Also used : Lecture(org.cpsolver.coursett.model.Lecture)

Example 7 with Lecture

use of org.cpsolver.coursett.model.Lecture in project cpsolver by UniTime.

the class BrokenTimePatterns method getValue.

@Override
public double getValue(Assignment<Lecture, Placement> assignment, Collection<Lecture> variables) {
    double ret = 0;
    Set<RoomConstraint> constraints = new HashSet<RoomConstraint>();
    for (Lecture lect : variables) {
        Placement placement = assignment.getValue(lect);
        if (placement == null)
            continue;
        if (placement.isMultiRoom()) {
            for (RoomLocation r : placement.getRoomLocations()) {
                if (r.getRoomConstraint() != null && constraints.add(r.getRoomConstraint()))
                    ret += penalty(r.getRoomConstraint().getContext(assignment));
            }
        } else if (placement.getRoomLocation().getRoomConstraint() != null && constraints.add(placement.getRoomLocation().getRoomConstraint())) {
            ret += penalty(placement.getRoomLocation().getRoomConstraint().getContext(assignment));
        }
    }
    return ret;
}
Also used : RoomConstraint(org.cpsolver.coursett.constraint.RoomConstraint) Lecture(org.cpsolver.coursett.model.Lecture) Placement(org.cpsolver.coursett.model.Placement) RoomLocation(org.cpsolver.coursett.model.RoomLocation) HashSet(java.util.HashSet)

Example 8 with Lecture

use of org.cpsolver.coursett.model.Lecture in project cpsolver by UniTime.

the class DistributionPreferences method getBounds.

@Override
public double[] getBounds(Assignment<Lecture, Placement> assignment, Collection<Lecture> variables) {
    double[] bounds = new double[] { 0.0, 0.0 };
    Set<GroupConstraint> constraints = new HashSet<GroupConstraint>();
    for (Lecture lect : variables) {
        for (GroupConstraint gc : lect.groupConstraints()) {
            if (!gc.isHard() && constraints.add(gc)) {
                bounds[1] += Math.abs(gc.getPreference()) * (1 + (gc.variables().size() * (gc.variables().size() - 1)) / 2);
            }
        }
    }
    return bounds;
}
Also used : Lecture(org.cpsolver.coursett.model.Lecture) GroupConstraint(org.cpsolver.coursett.constraint.GroupConstraint) HashSet(java.util.HashSet)

Example 9 with Lecture

use of org.cpsolver.coursett.model.Lecture in project cpsolver by UniTime.

the class IgnoredCommittedStudentConflict method countCommittedConflicts.

public double countCommittedConflicts(Placement placement) {
    double ret = 0;
    Lecture lecture = placement.variable();
    for (Student student : lecture.students()) {
        ret += countCommittedConflicts(student, placement);
    }
    return ret;
}
Also used : Lecture(org.cpsolver.coursett.model.Lecture) Student(org.cpsolver.coursett.model.Student)

Example 10 with Lecture

use of org.cpsolver.coursett.model.Lecture in project cpsolver by UniTime.

the class FlexibleConstraintCriterion method getValue.

@Override
public double getValue(Assignment<Lecture, Placement> assignment, Placement value, Set<Placement> conflicts) {
    HashMap<Lecture, Placement> assignments = new HashMap<Lecture, Placement>();
    assignments.put(value.variable(), value);
    double ret = 0.0;
    for (FlexibleConstraint gc : value.variable().getFlexibleGroupConstraints()) ret += gc.getCurrentPreference(assignment, conflicts, assignments);
    assignments.put(value.variable(), null);
    for (FlexibleConstraint gc : value.variable().getFlexibleGroupConstraints()) ret -= gc.getCurrentPreference(assignment, conflicts, assignments);
    return ret;
}
Also used : FlexibleConstraint(org.cpsolver.coursett.constraint.FlexibleConstraint) Lecture(org.cpsolver.coursett.model.Lecture) HashMap(java.util.HashMap) Placement(org.cpsolver.coursett.model.Placement)

Aggregations

Lecture (org.cpsolver.coursett.model.Lecture)96 Placement (org.cpsolver.coursett.model.Placement)55 HashSet (java.util.HashSet)35 TimetableModel (org.cpsolver.coursett.model.TimetableModel)17 WeakeningConstraint (org.cpsolver.ifs.model.WeakeningConstraint)17 HashMap (java.util.HashMap)16 ArrayList (java.util.ArrayList)14 TimeLocation (org.cpsolver.coursett.model.TimeLocation)14 Constraint (org.cpsolver.ifs.model.Constraint)14 InstructorConstraint (org.cpsolver.coursett.constraint.InstructorConstraint)13 Student (org.cpsolver.coursett.model.Student)13 BitSet (java.util.BitSet)11 JenrlConstraint (org.cpsolver.coursett.constraint.JenrlConstraint)10 GlobalConstraint (org.cpsolver.ifs.model.GlobalConstraint)9 RoomLocation (org.cpsolver.coursett.model.RoomLocation)8 Set (java.util.Set)7 TreeSet (java.util.TreeSet)7 GroupConstraint (org.cpsolver.coursett.constraint.GroupConstraint)7 StudentGroup (org.cpsolver.coursett.model.StudentGroup)7 RoomConstraint (org.cpsolver.coursett.constraint.RoomConstraint)6