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