use of org.cpsolver.studentsct.constraint.FixedAssignments in project cpsolver by UniTime.
the class StudentSectioningXMLLoader method load.
public void load(Document document) {
Element root = document.getRootElement();
if (getModel() != null && root.element("travel-times") != null)
loadTravelTimes(root.element("travel-times"), getModel().getDistanceMetric());
Progress.getInstance(getModel()).load(root, true);
Progress.getInstance(getModel()).message(Progress.MSGLEVEL_STAGE, "Restoring from backup ...");
Map<Long, Offering> offeringTable = new HashMap<Long, Offering>();
Map<Long, Course> courseTable = new HashMap<Long, Course>();
if (root.element("offerings") != null) {
loadOfferings(root.element("offerings"), offeringTable, courseTable, null);
}
List<Enrollment> bestEnrollments = new ArrayList<Enrollment>();
List<Enrollment> currentEnrollments = new ArrayList<Enrollment>();
if (root.element("students") != null) {
loadStudents(root.element("students"), offeringTable, courseTable, bestEnrollments, currentEnrollments);
}
if (root.element("constraints") != null)
loadLinkedSections(root.element("constraints"), offeringTable);
if (!bestEnrollments.isEmpty())
assignBest(bestEnrollments);
if (!currentEnrollments.isEmpty())
assignCurrent(currentEnrollments);
if (iMoveCriticalUp)
moveCriticalRequestsUp();
boolean hasFixed = false;
for (Request r : getModel().variables()) {
if (r instanceof CourseRequest && ((CourseRequest) r).isFixed()) {
hasFixed = true;
break;
}
}
if (hasFixed)
getModel().addGlobalConstraint(new FixedAssignments());
}
Aggregations