當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。