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


Java SameInstructorConstraint類代碼示例

本文整理匯總了Java中org.cpsolver.instructor.constraints.SameInstructorConstraint的典型用法代碼示例。如果您正苦於以下問題:Java SameInstructorConstraint類的具體用法?Java SameInstructorConstraint怎麽用?Java SameInstructorConstraint使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: getValue

import org.cpsolver.instructor.constraints.SameInstructorConstraint; //導入依賴的package包/類
@Override
public double getValue(Assignment<TeachingRequest.Variable, TeachingAssignment> assignment, TeachingAssignment value, Set<TeachingAssignment> conflicts) {
    double ret = 0.0;
    for (Constraint<TeachingRequest.Variable, TeachingAssignment> c : value.variable().constraints())
        if (c instanceof SameInstructorConstraint)
            ret += ((SameInstructorConstraint)c).getCurrentPreference(assignment, value);
    return ret;
}
 
開發者ID:UniTime,項目名稱:cpsolver,代碼行數:9,代碼來源:SameInstructor.java

示例2: computeBounds

import org.cpsolver.instructor.constraints.SameInstructorConstraint; //導入依賴的package包/類
@Override
protected double[] computeBounds(Assignment<TeachingRequest.Variable, TeachingAssignment> assignment) {
    double[] bounds = new double[] { 0.0, 0.0 };
    for (Constraint<TeachingRequest.Variable, TeachingAssignment> c: getModel().constraints()) {
        if (c instanceof SameInstructorConstraint && !c.isHard())
            bounds[1] += Math.abs(((SameInstructorConstraint)c).getPreference()) * (1 + (c.variables().size() * (c.variables().size() - 1)) / 2);
    }
    return bounds;
}
 
開發者ID:UniTime,項目名稱:cpsolver,代碼行數:10,代碼來源:SameInstructor.java

示例3: getBounds

import org.cpsolver.instructor.constraints.SameInstructorConstraint; //導入依賴的package包/類
@Override
public double[] getBounds(Assignment<TeachingRequest.Variable, TeachingAssignment> assignment, Collection<TeachingRequest.Variable> variables) {
    double[] bounds = new double[] { 0.0, 0.0 };
    Set<Constraint<TeachingRequest.Variable, TeachingAssignment>> constraints = new HashSet<Constraint<TeachingRequest.Variable, TeachingAssignment>>();
    for (TeachingRequest.Variable req: variables) {
        for (Constraint<TeachingRequest.Variable, TeachingAssignment> c : req.constraints()) {
            if (c instanceof SameInstructorConstraint && !c.isHard() && constraints.add(c))
                bounds[1] += Math.abs(((SameInstructorConstraint)c).getPreference()) * ((c.variables().size() * (c.variables().size() - 1)) / 2);
        }
    }
    return bounds;
}
 
開發者ID:UniTime,項目名稱:cpsolver,代碼行數:13,代碼來源:SameInstructor.java

示例4: getAssignmentId

import org.cpsolver.instructor.constraints.SameInstructorConstraint; //導入依賴的package包/類
public Long getAssignmentId(TeachingRequest.Variable request) {
    for (Constraint<TeachingRequest.Variable, TeachingAssignment> c: request.constraints()) {
        if (c instanceof SameInstructorConstraint && ((SameInstructorConstraint) c).getConstraintId() != null)
            return ((SameInstructorConstraint) c).getConstraintId();
    }
    return null;
}
 
開發者ID:UniTime,項目名稱:cpsolver,代碼行數:8,代碼來源:MathTest.java


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