本文整理汇总了Java中org.cpsolver.coursett.model.Student类的典型用法代码示例。如果您正苦于以下问题:Java Student类的具体用法?Java Student怎么用?Java Student使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Student类属于org.cpsolver.coursett.model包,在下文中一共展示了Student类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadInstructorStudentConflicts
import org.cpsolver.coursett.model.Student; //导入依赖的package包/类
private void loadInstructorStudentConflicts(org.hibernate.Session hibSession, String puids) {
for (Object[] x: (List<Object[]>)hibSession.createQuery("select s.uniqueId, s.externalUniqueId from Student s " +
"where s.session.uniqueId = :sessionId and s.externalUniqueId in (" + puids + ")")
.setLong("sessionId",iSessionId.longValue()).list()) {
Long studentId = (Long)x[0];
String puid = (String)x[1];
InstructorConstraint ic = iInstructors.get(puid);
Student s = iStudents.get(studentId);
if (s != null && ic != null) {
iProgress.debug("Instructor " + puid + " mapped with student " + s.getId());
s.setInstructor(ic);
for (Lecture lecture: ic.variables()) {
s.addLecture(lecture);
lecture.addStudent(getAssignment(), s);
}
}
}
}
示例2: makeupCommittedStudentConflicts
import org.cpsolver.coursett.model.Student; //导入依赖的package包/类
private void makeupCommittedStudentConflicts(Set<Long> offeringsToAvoid) {
setPhase("Creating student conflicts with commited solutions ...", iStudents.size());
for (Student student: iStudents.values()) {
Set<WeightedCourseOffering> courses = iStudentCourseDemands.getCourses(student.getId());
if (iStudentGroupCourseDemands != null) {
Set<WeightedCourseOffering> other = iStudentGroupCourseDemands.getCourses(student.getId());
if (other != null && !other.isEmpty()) {
if (courses == null) courses = other; else courses.addAll(other);
}
}
incProgress();
if (courses == null) continue;
for (WeightedCourseOffering course: courses) {
if (offeringsToAvoid.contains(course.getCourseOffering().getInstructionalOffering().getUniqueId())) continue;
if (!somehowEnroll(student, course.getCourseOffering(), course.getWeight(), iStudentCourseDemands.getEnrollmentPriority(student.getId(), course.getCourseOfferingId())))
offeringsToAvoid.add(course.getCourseOffering().getInstructionalOffering().getUniqueId());
}
}
}
示例3: StudentGroupInfo
import org.cpsolver.coursett.model.Student; //导入依赖的package包/类
public StudentGroupInfo(Solver<Lecture, Placement> solver, StudentGroup group) {
super();
iId = group.getId();
iName = group.getName();
iWeight = group.getWeight();
iValue = value(group);
Map<Lecture, List<Student>> class2students = new HashMap<Lecture, List<Student>>();
for (Student student: group.getStudents()) {
for (Lecture lecture: student.getLectures()) {
List<Student> students = class2students.get(lecture);
if (students == null) {
students = new ArrayList<Student>();
class2students.put(lecture, students);
}
students.add(student);
}
}
iClasses = new ArrayList<ClassInfo>();
for (Map.Entry<Lecture, List<Student>> entry: class2students.entrySet()) {
iClasses.add(new ClassInfo(entry.getKey(), entry.getValue()));
}
}
示例4: checkEnrollment
import org.cpsolver.coursett.model.Student; //导入依赖的package包/类
public void checkEnrollment(Progress p, Student s, Long subpartId, Collection lectures) {
Lecture enrolled = null;
for (Iterator i=lectures.iterator();i.hasNext();) {
Lecture lecture = (Lecture)i.next();
if (s.getLectures().contains(lecture)) {
if (enrolled!=null)
p.message(iMessageLevel, "Student "+s.getId()+" enrolled in multiple classes of the same subpart "+getClassLabel(enrolled)+", "+getClassLabel(lecture)+".");
enrolled = lecture;
}
}
if (enrolled==null) {
p.message(iMessageLevel, "Student "+s.getId()+" not enrolled in any class of subpart "+getSubpartLabel(subpartId)+".");
} else if (enrolled.hasAnyChildren()) {
for (Long sid: enrolled.getChildrenSubpartIds()) {
checkEnrollment(p, s, sid, enrolled.getChildren(sid));
}
}
}
示例5: incJenrl
import org.cpsolver.coursett.model.Student; //导入依赖的package包/类
/**
* Increment the number of joined enrollments (during student final
* sectioning)
* @param assignment current assignment
* @param student student added in between the two classes of this constraint
*/
public void incJenrl(Assignment<Lecture, Placement> assignment, Student student) {
JenrlConstraintContext context = getContext(assignment);
boolean hard = context.isOverLimit();
double jenrlWeight = student.getJenrlWeight(first(), second());
iJenrl += jenrlWeight;
Double conflictPriority = student.getConflictingPriorty(first(), second());
if (conflictPriority != null) iPriority += conflictPriority * jenrlWeight;
iStudents.add(student);
if (student.getInstructor() != null && (student.getInstructor().variables().contains(first()) ||
student.getInstructor().variables().contains(second())))
iInstructors.add(student);
for (Criterion<Lecture, Placement> criterion: getModel().getCriteria())
if (criterion instanceof StudentConflict)
((StudentConflict)criterion).incJenrl(assignment, this, jenrlWeight, conflictPriority, student);
if (!hard && context.isOverLimit() && isInConflict(assignment)) {
context.incLimit(jenrlWeight);
}
}
示例6: decJenrl
import org.cpsolver.coursett.model.Student; //导入依赖的package包/类
/**
* Decrement the number of joined enrollments (during student final
* sectioning)
* @param assignment current assignment
* @param student student removed from between the two classes of this constraint
*/
public void decJenrl(Assignment<Lecture, Placement> assignment, Student student) {
JenrlConstraintContext context = getContext(assignment);
boolean hard = context.isOverLimit();
double jenrlWeight = student.getJenrlWeight(first(), second());
iJenrl -= jenrlWeight;
Double conflictPriority = student.getConflictingPriorty(first(), second());
if (conflictPriority != null) iPriority -= conflictPriority * jenrlWeight;
iStudents.remove(student);
iInstructors.remove(student);
for (Criterion<Lecture, Placement> criterion: getModel().getCriteria())
if (criterion instanceof StudentConflict)
((StudentConflict)criterion).incJenrl(assignment, this, -jenrlWeight, conflictPriority, student);
if (hard && !context.isOverLimit())
context.decLimit(jenrlWeight);
}
示例7: tweakSizes
import org.cpsolver.coursett.model.Student; //导入依赖的package包/类
@Override
protected void tweakSizes(double total) {
double studentsWeight = 0;
for (Student s : iStudents) {
studentsWeight += s.getOfferingWeight(iOfferingId);
}
// if there is not enough space for the given students
if (studentsWeight > total) {
if (total == 0) {
// all limits are zero -> spread students equally
for (int idx = 0; idx < iGroups.length; idx++)
iGroups[idx].setMaxSize(total / iGroups.length);
} else {
// enlarge sections proportionally
double factor = studentsWeight / total;
for (int idx = 0; idx < iGroups.length; idx++) {
iGroups[idx].setMaxSize(factor * iGroups[idx].getMaxSize());
iGroups[idx].setMinSize(Math.min(iGroups[idx].getMinSize(), 0.9 * iGroups[idx].getMaxSize()));
}
}
}
}
示例8: setConfiguration
import org.cpsolver.coursett.model.Student; //导入依赖的package包/类
/**
* Select an offering for the model
*/
public void setConfiguration(Configuration config) {
iConfigurations = new ArrayList<Configuration>();
iConfigurations.add(config);
iOfferingId = config.getOfferingId();
if (config.getAltConfigurations() != null)
for (Configuration alt: config.getAltConfigurations())
if (!alt.equals(config)) iConfigurations.add(alt);
iStudents = new ArrayList<SctStudent>();
Set<Long> studentIds = new HashSet<Long>();
for (Configuration c: iConfigurations)
for (Lecture l: c.getTopLectures(c.getTopSubpartIds().iterator().next())) {
for (Student s: l.students()) {
if (studentIds.add(s.getId()))
iStudents.add(new SctStudent(this, s));
}
}
for (Student student: getTimetableModel().getAllStudents())
if (student.hasOffering(getOfferingId()))
if (studentIds.add(student.getId()))
iStudents.add(new SctStudent(this, student));
Collections.sort(iStudents);
}
示例9: decJenrl
import org.cpsolver.coursett.model.Student; //导入依赖的package包/类
/**
* Decrement {@link JenrlConstraint} between the given two classes by the given student
*/
protected void decJenrl(Assignment<Lecture, Placement> assignment, Student student, Lecture l1, Lecture l2) {
if (l1.equals(l2)) return;
JenrlConstraint jenrl = l1.jenrlConstraint(l2);
if (jenrl != null) {
jenrl.decJenrl(assignment, student);
/*
if (jenrl.getNrStudents() == 0) {
jenrl.getContext(assignment).unassigned(assignment, null);
Object[] vars = jenrl.variables().toArray();
for (int k = 0; k < vars.length; k++)
jenrl.removeVariable((Lecture) vars[k]);
iModel.removeConstraint(jenrl);
}
*/
}
}
示例10: studentsToLectures
import org.cpsolver.coursett.model.Student; //导入依赖的package包/类
@Override
protected Group[] studentsToLectures(Long offeringId, Collection<Student> students, Collection<Lecture> lectures) {
if (hasStudentGroups(students)) {
Set<Lecture> sortedLectures = new TreeSet<Lecture>(new Comparator<Lecture>() {
@Override
public int compare(Lecture l1, Lecture l2) {
return l1.getClassId().compareTo(l2.getClassId());
}
});
sortedLectures.addAll(lectures);
GroupBasedInitialSectioning sect = new GroupBasedInitialSectioning(getProgress(), offeringId, sortedLectures, students);
return sect.getGroups();
} else {
return super.studentsToLectures(offeringId, students, lectures);
}
}
示例11: purgeInvalidValues
import org.cpsolver.coursett.model.Student; //导入依赖的package包/类
private void purgeInvalidValues() {
setPhase("Purging invalid placements ...", getModel().variables().size());
for (Lecture lecture: new ArrayList<Lecture>(getModel().variables())) {
List<Placement> oldValues = new ArrayList<Placement>(lecture.values(getAssignment()));
lecture.purgeInvalidValues(iInteractiveMode);
if (lecture.values(getAssignment()).isEmpty()) {
String warn = "Class "+getClassLabel(lecture)+" has no available placement (after enforcing consistency between the problem and committed solutions"+(iInteractiveMode?"":", class not loaded")+").";
for (Placement p: oldValues) {
warn += "<br> "+p.getNotValidReason(getAssignment(), iUseAmPm);
}
iProgress.message(msglevel("noPlacementAfterCommit", Progress.MSGLEVEL_WARN), warn);
if (!iInteractiveMode) {
getModel().removeVariable(lecture);
for (Constraint c: new ArrayList<Constraint>(lecture.constraints())) {
c.removeVariable(lecture);
if (c.variables().isEmpty() || c instanceof BinaryConstraint)
getModel().removeConstraint(c);
}
for (Iterator i=lecture.students().iterator();i.hasNext();) {
Student s = (Student)i.next();
s.getLectures().remove(lecture);
}
}
}
incProgress();
}
}
示例12: propagateCommittedAssignment
import org.cpsolver.coursett.model.Student; //导入依赖的package包/类
private void propagateCommittedAssignment(HashSet students, Class_ parent, Class_ clazz) {
Lecture lecture = (Lecture)iLectures.get(clazz.getUniqueId());
if (lecture!=null && !lecture.isCommitted()) {
//iProgress.debug("[B] Students "+students+" cannot enroll "+lecture.getName()+" due to the enrollment of "+parent.getClassLabel(iShowClassSuffix, iShowConfigName));
for (Iterator i=students.iterator();i.hasNext();) {
Student student = (Student)i.next();
student.addCanNotEnroll(lecture);
}
} else {
for (Iterator i=clazz.getChildClasses().iterator();i.hasNext();) {
Class_ child = (Class_)i.next();
propagateCommittedAssignment(students, parent, child);
}
}
}
示例13: ClassInfo
import org.cpsolver.coursett.model.Student; //导入依赖的package包/类
public ClassInfo(Lecture clazz, Collection<Student> students) {
iClassId = clazz.getClassId();
iConfigId = clazz.getConfiguration().getConfigId();
iOfferingId = clazz.getConfiguration().getOfferingId();
for (Student student: students)
iStudents.add(new StudentInfo(clazz, student));
}
示例14: jointEnrollment
import org.cpsolver.coursett.model.Student; //导入依赖的package包/类
/**
* Only count students that are instructors assigned to one of the two classes and enrolled in the other.
*/
@Override
protected double jointEnrollment(JenrlConstraint jenrl) {
double ret = 0.0;
for (Student student: jenrl.getInstructors())
ret += student.getJenrlWeight(jenrl.first(), jenrl.second());
return ret;
}
示例15: oneInstructorOtherHard
import org.cpsolver.coursett.model.Student; //导入依赖的package包/类
/**
* One of the lectures is hard, there is a joint enrollment constraint between them, and
* there is at least one student that is instructor for one lecture and the other lecture
* is singleton.
* @param l1 first placement
* @param l2 second placement
* @return true if there is at least one student of one class teaching the other class, and there are no possibility to move the student into an alternative class
*/
public static boolean oneInstructorOtherHard(Lecture l1, Lecture l2) {
if (!hard(l1, l2)) return false;
JenrlConstraint jenrl = l1.jenrlConstraint(l2);
if (jenrl == null) return false;
for (Student student: jenrl.getInstructors()) {
if ((l1.isSingleSection() || student.getInstructor().variables().contains(jenrl.second())) &&
(l2.isSingleSection() || student.getInstructor().variables().contains(jenrl.first())))
return true;
}
return false;
}