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;
}
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;
}
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;
}
Aggregations