本文整理汇总了Java中org.cpsolver.exam.model.ExamInstructor类的典型用法代码示例。如果您正苦于以下问题:Java ExamInstructor类的具体用法?Java ExamInstructor怎么用?Java ExamInstructor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ExamInstructor类属于org.cpsolver.exam.model包,在下文中一共展示了ExamInstructor类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAssignedExamsOfInstructor
import org.cpsolver.exam.model.ExamInstructor; //导入依赖的package包/类
@Override
public Collection<ExamAssignmentInfo> getAssignedExamsOfInstructor(Long instructorId) {
Lock lock = currentSolution().getLock().readLock();
lock.lock();
try {
ExamInstructor instructor = null;
for (ExamInstructor i: ((ExamModel)currentSolution().getModel()).getInstructors()) {
if (i.getId()==instructorId) {
instructor = i; break;
}
}
if (instructor==null) return null;
Vector<ExamAssignmentInfo> ret = new Vector<ExamAssignmentInfo>();
for (ExamPeriod period: ((ExamModel)currentSolution().getModel()).getPeriods()) {
Set exams = instructor.getExams(currentSolution().getAssignment(), period);
if (exams!=null)
for (Iterator i=exams.iterator();i.hasNext();) {
Exam exam = (Exam)i.next();
ret.add(new ExamAssignmentInfo(currentSolution().getAssignment().getValue(exam), currentSolution().getAssignment()));
}
}
return ret;
} finally {
lock.unlock();
}
}
示例2: computeUnavailablility
import org.cpsolver.exam.model.ExamInstructor; //导入依赖的package包/类
private void computeUnavailablility(Exam exam, Vector<ExamResourceUnavailability> unavailabilities) {
if (unavailabilities==null || unavailabilities.isEmpty()) return;
for (ExamResourceUnavailability unavailability : unavailabilities) {
Vector<Long> commonStudents = new Vector();
for (ExamStudent student: exam.getStudents()) {
if (unavailability.getStudentIds().contains(student.getId())) commonStudents.add(student.getId());
}
if (!commonStudents.isEmpty())
iDirects.add(new DirectConflict(unavailability, commonStudents));
Vector<Long> commonInstructors = new Vector();
for (ExamInstructor instructor: exam.getInstructors()) {
if (unavailability.getInstructorIds().contains(instructor.getId())) commonInstructors.add(instructor.getId());
}
if (!commonInstructors.isEmpty())
iInstructorDirects.add(new DirectConflict(unavailability, commonInstructors));
}
}
示例3: ExamInfo
import org.cpsolver.exam.model.ExamInstructor; //导入依赖的package包/类
public ExamInfo(org.cpsolver.exam.model.Exam exam) {
iExamTypeId = ((ExamModel)exam.getModel()).getProperties().getPropertyLong("Exam.Type", null);
iExamId = exam.getId();
iExamLabel = exam.getName();
iLength = exam.getLength();
iMaxRooms = exam.getMaxRooms();
iNrStudents = exam.getSize();//Students().size();
iSeatingType = (exam.hasAltSeating()?Exam.sSeatingTypeExam:Exam.sSeatingTypeNormal);
if (!exam.getOwners().isEmpty()) {
iSections = new Vector();
for (org.cpsolver.exam.model.ExamOwner ecs: exam.getOwners()) {
HashSet<Long> studentIds = new HashSet<Long>();
for (Iterator i=ecs.getStudents().iterator();i.hasNext();)
studentIds.add(((ExamStudent)i.next()).getId());
iSections.add(new ExamSectionInfo(ecs.getId(), ecs.getName(), studentIds));
}
}
iInstructors = new Vector();
for (Constraint c: exam.constraints()) {
if (c instanceof ExamInstructor) {
ExamInstructor instructor = (ExamInstructor)c;
iInstructors.add(new ExamInstructorInfo(instructor.getId(), null, instructor.getName()));
}
}
iPrintOffset = (exam.getPrintOffset()==null?0:exam.getPrintOffset());
}
示例4: getValue
import org.cpsolver.exam.model.ExamInstructor; //导入依赖的package包/类
@Override
public double getValue(Assignment<Exam, ExamPlacement> assignment, ExamPlacement value, Set<ExamPlacement> conflicts) {
Exam exam = value.variable();
int penalty = 0;
Map<ExamInstructor, Set<Exam>> instructors = ((ExamModel)getModel()).getInstructorsOfDay(assignment, value.getPeriod());
for (ExamInstructor s : exam.getInstructors()) {
Set<Exam> exams = instructors.get(s);
if (exams == null || exams.size() < 2) continue;
int nrExams = exams.size() + (exams.contains(exam) ? 0 : 1);
if (nrExams > 2)
penalty++;
}
/*
for (ExamInstructor s : exam.getInstructors()) {
Set<Exam> exams = s.getExamsADay(assignment, value.getPeriod());
int nrExams = exams.size() + (exams.contains(exam) ? 0 : 1);
if (nrExams > 2)
penalty++;
}
*/
return penalty;
}
示例5: getValue
import org.cpsolver.exam.model.ExamInstructor; //导入依赖的package包/类
@Override
public double getValue(Assignment<Exam, ExamPlacement> assignment, ExamPlacement value, Set<ExamPlacement> conflicts) {
Exam exam = value.variable();
int penalty = 0;
Map<ExamInstructor, Set<Exam>> instructors = ((ExamModel)getModel()).getInstructorsOfPeriod(assignment, value.getPeriod());
for (ExamInstructor s : exam.getInstructors()) {
Set<Exam> exams = instructors.get(s);
if (exams == null) continue;
int nrExams = exams.size() + (exams.contains(exam) ? 0 : 1);
if (nrExams > 1)
penalty++;
}
/*
for (ExamInstructor s : exam.getInstructors()) {
Set<Exam> exams = s.getExams(assignment, value.getPeriod());
int nrExams = exams.size() + (exams.contains(exam) ? 0 : 1);
if (nrExams > 1)
penalty++;
}
*/
return penalty;
}
示例6: getInstructor
import org.cpsolver.exam.model.ExamInstructor; //导入依赖的package包/类
protected ExamInstructor getInstructor(DepartmentalInstructor instructor) {
if (instructor.getExternalUniqueId()!=null && instructor.getExternalUniqueId().trim().length()>0) {
ExamInstructor i = (ExamInstructor)iInstructors.get(instructor.getExternalUniqueId());
if (i!=null) return i;
}
return (ExamInstructor)iInstructors.get(instructor.getUniqueId());
}
示例7: getValue
import org.cpsolver.exam.model.ExamInstructor; //导入依赖的package包/类
@Override
public double getValue(Assignment<Exam, ExamPlacement> assignment, ExamPlacement value, Set<ExamPlacement> conflicts) {
Exam exam = value.variable();
// if (!exam.isAllowDirectConflicts()) return 0;
int penalty = 0;
for (ExamInstructor s : exam.getInstructors()) {
if (!s.isAvailable(value.getPeriod()))
penalty++;
}
return penalty;
}