當前位置: 首頁>>代碼示例>>Java>>正文


Java TimeOverlapsCounter.Conflict方法代碼示例

本文整理匯總了Java中org.cpsolver.studentsct.extension.TimeOverlapsCounter.Conflict方法的典型用法代碼示例。如果您正苦於以下問題:Java TimeOverlapsCounter.Conflict方法的具體用法?Java TimeOverlapsCounter.Conflict怎麽用?Java TimeOverlapsCounter.Conflict使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.cpsolver.studentsct.extension.TimeOverlapsCounter的用法示例。


在下文中一共展示了TimeOverlapsCounter.Conflict方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getWeight

import org.cpsolver.studentsct.extension.TimeOverlapsCounter; //導入方法依賴的package包/類
@Override
protected double getWeight(Enrollment enrollment, Set<DistanceConflict.Conflict> distanceConflicts,
        Set<TimeOverlapsCounter.Conflict> timeOverlappingConflicts) {
    double weight = super.getWeight(enrollment, distanceConflicts, timeOverlappingConflicts);
    if (enrollment.isCourseRequest() && iPreferredSections != null) {
        Set<Section> preferred = iPreferredSections.get(enrollment.getRequest());
        if (preferred != null && !preferred.isEmpty()) {
            double nrPreferred = 0;
            for (Section section : enrollment.getSections())
                if (preferred.contains(section))
                    nrPreferred++;
            double preferredFraction = nrPreferred / preferred.size();
            weight *= 1.0 + iPreferenceFactor * preferredFraction;
        }
    }
    return weight;
}
 
開發者ID:UniTime,項目名稱:cpsolver,代碼行數:18,代碼來源:SuggestionSelection.java

示例2: getTimeOverlappingConflicts

import org.cpsolver.studentsct.extension.TimeOverlapsCounter; //導入方法依賴的package包/類
/**
 * Time overlapping conflicts of idx-th assignment of the current schedule
 */
public Set<TimeOverlapsCounter.Conflict> getTimeOverlappingConflicts(Enrollment[] assignment, int idx) {
    if (getModel().getTimeOverlaps() == null || assignment[idx] == null)
        return null;
    Set<TimeOverlapsCounter.Conflict> overlaps = new HashSet<TimeOverlapsCounter.Conflict>();
    for (int x = 0; x < idx; x++)
        if (assignment[x] != null) {
            overlaps.addAll(getModel().getTimeOverlaps().conflicts(assignment[x], assignment[idx]));
        } else if (getStudent().getRequests().get(x) instanceof FreeTimeRequest)
            overlaps.addAll(getModel().getTimeOverlaps().conflicts(
                    ((FreeTimeRequest) getStudent().getRequests().get(x)).createEnrollment(), assignment[idx]));
    overlaps.addAll(getModel().getTimeOverlaps().notAvailableTimeConflicts(assignment[idx]));
    return overlaps;
}
 
開發者ID:UniTime,項目名稱:cpsolver,代碼行數:17,代碼來源:OnlineSectioningCriterion.java

示例3: toString

import org.cpsolver.studentsct.extension.TimeOverlapsCounter; //導入方法依賴的package包/類
public String toString(Assignment<Request, Enrollment> a) {
    if (getAssignments().isEmpty()) return "not assigned";
    Set<DistanceConflict.Conflict> dc = distanceConflicts(a);
    Set<TimeOverlapsCounter.Conflict> toc = timeOverlappingConflicts(a);
    int share = 0;
    if (toc != null)
        for (TimeOverlapsCounter.Conflict c: toc)
            share += c.getShare();
    String ret = toDouble(a) + "/" + sDF.format(getRequest().getBound())
            + (getPenalty() == 0.0 ? "" : "/" + sDF.format(getPenalty()))
            + (dc == null || dc.isEmpty() ? "" : "/dc:" + dc.size())
            + (share <= 0 ? "" : "/toc:" + share);
    if (getRequest() instanceof CourseRequest) {
        double sameGroup = 0.0; int groupCount = 0;
        for (RequestGroup g: ((CourseRequest)getRequest()).getRequestGroups()) {
            if (g.getCourse().equals(getCourse())) {
                sameGroup += g.getEnrollmentSpread(a, this, 1.0, 0.0);
                groupCount ++;
            }
        }
        if (groupCount > 0)
            ret += "/g:" + sDF.format(sameGroup / groupCount);
    }
    if (getRequest() instanceof CourseRequest) {
        ret += " ";
        for (Iterator<? extends SctAssignment> i = getAssignments().iterator(); i.hasNext();) {
            SctAssignment assignment = i.next();
            ret += assignment + (i.hasNext() ? ", " : "");
        }
    }
    if (getReservation() != null) ret = "(r) " + ret;
    return ret;
}
 
