Skip to content

Commit c98810f

Browse files
committed
Dependencies: CPSolver Update
Course Timetabling: New Group Constraints - added two new group constraints (distribution types) SAME_STUD_NODST: Same Students w/o Distance - same as the Same Students distribution, except there is no distance conflict checking and no work-day limit - also, the distribution gets ignored when there is Ignore Student Conflicts distribution between the two classes - to replace DIFF_TIME in General.AutoSameStudentsConstraint - same as different time, but does not ignore cases when there is Ignore Student Conflicts between two classes in parent-child relation DIFF_TIME_IGN_STUDS: Different Time + Ignore Student Conflicts - combination of two constraints, Different Time and Ignore Student Conflicts - given classes cannot overlap in time, replacing any student conflicts between these classes - when prohibited or (strongly) discouraged: every pair of classes in the constraint must overlap in time - still, student conflicts are ignored Instructor Scheduling: Distributions - many course timetabling distributions (group constraint and flexible constraints) have been included in the instructor scheduling problem - namely - At Most N Hours A Day - Same Weeks - N Hour Workday - Mininal Gap Between Classes - Max Block - Max Breaks - Max Days - Break - Max Weeks - Max Holes - Max Half-Days - Max Consecutive Days
1 parent 8f5cb33 commit c98810f

5 files changed

Lines changed: 66 additions & 0 deletions

File tree

39.8 KB
Binary file not shown.

JavaSource/org/unitime/timetable/solver/instructor/InstructorSchedulingDatabaseLoader.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,15 @@
6565
import org.unitime.timetable.model.InstructorPref;
6666
import org.unitime.timetable.model.Location;
6767
import org.unitime.timetable.model.PreferenceLevel;
68+
import org.unitime.timetable.model.Session;
6869
import org.unitime.timetable.model.StudentClassEnrollment;
6970
import org.unitime.timetable.model.TeachingClassRequest;
7071
import org.unitime.timetable.model.TimePatternModel;
7172
import org.unitime.timetable.model.TimePref;
7273
import org.unitime.timetable.model.dao.DepartmentDAO;
74+
import org.unitime.timetable.model.dao.SessionDAO;
7375
import org.unitime.timetable.model.dao.TimetableManagerDAO;
76+
import org.unitime.timetable.util.DateUtils;
7477
import org.unitime.timetable.util.NameFormat;
7578

