本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}