本文整理汇总了Java中org.cpsolver.studentsct.online.expectations.AvoidUnbalancedWhenNoExpectations类的典型用法代码示例。如果您正苦于以下问题:Java AvoidUnbalancedWhenNoExpectations类的具体用法?Java AvoidUnbalancedWhenNoExpectations怎么用?Java AvoidUnbalancedWhenNoExpectations使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AvoidUnbalancedWhenNoExpectations类属于org.cpsolver.studentsct.online.expectations包,在下文中一共展示了AvoidUnbalancedWhenNoExpectations类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getOverExpectedCriterion
import org.cpsolver.studentsct.online.expectations.AvoidUnbalancedWhenNoExpectations; //导入依赖的package包/类
@Override
public OverExpectedCriterion getOverExpectedCriterion() {
try {
Class<OverExpectedCriterion> overExpectedCriterionClass = (Class<OverExpectedCriterion>)Class.forName(getConfig().getProperty("OverExpectedCriterion.Class", AvoidUnbalancedWhenNoExpectations.class.getName()));
return overExpectedCriterionClass.getConstructor(DataProperties.class).newInstance(getConfig());
} catch (Exception e) {
iLog.error("Unable to create custom over-expected criterion (" + e.getMessage() + "), using default.", e);
return new AvoidUnbalancedWhenNoExpectations(getConfig());
}
}
示例2: OnlineSectioningModel
import org.cpsolver.studentsct.online.expectations.AvoidUnbalancedWhenNoExpectations; //导入依赖的package包/类
public OnlineSectioningModel(DataProperties properties) {
super(properties);
try {
@SuppressWarnings("unchecked")
Class<OverExpectedCriterion> overExpectedCriterionClass = (Class<OverExpectedCriterion>)
Class.forName(properties.getProperty("OverExpectedCriterion.Class", AvoidUnbalancedWhenNoExpectations.class.getName()));
iOverExpectedCriterion = overExpectedCriterionClass.getConstructor(DataProperties.class).newInstance(properties);
} catch (Exception e) {
sLog.error("Unable to create custom over-expected criterion (" + e.getMessage() + "), using default.", e);
iOverExpectedCriterion = new PercentageOverExpected(properties);
}
}
示例3: Test
import org.cpsolver.studentsct.online.expectations.AvoidUnbalancedWhenNoExpectations; //导入依赖的package包/类
public Test(DataProperties config) {
iModel = new TestModel(config);
iModel.setDistanceConflict(new DistanceConflict(new DistanceMetric(iModel.getProperties()), iModel.getProperties()));
iModel.getDistanceConflict().register(iModel);
iModel.getDistanceConflict().setAssignmentContextReference(iModel.createReference(iModel.getDistanceConflict()));
iModel.setTimeOverlaps(new TimeOverlapsCounter(null, iModel.getProperties()));
iModel.getTimeOverlaps().register(iModel);
iModel.getTimeOverlaps().setAssignmentContextReference(iModel.createReference(iModel.getTimeOverlaps()));
iModel.setStudentWeights(new StudentSchedulingAssistantWeights(iModel.getProperties()));
iAssignment = new DefaultSingleAssignment<Request, Enrollment>();
iSuggestions = "true".equals(System.getProperty("suggestions", iSuggestions ? "true" : "false"));
String overexp = System.getProperty("overexp");
if (overexp != null) {
boolean bal = false;
if (overexp.startsWith("b")) {
bal = true;
overexp = overexp.substring(1);
}
String[] x = overexp.split("[/\\-]");
if (x.length == 1) {
iModel.setOverExpectedCriterion(new PercentageOverExpected(Double.valueOf(x[0])));
} else if (x.length == 2) {
iModel.setOverExpectedCriterion(bal ? new AvoidUnbalancedWhenNoExpectations(Double.valueOf(x[0]), Double.valueOf(x[1]) / 100.0) :
new FractionallyOverExpected(Double.valueOf(x[0]), Double.valueOf(x[1])));
} else {
iModel.setOverExpectedCriterion(new FractionallyUnbalancedWhenNoExpectations(Double.valueOf(x[0]),
Double.valueOf(x[1]), Double.valueOf(x[2]) / 100.0));
}
}
sLog.info("Using " + (config.getPropertyBoolean("StudentWeights.MultiCriteria", true) ? "multi-criteria " : "")
+ (config.getPropertyBoolean("StudentWeights.PriorityWeighting", true) ? "priority" : "equal")
+ " weighting model" + " with over-expected " + iModel.getOverExpectedCriterion()
+ (iSuggestions ? ", suggestions" : "") + ", " + System.getProperty("sort", "shuffle") + " order"
+ " and " + config.getPropertyInt("Neighbour.BranchAndBoundTimeout", 1000) + " ms time limit.");
}