Search in sources :

Example 1 with StudentConflict

use of org.cpsolver.coursett.criteria.StudentConflict in project cpsolver by UniTime.

the class SctSectioning method value.

/**
     * Student conflict weight for the given solution
     */
protected double value(Solution<Lecture, Placement> solution) {
    List<StudentConflict> criteria = getStudentConflictCriteria();
    if (criteria == null) {
        double value = 0.0;
        for (JenrlConstraint constraint : ((TimetableModel) solution.getModel()).getJenrlConstraints()) {
            if (constraint.isInConflict(solution.getAssignment()))
                value += constraint.jenrl();
        }
        return value;
    }
    double value = 0.0;
    for (StudentConflict criterion : criteria) value += criterion.getWeightedValue(solution.getAssignment());
    return value;
}
Also used : JenrlConstraint(org.cpsolver.coursett.constraint.JenrlConstraint) StudentConflict(org.cpsolver.coursett.criteria.StudentConflict) TimetableModel(org.cpsolver.coursett.model.TimetableModel)

Example 2 with StudentConflict

use of org.cpsolver.coursett.criteria.StudentConflict in project cpsolver by UniTime.

the class StudentSwapSectioning method objective.

/**
     * Student conflict weight of a solution 
     */
protected double objective(Solution<Lecture, Placement> solution) {
    List<StudentConflict> criteria = getStudentConflictCriteria();
    if (criteria == null) {
        double value = 0.0;
        for (JenrlConstraint constraint : ((TimetableModel) solution.getModel()).getJenrlConstraints()) {
            if (constraint.isInConflict(solution.getAssignment()))
                value += constraint.jenrl();
        }
        return value;
    }
    double value = 0.0;
    for (StudentConflict criterion : criteria) value += criterion.getWeightedValue(solution.getAssignment());
    return value;
}
Also used : JenrlConstraint(org.cpsolver.coursett.constraint.JenrlConstraint) StudentConflict(org.cpsolver.coursett.criteria.StudentConflict) TimetableModel(org.cpsolver.coursett.model.TimetableModel)

Example 3 with StudentConflict

use of org.cpsolver.coursett.criteria.StudentConflict in project cpsolver by UniTime.

the class SctStudent method getJenrConflictWeight.

/**
     * Conflict weight of a lecture pair
     */
public double getJenrConflictWeight(Lecture l1, Lecture l2) {
    Placement p1 = getModel().getAssignment().getValue(l1);
    Placement p2 = getModel().getAssignment().getValue(l2);
    if (p1 == null || p2 == null)
        return 0.0;
    if (getModel().getStudentConflictCriteria() == null) {
        if (JenrlConstraint.isInConflict(p1, p2, getModel().getTimetableModel().getDistanceMetric()))
            return getStudent().getJenrlWeight(l1, l2);
        return 0.0;
    }
    double weight = 0.0;
    for (StudentConflict sc : getModel().getStudentConflictCriteria()) if (sc.isApplicable(getStudent(), p1.variable(), p2.variable()) && sc.inConflict(p1, p2))
        weight += sc.getWeight() * getStudent().getJenrlWeight(l1, l2);
    return weight;
}
Also used : StudentConflict(org.cpsolver.coursett.criteria.StudentConflict) Placement(org.cpsolver.coursett.model.Placement)

Aggregations

StudentConflict (org.cpsolver.coursett.criteria.StudentConflict)3 JenrlConstraint (org.cpsolver.coursett.constraint.JenrlConstraint)2 TimetableModel (org.cpsolver.coursett.model.TimetableModel)2 Placement (org.cpsolver.coursett.model.Placement)1