開發者ID:UniTime,項目名稱:cpsolver,代碼行數:34,代碼來源:Enrollment.java

示例4: timeOverlappingConflicts

import org.cpsolver.studentsct.extension.TimeOverlapsCounter; //導入方法依賴的package包/類
/** Time overlapping conflicts, in which this enrollment is involved. 
 * @param assignment current assignment
 * @return time overlapping conflicts
 **/
public Set<TimeOverlapsCounter.Conflict> timeOverlappingConflicts(Assignment<Request, Enrollment> assignment) {
    if (getRequest().getModel() instanceof StudentSectioningModel) {
        TimeOverlapsCounter toc = ((StudentSectioningModel) getRequest().getModel()).getTimeOverlaps();
        if (toc == null)
            return null;
        return toc.allConflicts(assignment, this);
    } else
        return null;
}
 
開發者ID:UniTime,項目名稱:cpsolver,代碼行數:14,代碼來源:Enrollment.java

示例5: getTimeOverlappingConflicts

import org.cpsolver.studentsct.extension.TimeOverlapsCounter; //導入方法依賴的package包/類
/**
 * Time overlapping conflicts of idx-th assignment of the current
 * schedule
 * @param idx index of the request
 * @return set of time overlapping conflicts
 */
public Set<TimeOverlapsCounter.Conflict> getTimeOverlappingConflicts(int idx) {
    if (iTimeOverlaps == null || iAssignment[idx] == null)
        return null;
    Set<TimeOverlapsCounter.Conflict> overlaps = new HashSet<TimeOverlapsCounter.Conflict>();
    for (int x = 0; x < idx; x++)
        if (iAssignment[x] != null)
            overlaps.addAll(iTimeOverlaps.conflicts(iAssignment[x], iAssignment[idx]));
        else if (iStudent.getRequests().get(x) instanceof FreeTimeRequest)
            overlaps.addAll(iTimeOverlaps.conflicts(((FreeTimeRequest)iStudent.getRequests().get(x)).createEnrollment(), iAssignment[idx]));
    overlaps.addAll(iTimeOverlaps.notAvailableTimeConflicts(iAssignment[idx]));
    return overlaps;
}
 
開發者ID:UniTime,項目名稱:cpsolver,代碼行數:19,代碼來源:BranchBoundSelection.java

示例6: getWeight

import org.cpsolver.studentsct.extension.TimeOverlapsCounter; //導入方法依賴的package包/類
@Override
public double getWeight(Assignment<Request, Enrollment> assignment, Enrollment enrollment, Set<DistanceConflict.Conflict> distanceConflicts, Set<TimeOverlapsCounter.Conflict> timeOverlappingConflicts) {
    int share = 0;
    if (timeOverlappingConflicts != null) 
        for (TimeOverlapsCounter.Conflict c: timeOverlappingConflicts)
            share += c.getShare();
    return getWeight(assignment, enrollment)
           * (distanceConflicts == null || distanceConflicts.isEmpty() ? 1.0 : Math.pow(iDistConfWeight, distanceConflicts.size()))
           * Math.max(share == 0 ? 1.0 : 1.0 - (((double)share) / enrollment.getNrSlots()) / 2.0, 0.5);
}
 
開發者ID:UniTime,項目名稱:cpsolver,代碼行數:11,代碼來源:OriginalStudentWeights.java

示例7: getTimeOverlapConflictWeight

import org.cpsolver.studentsct.extension.TimeOverlapsCounter; //導入方法依賴的package包/類
@Override
public double getTimeOverlapConflictWeight(Assignment<Request, Enrollment> assignment, Enrollment enrollment,
        TimeOverlapsCounter.Conflict timeOverlap) {
    return iParent.getTimeOverlapConflictWeight(assignment, enrollment, timeOverlap);
}
 
開發者ID:UniTime,項目名稱:cpsolver,代碼行數:6,代碼來源:StudentSchedulingAssistantWeights.java

