当前位置: 首页>>代码示例>>Java>>正文


Java TooBigRooms类代码示例

本文整理汇总了Java中org.cpsolver.coursett.criteria.TooBigRooms的典型用法代码示例。如果您正苦于以下问题:Java TooBigRooms类的具体用法?Java TooBigRooms怎么用?Java TooBigRooms使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TooBigRooms类属于org.cpsolver.coursett.criteria包,在下文中一共展示了TooBigRooms类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getBounds

import org.cpsolver.coursett.criteria.TooBigRooms; //导入依赖的package包/类
public Map<String, String> getBounds(Assignment<Lecture, Placement> assignment) {
    Map<String, String> ret = new HashMap<String, String>();
    ret.put("Room preferences min", "" + getCriterion(RoomPreferences.class).getBounds(assignment)[0]);
    ret.put("Room preferences max", "" + getCriterion(RoomPreferences.class).getBounds(assignment)[1]);
    ret.put("Time preferences min", "" + getCriterion(TimePreferences.class).getBounds(assignment)[0]);
    ret.put("Time preferences max", "" + getCriterion(TimePreferences.class).getBounds(assignment)[1]);
    ret.put("Distribution preferences min", "" + getCriterion(DistributionPreferences.class).getBounds(assignment)[0]);
    ret.put("Distribution preferences max", "" + getCriterion(DistributionPreferences.class).getBounds(assignment)[1]);
    if (getProperties().getPropertyBoolean("General.UseDistanceConstraints", false)) {
        ret.put("Back-to-back instructor preferences max", "" + getCriterion(BackToBackInstructorPreferences.class).getBounds(assignment)[1]);
    }
    ret.put("Too big rooms max", "" + getCriterion(TooBigRooms.class).getBounds(assignment)[0]);
    ret.put("Useless half-hours", "" + getCriterion(UselessHalfHours.class).getBounds(assignment)[0]);
    return ret;
}
 
开发者ID:UniTime,项目名称:cpsolver,代码行数:16,代码来源:TimetableModel.java

示例2: getInfo

import org.cpsolver.coursett.criteria.TooBigRooms; //导入依赖的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;
}
 
开发者ID:UniTime,项目名称:cpsolver,代码行数:52,代码来源:TimetableModel.java

示例3: notify

import org.cpsolver.coursett.criteria.TooBigRooms; //导入依赖的package包/类
/** Add a line into the output CSV file when a enw best solution is found. 
 * @param solution current solution
 **/
public void notify(Solution<Lecture, Placement> solution) {
    String colSeparator = ";";
    Assignment<Lecture, Placement> assignment = solution.getAssignment();
    if (assignment.nrAssignedVariables() < solution.getModel().countVariables() && iLastNotified == assignment.nrAssignedVariables())
        return;
    iLastNotified = assignment.nrAssignedVariables();
    if (iCSVFile != null) {
        TimetableModel model = (TimetableModel) solution.getModel();
        iCSVFile.print(model.variables().size() - model.nrUnassignedVariables(assignment));
        iCSVFile.print(colSeparator);
        iCSVFile.print(sDoubleFormat.format(100.0 * assignment.nrAssignedVariables() / model.variables().size()));
        iCSVFile.print(colSeparator);
        iCSVFile.print(sDoubleFormat.format((solution.getTime()) / 60.0));
        iCSVFile.print(colSeparator);
        iCSVFile.print(solution.getIteration());
        iCSVFile.print(colSeparator);
        iCSVFile.print(sDoubleFormat.format(100.0 * assignment.nrAssignedVariables() / solution.getIteration()));
        iCSVFile.print(colSeparator);
        iCSVFile.print(sDoubleFormat.format((solution.getIteration()) / solution.getTime()));
        iCSVFile.print(colSeparator);
        iCSVFile.print(model.perturbVariables(assignment).size());
        iCSVFile.print(colSeparator);
        iCSVFile.print(sDoubleFormat.format(100.0 * model.perturbVariables(assignment).size() / model.variables().size()));
        iCSVFile.print(colSeparator);
        iCSVFile.print(Math.round(solution.getModel().getCriterion(StudentHardConflict.class).getValue(assignment)));
        iCSVFile.print(colSeparator);
        iCSVFile.print(Math.round(solution.getModel().getCriterion(StudentConflict.class).getValue(assignment)));
        iCSVFile.print(colSeparator);
        iCSVFile.print(Math.round(solution.getModel().getCriterion(StudentDistanceConflict.class).getValue(assignment)));
        iCSVFile.print(colSeparator);
        iCSVFile.print(Math.round(solution.getModel().getCriterion(StudentCommittedConflict.class).getValue(assignment)));
        iCSVFile.print(colSeparator);
        iCSVFile.print(sDoubleFormat.format(solution.getModel().getCriterion(TimePreferences.class).getValue(assignment)));
        iCSVFile.print(colSeparator);
        iCSVFile.print(Math.round(solution.getModel().getCriterion(RoomPreferences.class).getValue(assignment)));
        iCSVFile.print(colSeparator);
        iCSVFile.print(Math.round(solution.getModel().getCriterion(BackToBackInstructorPreferences.class).getValue(assignment)));
        iCSVFile.print(colSeparator);
        iCSVFile.print(Math.round(solution.getModel().getCriterion(DistributionPreferences.class).getValue(assignment)));
        iCSVFile.print(colSeparator);
        iCSVFile.print(Math.round(solution.getModel().getCriterion(UselessHalfHours.class).getValue(assignment)));
        iCSVFile.print(colSeparator);
        iCSVFile.print(Math.round(solution.getModel().getCriterion(BrokenTimePatterns.class).getValue(assignment)));
        iCSVFile.print(colSeparator);
        iCSVFile.print(Math.round(solution.getModel().getCriterion(TooBigRooms.class).getValue(assignment)));
        if (iProp != null) {
            if (solution.getModel().nrUnassignedVariables(assignment) > 0) {
                int goodVariables = 0;
                long goodValues = 0;
                long allValues = 0;
                for (Lecture variable : ((TimetableModel) solution.getModel()).unassignedVariables(assignment)) {
                    goodValues += iProp.goodValues(assignment, variable).size();
                    allValues += variable.values(solution.getAssignment()).size();
                    if (!iProp.goodValues(assignment, variable).isEmpty())
                        goodVariables++;
                }
                iCSVFile.print(colSeparator);
                iCSVFile.print(goodVariables);
                iCSVFile.print(colSeparator);
                iCSVFile.print(sDoubleFormat.format(100.0 * goodVariables / solution.getModel().nrUnassignedVariables(assignment)));
                iCSVFile.print(colSeparator);
                iCSVFile.print(goodValues);
                iCSVFile.print(colSeparator);
                iCSVFile.print(sDoubleFormat.format(100.0 * goodValues / allValues));
            } else {
                iCSVFile.print(colSeparator);
                iCSVFile.print(colSeparator);
                iCSVFile.print(colSeparator);
                iCSVFile.print(colSeparator);
            }
        }
        iCSVFile.println();
        iCSVFile.flush();
    }
}
 
开发者ID:UniTime,项目名称:cpsolver,代码行数:79,代码来源:Test.java


注:本文中的org.cpsolver.coursett.criteria.TooBigRooms类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。