public class StudentSectioningXMLLoader extends StudentSectioningLoader
Parameter | Type | Comment |
---|---|---|
General.Input | String |
Path of an XML file to be loaded |
Xml.LoadBest | Boolean |
If true, load best assignments |
Xml.LoadInitial | Boolean |
If false, load initial assignments |
Xml.LoadCurrent | Boolean |
If true, load current assignments |
Xml.LoadOfferings | Boolean |
If true, load offerings (and their stucture, i.e., courses, configurations, subparts and sections) |
Xml.LoadStudents | Boolean |
If true, load students (and their requests) |
Xml.StudentFilter | StudentFilter |
If provided, students are filtered by the given student filter |
StudentSectioningModel model = new StudentSectioningModel(cfg);
new StudentSectioningXMLLoader(model).load();
Constructor and Description |
---|
StudentSectioningXMLLoader(StudentSectioningModel model,
Assignment<Request,Enrollment> assignment)
Constructor
|
Modifier and Type | Method and Description |
---|---|
protected void |
assignBest(List<Enrollment> bestEnrollments)
Save best enrollments
|
protected void |
assignCurrent(List<Enrollment> currentEnrollments)
Assign current enrollments
|
void |
load()
Load the file
|
void |
load(Document document) |
protected void |
load(Element root)
Load data from the given XML root
|
protected Config |
loadConfig(Element configEl,
Offering offering,
Map<Long,Subpart> subpartTable,
Map<Long,Section> sectionTable,
Map<Long,Placement> timetable)
Load config
|
protected Course |
loadCourse(Element courseEl,
Offering offering)
Load course
|
CourseRequest |
loadCourseRequest(Element requestEl,
Student student,
Map<Long,Offering> offeringTable,
Map<Long,Course> courseTable)
Load course request
|
protected Enrollment |
loadEnrollment(Element enrollmentEl,
Request request)
Load enrollment
|
FreeTimeRequest |
loadFreeTime(Element requestEl,
Student student)
Load free time request
|
protected void |
loadLinkedSections(Element constraintsEl,
Map<Long,Offering> offeringTable)
Load linked sections
|
protected void |
loadOfferings(Element offeringsEl,
Map<Long,Offering> offeringTable,
Map<Long,Course> courseTable,
Map<Long,Placement> timetable)
Load offerings
|
protected Request |
loadRequest(Element requestEl,
Student student,
Map<Long,Offering> offeringTable,
Map<Long,Course> courseTable)
Load request
|
protected Reservation |
loadReservation(Element reservationEl,
Offering offering,
HashMap<Long,Config> configTable,
HashMap<Long,Section> sectionTable)
Load reservation
|
protected Restriction |
loadRestriction(Element restrictionEl,
Offering offering,
HashMap<Long,Config> configTable,
HashMap<Long,Section> sectionTable)
Load restriction
|
protected Section |
loadSection(Element sectionEl,
Subpart subpart,
Map<Long,Section> sectionTable,
Map<Long,Placement> timetable)
Load section
|
protected Student |
loadStudent(Element studentEl,
Map<Long,Offering> offeringTable)
Load student
|
protected void |
loadStudents(Element studentsEl,
Map<Long,Offering> offeringTable,
Map<Long,Course> courseTable,
List<Enrollment> bestEnrollments,
List<Enrollment> currentEnrollments)
Load students
|
protected Subpart |
loadSubpart(Element subpartEl,
Config config,
Map<Long,Subpart> subpartTable,
Map<Long,Section> sectionTable,
Map<Long,Placement> timetable)
Load subpart
|
protected Map<Long,Placement> |
loadTimetable(Element timetableRoot)
Load given timetable
|
protected void |
loadTravelTimes(Element travelTimesEl,
DistanceMetric metric)
Load travel times
|
protected void |
moveCriticalRequestsUp() |
void |
setInputFile(File inputFile)
Set input file (e.g., if it is not set by General.Input property)
|
void |
setLoadOfferings(boolean loadOfferings)
Set whether to load offerings
|
void |
setLoadStudents(boolean loadStudents)
Set whether to load students
|
void |
setStudentFilter(StudentFilter filter)
Set student filter
|
getAssignment, getModel, getTerminationCondition, run, setCallback, setTerminationCondition
public StudentSectioningXMLLoader(StudentSectioningModel model, Assignment<Request,Enrollment> assignment)
model
- student sectioning modelassignment
- current assignmentpublic void setInputFile(File inputFile)
inputFile
- input filepublic void setStudentFilter(StudentFilter filter)
filter
- student filterpublic void setLoadStudents(boolean loadStudents)
loadStudents
- true if students are to be loadedpublic void setLoadOfferings(boolean loadOfferings)
loadOfferings
- true if instructional offerings are to be loadedpublic void load() throws Exception
load
in class ProblemLoader<Request,Enrollment,StudentSectioningModel>
Exception
- thrown when the load failsprotected void load(Element root) throws DocumentException
root
- document rootDocumentException
- when XML cannot be read or parsedprotected void loadOfferings(Element offeringsEl, Map<Long,Offering> offeringTable, Map<Long,Course> courseTable, Map<Long,Placement> timetable)
offeringsEl
- offerings elementofferingTable
- offering tablecourseTable
- course tabletimetable
- provided timetable (null if to be loaded from the given document)protected Course loadCourse(Element courseEl, Offering offering)
courseEl
- course elementoffering
- parent offeringprotected Config loadConfig(Element configEl, Offering offering, Map<Long,Subpart> subpartTable, Map<Long,Section> sectionTable, Map<Long,Placement> timetable)
configEl
- config elementoffering
- parent offeringsubpartTable
- subpart table (of the offering)sectionTable
- section table (of the offering)timetable
- provided timetableprotected Subpart loadSubpart(Element subpartEl, Config config, Map<Long,Subpart> subpartTable, Map<Long,Section> sectionTable, Map<Long,Placement> timetable)
subpartEl
- supart elementconfig
- parent configsubpartTable
- subpart table (of the offering)sectionTable
- section table (of the offering)timetable
- provided timetableprotected Section loadSection(Element sectionEl, Subpart subpart, Map<Long,Section> sectionTable, Map<Long,Placement> timetable)
sectionEl
- section elementsubpart
- parent subpartsectionTable
- section table (of the offering)timetable
- provided timetableprotected Reservation loadReservation(Element reservationEl, Offering offering, HashMap<Long,Config> configTable, HashMap<Long,Section> sectionTable)
reservationEl
- reservation elementoffering
- parent offeringconfigTable
- config table (of the offering)sectionTable
- section table (of the offering)protected Restriction loadRestriction(Element restrictionEl, Offering offering, HashMap<Long,Config> configTable, HashMap<Long,Section> sectionTable)
restrictionEl
- restriction elementoffering
- parent offeringconfigTable
- config table (of the offering)sectionTable
- section table (of the offering)protected Map<Long,Placement> loadTimetable(Element timetableRoot)
timetableRoot
- document root in the course timetabling XML formatprotected void loadTravelTimes(Element travelTimesEl, DistanceMetric metric)
travelTimesEl
- travel-time elementmetric
- distance metric to be populatedprotected void loadLinkedSections(Element constraintsEl, Map<Long,Offering> offeringTable)
constraintsEl
- constraints elementofferingTable
- offering tableprotected void loadStudents(Element studentsEl, Map<Long,Offering> offeringTable, Map<Long,Course> courseTable, List<Enrollment> bestEnrollments, List<Enrollment> currentEnrollments)
studentsEl
- students elementofferingTable
- offering tablecourseTable
- course tableprotected void assignBest(List<Enrollment> bestEnrollments)
bestEnrollments
- best enrollmentsprotected void assignCurrent(List<Enrollment> currentEnrollments)
currentEnrollments
- current enrollmentsprotected Student loadStudent(Element studentEl, Map<Long,Offering> offeringTable)
studentEl
- student elementofferingTable
- offering tableprotected Request loadRequest(Element requestEl, Student student, Map<Long,Offering> offeringTable, Map<Long,Course> courseTable)
requestEl
- request elementstudent
- parent studentofferingTable
- offering tablecourseTable
- course tablepublic FreeTimeRequest loadFreeTime(Element requestEl, Student student)
requestEl
- request elementstudent
- parent studentpublic CourseRequest loadCourseRequest(Element requestEl, Student student, Map<Long,Offering> offeringTable, Map<Long,Course> courseTable)
requestEl
- request elementstudent
- parent studentofferingTable
- offering tablecourseTable
- course tableprotected Enrollment loadEnrollment(Element enrollmentEl, Request request)
enrollmentEl
- enrollment element (current, best, or initial)request
- parent requestprotected void moveCriticalRequestsUp()