示例8: add

import org.cpsolver.studentsct.extension.TimeOverlapsCounter; //導入方法依賴的package包/類
public void add(Assignment<Request, Enrollment> assignment, TimeOverlapsCounter.Conflict c) {
    if (c.getR1() != null) iTotalValue += c.getR1Weight() * iStudentWeights.getTimeOverlapConflictWeight(assignment, c.getE1(), c);
    if (c.getR2() != null) iTotalValue += c.getR2Weight() * iStudentWeights.getTimeOverlapConflictWeight(assignment, c.getE2(), c);
}
 
開發者ID:UniTime,項目名稱:cpsolver,代碼行數:5,代碼來源:StudentSectioningModel.java

示例9: remove

import org.cpsolver.studentsct.extension.TimeOverlapsCounter; //導入方法依賴的package包/類
public void remove(Assignment<Request, Enrollment> assignment, TimeOverlapsCounter.Conflict c) {
    if (c.getR1() != null) iTotalValue -= c.getR1Weight() * iStudentWeights.getTimeOverlapConflictWeight(assignment, c.getE1(), c);
    if (c.getR2() != null) iTotalValue -= c.getR2Weight() * iStudentWeights.getTimeOverlapConflictWeight(assignment, c.getE2(), c);
}
 
開發者ID:UniTime,項目名稱:cpsolver,代碼行數:5,代碼來源:StudentSectioningModel.java

示例10: getTimeOverlapConflictWeight

import org.cpsolver.studentsct.extension.TimeOverlapsCounter; //導入方法依賴的package包/類
@Override
public double getTimeOverlapConflictWeight(Assignment<Request, Enrollment> assignment, Enrollment e, TimeOverlapsCounter.Conflict c) {
    if (e == null || e.getRequest() == null) return 0.0;
    double toc = Math.min(iTimeOverlapMaxLimit * c.getShare() / e.getNrSlots(), iTimeOverlapMaxLimit);
    return round(getWeight(assignment, e) * toc);
}
 
開發者ID:UniTime,項目名稱:cpsolver,代碼行數:7,代碼來源:PriorityStudentWeights.java

示例11: getTimeOverlapConflictWeight

import org.cpsolver.studentsct.extension.TimeOverlapsCounter; //導入方法依賴的package包/類
@Override
public double getTimeOverlapConflictWeight(Assignment<Request, Enrollment> assignment, Enrollment enrollment, TimeOverlapsCounter.Conflict timeOverlap) {
    return Math.min(0.5 * timeOverlap.getShare() / enrollment.getNrSlots(), 0.5) * getWeight(assignment, enrollment);
}
 
開發者ID:UniTime,項目名稱:cpsolver,代碼行數:5,代碼來源:OriginalStudentWeights.java

示例12: getWeight

import org.cpsolver.studentsct.extension.TimeOverlapsCounter; //導入方法依賴的package包/類
/**
 * Return weight of the given enrollment 
 * @param assignment current assignment
 * @param enrollment given enrollment
 * @param distanceConflicts distance conflicts
 * @param timeOverlappingConflicts time overlapping conflicts
 * @return weight (higher weight means better value)
 */
public double getWeight(Assignment<Request, Enrollment> assignment, Enrollment enrollment, Set<DistanceConflict.Conflict> distanceConflicts, Set<TimeOverlapsCounter.Conflict> timeOverlappingConflicts);
 
開發者ID:UniTime,項目名稱:cpsolver,代碼行數:10,代碼來源:StudentWeights.java

示例13: getTimeOverlapConflictWeight

import org.cpsolver.studentsct.extension.TimeOverlapsCounter; //導入方法依賴的package包/類
/**
 * Return weight of a time overlapping conflict
 * @param assignment current assignment
 * @param enrollment enrollment in question
 * @param timeOverlap time overlapping conflict
 * @return weight of the conflict
 */
public double getTimeOverlapConflictWeight(Assignment<Request, Enrollment> assignment, Enrollment enrollment, TimeOverlapsCounter.Conflict timeOverlap);
 
開發者ID:UniTime,項目名稱:cpsolver,代碼行數:9,代碼來源:StudentWeights.java


注:本文中的org.cpsolver.studentsct.extension.TimeOverlapsCounter.Conflict方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。