本文整理汇总了Java中org.cpsolver.coursett.criteria.SameSubpartBalancingPenalty类的典型用法代码示例。如果您正苦于以下问题:Java SameSubpartBalancingPenalty类的具体用法?Java SameSubpartBalancingPenalty怎么用?Java SameSubpartBalancingPenalty使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SameSubpartBalancingPenalty类属于org.cpsolver.coursett.criteria包,在下文中一共展示了SameSubpartBalancingPenalty类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCriterion
import org.cpsolver.coursett.criteria.SameSubpartBalancingPenalty; //导入依赖的package包/类
protected Criterion<Lecture, Placement> getCriterion() {
return getModel().getCriterion(SameSubpartBalancingPenalty.class);
}
示例2: getInfo
import org.cpsolver.coursett.criteria.SameSubpartBalancingPenalty; //导入依赖的package包/类
/** Global info */
@Override
public Map<String, String> getInfo(Assignment<Lecture, Placement> assignment) {
Map<String, String> ret = super.getInfo(assignment);
ret.put("Memory usage", getMem());
Criterion<Lecture, Placement> rp = getCriterion(RoomPreferences.class);
Criterion<Lecture, Placement> rv = getCriterion(RoomViolations.class);
ret.put("Room preferences", getPerc(rp.getValue(assignment), rp.getBounds(assignment)[0], rp.getBounds(assignment)[1]) + "% (" + Math.round(rp.getValue(assignment)) + ")"
+ (rv != null && rv.getValue(assignment) >= 0.5 ? " [hard:" + Math.round(rv.getValue(assignment)) + "]" : ""));
Criterion<Lecture, Placement> tp = getCriterion(TimePreferences.class);
Criterion<Lecture, Placement> tv = getCriterion(TimeViolations.class);
ret.put("Time preferences", getPerc(tp.getValue(assignment), tp.getBounds(assignment)[0], tp.getBounds(assignment)[1]) + "% (" + sDoubleFormat.format(tp.getValue(assignment)) + ")"
+ (tv != null && tv.getValue(assignment) >= 0.5 ? " [hard:" + Math.round(tv.getValue(assignment)) + "]" : ""));
Criterion<Lecture, Placement> dp = getCriterion(DistributionPreferences.class);
ret.put("Distribution preferences", getPerc(dp.getValue(assignment), dp.getBounds(assignment)[0], dp.getBounds(assignment)[1]) + "% (" + sDoubleFormat.format(dp.getValue(assignment)) + ")");
Criterion<Lecture, Placement> sc = getCriterion(StudentConflict.class);
Criterion<Lecture, Placement> shc = getCriterion(StudentHardConflict.class);
Criterion<Lecture, Placement> sdc = getCriterion(StudentDistanceConflict.class);
Criterion<Lecture, Placement> scc = getCriterion(StudentCommittedConflict.class);
ret.put("Student conflicts", Math.round(scc.getValue(assignment) + sc.getValue(assignment)) +
" [committed:" + Math.round(scc.getValue(assignment)) +
", distance:" + Math.round(sdc.getValue(assignment)) +
", hard:" + Math.round(shc.getValue(assignment)) + "]");
if (!getSpreadConstraints().isEmpty()) {
Criterion<Lecture, Placement> ip = getCriterion(BackToBackInstructorPreferences.class);
ret.put("Back-to-back instructor preferences", getPerc(ip.getValue(assignment), ip.getBounds(assignment)[0], ip.getBounds(assignment)[1]) + "% (" + Math.round(ip.getValue(assignment)) + ")");
}
if (!getDepartmentSpreadConstraints().isEmpty()) {
Criterion<Lecture, Placement> dbp = getCriterion(DepartmentBalancingPenalty.class);
ret.put("Department balancing penalty", sDoubleFormat.format(dbp.getValue(assignment)));
}
Criterion<Lecture, Placement> sbp = getCriterion(SameSubpartBalancingPenalty.class);
ret.put("Same subpart balancing penalty", sDoubleFormat.format(sbp.getValue(assignment)));
Criterion<Lecture, Placement> tbr = getCriterion(TooBigRooms.class);
ret.put("Too big rooms", getPercRev(tbr.getValue(assignment), tbr.getBounds(assignment)[1], tbr.getBounds(assignment)[0]) + "% (" + Math.round(tbr.getValue(assignment)) + ")");
Criterion<Lecture, Placement> uh = getCriterion(UselessHalfHours.class);
Criterion<Lecture, Placement> bt = getCriterion(BrokenTimePatterns.class);
ret.put("Useless half-hours", getPercRev(uh.getValue(assignment) + bt.getValue(assignment), 0, Constants.sPreferenceLevelStronglyDiscouraged * bt.getBounds(assignment)[0]) +
"% (" + Math.round(uh.getValue(assignment)) + " + " + Math.round(bt.getValue(assignment)) + ")");
return ret;
}