7679
/**
@@ -137,6 +140,20 @@ protected void load(org.hibernate.Session hibSession) throws Exception {
137140
}
138141
}
139142

143+
Session session = SessionDAO.getInstance().get(iSessionId, hibSession);
144+
if (session != null) {
145+
getModel().getProperties().setProperty("DatePattern.DayOfWeekOffset",
146+
String.valueOf(org.unitime.timetable.util.Constants.getDayOfWeek(
147+
DateUtils.getDate(1, session.getPatternStartMonth(), session.getSessionStartYear()))));
148+
if (session.getDefaultDatePattern() != null) {
149+
BitSet pattern = session.getDefaultDatePattern().getPatternBitSet();
150+
String patternStr = "";
151+
for (int i = 0; i < pattern.length(); i++)
152+
patternStr += (pattern.get(i) ? "1" : "0");
153+
getModel().getProperties().setProperty("DatePattern.Default", patternStr);
154+
}
155+
}
156+
140157
loadInstructors(hibSession);
141158

142159
loadRequests(hibSession);
@@ -183,6 +200,9 @@ protected void loadDistributionPreferences(Instructor instructor, DistributionPr
183200
instructor.setSameDaysPreference(Constants.preference2preferenceLevel(dp.getPrefLevel().getPrefProlog()));
184201
} else if ("SAME_ROOM".equals(dp.getDistributionType().getReference())) {
185202
instructor.setSameRoomPreference(Constants.preference2preferenceLevel(dp.getPrefLevel().getPrefProlog()));
203+
} else {
204+
if (instructor.addDistribution(dp.getDistributionType().getReference(), dp.getPrefLevel().getPrefProlog(), dp.getLabel()) == null)
205+
iProgress.warn("Distribution " + dp.getDistributionType().getLabel() + " is not supported by the instructor scheduling solver.");
186206
}
187207
}
188208

JavaSource/org/unitime/timetable/solver/instructor/InstructorSchedulingSolver.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
import org.cpsolver.ifs.util.ProblemSaver;
3838
import org.cpsolver.ifs.util.Progress;
3939
import org.cpsolver.ifs.util.ToolBox;
40+
import org.cpsolver.instructor.constraints.GroupConstraint.Distribution;
4041
import org.cpsolver.instructor.model.Attribute;
4142
import org.cpsolver.instructor.model.Course;
4243
import org.cpsolver.instructor.model.EnrolledClass;
@@ -247,6 +248,8 @@ protected InstructorInfo toInstructorInfo(Instructor instructor) {
247248
info.addDistributionPreference(new PreferenceInfo(1l, CONSTANTS.instructorSameDays(), Constants.preferenceLevel2preference(instructor.getSameDaysPreference())));
248249
if (instructor.getSameRoomPreference() != 0)
249250
info.addDistributionPreference(new PreferenceInfo(1l, CONSTANTS.instructorSameRoom(), Constants.preferenceLevel2preference(instructor.getSameRoomPreference())));
251+
for (Distribution d: instructor.getDistributions())
252+
info.addDistributionPreference(new PreferenceInfo(1l, d.getType().getName(), d.getPreference()));
250253
return info;
251254
}
252255

2.01 KB
Binary file not shown.

WebContent/help/Release-Notes.xml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,49 @@
3636
<line>Better formatting of the Instructor Requirements table, especially when there is a column with a lot of text.</line>
3737
</description>
3838
</item>
39+
<item>
40+
<name>Distribution Preferences</name>
41+
<description>
42+
<line>Added two new group constraints (distribution types).</line>
43+
<line>SAME_STUD_NODST: Same Students w/o Distance
44+
<line>Same as the Same Students distribution, except there is no distance conflict checking and no work-day limit.</line>
45+
<line>Also, the distribution gets ignored when there is Ignore Student Conflicts distribution between the two classes.</line>
46+
<line>To replace DIFF_TIME in General.AutoSameStudentsConstraint
47+
<line>Same as different time, but does not ignore cases when there is Ignore Student Conflicts between two classes in parent-child.</line>
48+
</line>
49+
</line>
50+
<line>DIFF_TIME_IGN_STUDS: Different Time + Ignore Student Conflicts
51+
<line>Combination of two constraints, Different Time and Ignore Student Conflicts.</line>
52+
<line>Given classes cannot overlap in time, replacing any student conflicts between these classes.</line>
53+
<line>When prohibited or (strongly) discouraged: every pair of classes in the constraint must overlap in time.
54+
<line>Still, student conflicts are ignored.</line>
55+
</line>
56+
</line>
57+
</description>
58+
</item>
59+
</category>
60+
<category>
61+
<title>Instructor Scheduling</title>
62+
<item>
63+
<name>Instructor Distribution Preferences</name>
64+
<description>
65+
<line>Many course timetabling distributions (group constraint and flexible constraints) have been included in the instructor scheduling problem, namely
66+
<line>At Most N Hours A Day</line>
67+
<line>Same Weeks</line>
68+
<line>N Hour Workday</line>
69+
<line>Mininal Gap Between Classes</line>
70+
<line>Max Block</line>
71+
<line>Max Breaks</line>
72+
<line>Max Days</line>
73+
<line>Break</line>
74+
<line>Max Weeks</line>
75+
<line>Max Holes</line>
76+
<line>Max Half-Days</line>
77+
<line>Max Consecutive Days</line>
78+
</line>
79+
<line>See https://help.unitime.org/additional-distribution-constraints for more details about the additional distribution constraint types.</line>
80+
</description>
81+
</item>
3982
</category>
4083
<category>
4184
<title>Administration</title>

0 commit comments

Comments
 (0)