Skip to content

Commit

Permalink
Student Scheduling: MPP
Browse files Browse the repository at this point in the history
- when using MPP in the mode where initial assignments cannot be changed (Sectioning.KeepInitialAssignments is true)
  -> when there is an initial assignment, only return the initial assignment in the course request's domain
  • Loading branch information
tomas-muller committed Apr 30, 2020
1 parent 546377f commit 926d487
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion src/org/cpsolver/studentsct/model/CourseRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,10 @@ protected int getMaxDomainSize() {
@Override
public List<Enrollment> computeEnrollments(Assignment<Request, Enrollment> assignment) {
List<Enrollment> ret = new ArrayList<Enrollment>();
if (getInitialAssignment() != null && getModel() != null && ((StudentSectioningModel)getModel()).isMPP() && ((StudentSectioningModel)getModel()).getKeepInitialAssignments()) {
ret.add(getInitialAssignment());
return ret;
}
int idx = 0;
for (Course course : iCourses) {
for (Config config : course.getOffering().getConfigs()) {
Expand All @@ -232,6 +236,10 @@ public List<Enrollment> computeEnrollments(Assignment<Request, Enrollment> assig
*/
public List<Enrollment> computeRandomEnrollments(Assignment<Request, Enrollment> assignment, int limitEachConfig) {
List<Enrollment> ret = new ArrayList<Enrollment>();
if (getInitialAssignment() != null && getModel() != null && ((StudentSectioningModel)getModel()).isMPP() && ((StudentSectioningModel)getModel()).getKeepInitialAssignments()) {
ret.add(getInitialAssignment());
return ret;
}
int idx = 0;
for (Course course : iCourses) {
for (Config config : course.getOffering().getConfigs()) {
Expand Down Expand Up @@ -517,6 +525,10 @@ private void computeEnrollments(Assignment<Request, Enrollment> assignment, Coll
**/
public List<Enrollment> getAvaiableEnrollments(Assignment<Request, Enrollment> assignment) {
List<Enrollment> ret = new ArrayList<Enrollment>();
if (getInitialAssignment() != null && getModel() != null && ((StudentSectioningModel)getModel()).isMPP() && ((StudentSectioningModel)getModel()).getKeepInitialAssignments()) {
ret.add(getInitialAssignment());
return ret;
}
int idx = 0;
for (Course course : iCourses) {
for (Config config : course.getOffering().getConfigs()) {
Expand All @@ -540,6 +552,8 @@ public List<Enrollment> getAvaiableEnrollments(Assignment<Request, Enrollment> a
public List<Enrollment> getSelectedEnrollments(Assignment<Request, Enrollment> assignment, boolean availableOnly) {
if (getSelectedChoices().isEmpty())
return null;
if (getInitialAssignment() != null && getModel() != null && ((StudentSectioningModel)getModel()).isMPP() && ((StudentSectioningModel)getModel()).getKeepInitialAssignments())
return null;
List<Enrollment> enrollments = new ArrayList<Enrollment>();
for (Course course : iCourses) {
boolean hasChoice = false;
Expand All @@ -563,8 +577,11 @@ public List<Enrollment> getSelectedEnrollments(Assignment<Request, Enrollment> a
*/
public List<Enrollment> getAvaiableEnrollmentsSkipSameTime(Assignment<Request, Enrollment> assignment) {
List<Enrollment> ret = new ArrayList<Enrollment>();
if (getInitialAssignment() != null)
if (getInitialAssignment() != null) {
ret.add(getInitialAssignment());
if (getModel() != null && ((StudentSectioningModel)getModel()).isMPP() && ((StudentSectioningModel)getModel()).getKeepInitialAssignments())
return ret;
}
int idx = 0;
for (Course course : iCourses) {
boolean skipSameTime = true;
Expand All @@ -588,6 +605,11 @@ public List<Enrollment> getAvaiableEnrollmentsSkipSameTime(Assignment<Request, E
*/
public List<Enrollment> getEnrollmentsSkipSameTime(Assignment<Request, Enrollment> assignment) {
List<Enrollment> ret = new ArrayList<Enrollment>();
if (getInitialAssignment() != null) {
ret.add(getInitialAssignment());
if (getModel() != null && ((StudentSectioningModel)getModel()).isMPP() && ((StudentSectioningModel)getModel()).getKeepInitialAssignments())
return ret;
}
int idx = 0;
for (Course course : iCourses) {
for (Config config : course.getOffering().getConfigs()) {
Expand Down

0 comments on commit 926d487

Please sign in to comment.