本文整理汇总了Java中org.cpsolver.exam.criteria.PeriodPenalty类的典型用法代码示例。如果您正苦于以下问题:Java PeriodPenalty类的具体用法?Java PeriodPenalty怎么用?Java PeriodPenalty使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PeriodPenalty类属于org.cpsolver.exam.criteria包,在下文中一共展示了PeriodPenalty类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ExamAssignment
import org.cpsolver.exam.criteria.PeriodPenalty; //导入依赖的package包/类
public ExamAssignment(org.cpsolver.exam.model.Exam exam, ExamPlacement placement, Assignment<org.cpsolver.exam.model.Exam, ExamPlacement> assignment) {
super(exam);
if (placement!=null) {
iNrDirectConflicts = (int)exam.getModel().getCriterion(StudentDirectConflicts.class).getValue(assignment, placement, null) +
(int)exam.getModel().getCriterion(StudentNotAvailableConflicts.class).getValue(assignment, placement, null);
iNrMoreThanTwoADayConflicts = (int)exam.getModel().getCriterion(StudentMoreThan2ADayConflicts.class).getValue(assignment, placement, null);
iNrBackToBackConflicts = (int)exam.getModel().getCriterion(StudentBackToBackConflicts.class).getValue(assignment, placement, null);
iNrDistanceBackToBackConflicts = (int)exam.getModel().getCriterion(StudentDistanceBackToBackConflicts.class).getValue(assignment, placement, null);
iPeriodPenalty = (int)exam.getModel().getCriterion(PeriodPenalty.class).getValue(assignment, placement, null);
iRoomSizePenalty = (int)exam.getModel().getCriterion(RoomSizePenalty.class).getValue(assignment, placement, null);
iRoomSplitPenalty = (int)exam.getModel().getCriterion(RoomSplitPenalty.class).getValue(assignment, placement, null);
iRotationPenalty = (int)exam.getModel().getCriterion(ExamRotationPenalty.class).getValue(assignment, placement, null);
iRoomPenalty = (int)exam.getModel().getCriterion(RoomPenalty.class).getValue(assignment, placement, null);
iNrInstructorDirectConflicts = (int)exam.getModel().getCriterion(InstructorDirectConflicts.class).getValue(assignment, placement, null) +
(int)exam.getModel().getCriterion(InstructorNotAvailableConflicts.class).getValue(assignment, placement, null);
iNrInstructorMoreThanTwoADayConflicts = (int)exam.getModel().getCriterion(InstructorMoreThan2ADayConflicts.class).getValue(assignment, placement, null);
iNrInstructorBackToBackConflicts = (int)exam.getModel().getCriterion(InstructorBackToBackConflicts.class).getValue(assignment, placement, null);
iNrInstructorDistanceBackToBackConflicts = (int)exam.getModel().getCriterion(InstructorDistanceBackToBackConflicts.class).getValue(assignment, placement, null);
iValue = placement.toDouble(assignment);
iPeriodId = placement.getPeriod().getId();
iPeriodIdx = placement.getPeriod().getIndex();
iRooms = new TreeSet<ExamRoomInfo>();
iPeriodPref = (exam.getPeriodPlacements().size()==1?PreferenceLevel.sRequired:PreferenceLevel.int2prolog(iPeriodPenalty));
if (placement.getRoomPlacements()!=null) {
boolean reqRoom = placement.getRoomPlacements().size()==exam.getRoomPlacements().size();
for (Iterator i=placement.getRoomPlacements().iterator();i.hasNext();) {
ExamRoomPlacement room = (ExamRoomPlacement)i.next();
iRooms.add(new ExamRoomInfo(room.getRoom(), (reqRoom?PreferenceLevel.sIntLevelRequired:room.getPenalty(placement.getPeriod()))));
}
}
MinMaxPreferenceCombination pc = new MinMaxPreferenceCombination();
for (ExamDistributionConstraint dc: placement.variable().getDistributionConstraints()) {
if (dc.isHard() || dc.isSatisfied(assignment)) continue;
pc.addPreferenceInt(dc.getWeight());
}
iDistPref = pc.getPreferenceProlog();
}
}