当前位置: 首页>>代码示例>>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;未经允许,请勿转载。