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


Java StudentDirectConflicts类代码示例

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


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

示例1: ExamAssignment

import org.cpsolver.exam.criteria.StudentDirectConflicts; //导入依赖的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(); 
    }
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:39,代码来源:ExamAssignment.java

示例2: report

import org.cpsolver.exam.criteria.StudentDirectConflicts; //导入依赖的package包/类
/**
 * generate report
 * @param assignment current assignment
 * @return resultant report
 */
public CSVFile report(Assignment<Exam, ExamPlacement> assignment) {
    CSVFile csv = new CSVFile();
    csv.setHeader(new CSVField[] { new CSVField("Exam"), new CSVField("Enrl"), new CSVField("Direct"),
            new CSVField("Direct [%]"), new CSVField("More-2-Day"), new CSVField("More-2-Day [%]"),
            new CSVField("Back-To-Back"), new CSVField("Back-To-Back [%]"), new CSVField("Dist Back-To-Back"),
            new CSVField("Dist Back-To-Back [%]") });
    DecimalFormat df = new DecimalFormat("0.0");
    for (Exam exam : iModel.variables()) {
        ExamPlacement placement = assignment.getValue(exam);
        if (placement == null)
            continue;
        int dc = (int)iModel.getCriterion(StudentDirectConflicts.class).getValue(assignment, placement, null) +
                 (int)iModel.getCriterion(StudentNotAvailableConflicts.class).getValue(assignment, placement, null);
        int btb = (int)iModel.getCriterion(StudentBackToBackConflicts.class).getValue(assignment, placement, null);
        int dbtb = (int)iModel.getCriterion(StudentDistanceBackToBackConflicts.class).getValue(assignment, placement, null);
        int m2d = (int)iModel.getCriterion(StudentMoreThan2ADayConflicts.class).getValue(assignment, placement, null);
        if (dc == 0 && m2d == 0 && btb == 0 && dbtb == 0)
            continue;
        /*
         * String section = ""; for (Enumeration
         * f=exam.getCourseSections().elements();f.hasMoreElements();) {
         * ExamCourseSection cs = (ExamCourseSection)f.nextElement(); if
         * (section.length()>0) section+="\n"; section += cs.getName(); }
         */
        csv.addLine(new CSVField[] {
                new CSVField(exam.getName()),
                new CSVField(exam.getStudents().size()),
                new CSVField(dc),
                new CSVField(df.format(100.0 * dc / exam.getStudents().size())),
                new CSVField(m2d),
                new CSVField(df.format(100.0 * m2d / exam.getStudents().size())),
                new CSVField(btb),
                new CSVField(df.format(100.0 * btb / exam.getStudents().size())),
                new CSVField(dbtb),
                new CSVField(df.format(100.0 * dbtb / exam.getStudents().size())) });
    }
    return csv;
}
 
开发者ID:UniTime,项目名称:cpsolver,代码行数:44,代码来源:ExamStudentConflictsPerExam.java

示例3: init

import org.cpsolver.exam.criteria.StudentDirectConflicts; //导入依赖的package包/类
/** Initialization */
@Override
public boolean init(Solver<Exam, ExamPlacement> solver) {
    boolean ret = super.init(solver);
    iStudentDirectConflicts = solver.currentSolution().getModel().getCriterion(StudentDirectConflicts.class);
    iStudentMoreThan2ADayConflicts = solver.currentSolution().getModel().getCriterion(StudentMoreThan2ADayConflicts.class);
    iStudentBackToBackConflicts = solver.currentSolution().getModel().getCriterion(StudentBackToBackConflicts.class);
    return ret;
}
 
开发者ID:UniTime,项目名称:cpsolver,代码行数:10,代码来源:ExamSplitter.java


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