Skip to content

Commit

Permalink
Course Timetabling: Following Dates
Browse files Browse the repository at this point in the history
- given classes must be taught on back-to-back dates and in the given order
- when prohibited or (strongly) discouraged: given classes must be taught on dates in the given order, with at least one day between the following classes
- note: The primary use for this constraint is for classes that meet only once
  - the constraint cannot be satisfied when one of the meetings falls on a holiday, and the other does not
  • Loading branch information
tomas-muller committed Dec 20, 2024
1 parent 14e5d2b commit 1cd6629
Show file tree
Hide file tree
Showing 6 changed files with 125 additions and 20 deletions.
Binary file modified 3rd_party/sources/cpsolver-1.4-SNAPSHOT-sources.jar
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>

<script name="Distribution Types: Create Different Time + Ignore Student Conflicts Constraint" permission="Distribution Preferences" engine="ECMAScript" created="Thu Dec 19 15:12:22 CET 2024">
<description><![CDATA[This script creates the Different Time + Ignore Student Conflicts Constraint.<br>
Combination of two constraints, Different Time and Ignore Student Conflicts.<br>
Given classes cannot overlap in time, replacing any student conflicts between these classes.<br>
When prohibited or (strongly) discouraged: every pair of classes in the constraint must overlap in time. Still, student conflicts are ignored.]]></description>
<body><![CDATA[var reqId = hibSession.createQuery('select max(requirementId) from DistributionType').uniqueResult();
var type = hibSession.createQuery('from DistributionType where reference = :reference').setParameter('reference', 'DIFF_TIME_IGN_STUDS').uniqueResult();
if (type == null) {
type = new org.unitime.timetable.model.DistributionType();
type.setReference('DIFF_TIME_IGN_STUDS');
type.setLabel('Different Time + Ignore Student Conflicts');
type.setSequencingRequired(false);
type.setRequirementId(++reqId);
type.setAllowedPref('P43210R');
type.setDescr('Combination of two constraints, Different Time and Ignore Student Conflicts.<br>' +
'Given classes cannot overlap in time, replacing any student conflicts between these classes.<br>' +
'When prohibited or (strongly) discouraged: every pair of classes in the constraint must overlap in time. Still, student conflicts are ignored.'
);
type.setAbbreviation('Diff Time No Stds');
type.setInstructorPref(true);
type.setExamPref(false);
type.setVisible(true);
hibSession.saveOrUpdate(type);
log.info('Different Time + Ignore Student Conflicts distribution type created.');
} else {
log.warn('Different Time + Ignore Student Conflicts distribution type already exists.');
}
log.info('All done.');]]></body>
</script>
33 changes: 33 additions & 0 deletions Documentation/Scripts/Create Following Dates Constraint.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>

<script name="Distribution Types: Create Following Dates Constraint" permission="Distribution Preferences" engine="ECMAScript" created="Thu Dec 19 14:53:46 CET 2024">
<description><![CDATA[This script creates the Following Dates Constraint.<br>
Given classes must be taught on back-to-back dates and in the given order.<br>
When prohibited or (strongly) discouraged: given classes must be taught on dates in the given order, with at least one day between the following classes.<br>
Note: The primary use for this constraint is for classes that meet only once. The constraint cannot be satisfied when one of the meetings falls on a holiday, and the other does not.]]></description>
<body><![CDATA[var reqId = hibSession.createQuery('select max(requirementId) from DistributionType').uniqueResult();
var type = hibSession.createQuery('from DistributionType where reference = :reference').setParameter('reference', 'FOLLOWING_DATES').uniqueResult();
if (type == null) {
type = new org.unitime.timetable.model.DistributionType();
type.setReference('FOLLOWING_DATES');
type.setLabel('Following Dates');
type.setSequencingRequired(false);
type.setRequirementId(++reqId);
type.setAllowedPref('P43210R');
type.setDescr('Given classes must be taught on back-to-back dates and in the given order.<br>' +
'When prohibited or (strongly) discouraged: given classes must be taught on dates in the given order, with at least one day between the following classes.<br>' +
'Note: The primary use for this constraint is for classes that meet only once. The constraint cannot be satisfied when one of the meetings falls on a holiday, and the other does not.'
);
type.setAbbreviation('Following Dates');
type.setInstructorPref(true);
type.setExamPref(false);
type.setVisible(true);
hibSession.saveOrUpdate(type);
log.info('Following Dates distribution type created.');
} else {
log.warn('Following Dates distribution type already exists.');
}
log.info('All done.');]]></body>
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>

<script name="Distribution Types: Create Same Students No Distance Constraint" permission="Distribution Preferences" engine="ECMAScript" created="Thu Dec 19 15:05:10 CET 2024">
<description><![CDATA[This script creates the Same Students No Distance Constraint.<br>
This distribution is the same as the Same Students distribution, except there is no distance conflict checking and no work-day limit.<br>
Also, the distribution gets ignored when there is the Ignore Student Conflicts distribution between the two classes.]]></description>
<body><![CDATA[var reqId = hibSession.createQuery('select max(requirementId) from DistributionType').uniqueResult();
var type = hibSession.createQuery('from DistributionType where reference = :reference').setParameter('reference', 'SAME_STUD_NODST').uniqueResult();
if (type == null) {
type = new org.unitime.timetable.model.DistributionType();
type.setReference('SAME_STUD_NODST');
type.setLabel('Same Students No Distance');
type.setSequencingRequired(false);
type.setRequirementId(++reqId);
type.setAllowedPref('210R');
type.setDescr('This distribution is the same as the Same Students distribution, except there is no distance conflict checking and no work-day limit.<br>' +
'Also, the distribution gets ignored when there is the Ignore Student Conflicts distribution between the two classes.<br>' +
'This constraint can be used as the Same Student Constraint in the solver configuration, e.g., in the interactive mode, ' +
'replacing the Different Time constraint which does not ignore cases when there is the Ignore Student Conflicts between two classes in a parent-child relation.'
);
type.setAbbreviation('Same Studs No Dist');
type.setInstructorPref(true);
type.setExamPref(false);
type.setVisible(true);
hibSession.saveOrUpdate(type);
log.info('Same Students No Distance distribution type created.');
} else {
log.warn('Same Students No Distance distribution type already exists.');
}
log.info('All done.');]]></body>
</script>
Binary file modified WebContent/WEB-INF/lib/cpsolver-1.4-SNAPSHOT.jar
Binary file not shown.
46 changes: 26 additions & 20 deletions WebContent/help/Release-Notes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,26 @@
<item>
<name>Distribution Preferences</name>
<description>
<line>Added two new group constraints (distribution types).</line>
<line>SAME_STUD_NODST: Same Students w/o Distance
<line>Same as the Same Students distribution, except there is no distance conflict checking and no work-day limit.</line>
<line>Also, the distribution gets ignored when there is Ignore Student Conflicts distribution between the two classes.</line>
<line>Added three new group constraints (distribution types).</line>
<line>SAME_STUD_NODST: Students No Distance Constraint
<line>This distribution is the same as the Same Students distribution, except there is no distance conflict checking and no work-day limit.</line>
<line>Also, the distribution gets ignored when there is the Ignore Student Conflicts distribution between the two classes.</line>
<line>To replace DIFF_TIME in General.AutoSameStudentsConstraint
<line>Same as different time, but does not ignore cases when there is Ignore Student Conflicts between two classes in parent-child.</line>
<line>This constraint can be used as the Same Student Constraint in the solver configuration, e.g., in the interactive mode,
replacing the Different Time constraint which does not ignore cases when there is the Ignore Student Conflicts between two classes in a parent-child relation.
</line>
</line>
</line>
<line>DIFF_TIME_IGN_STUDS: Different Time + Ignore Student Conflicts
<line>Combination of two constraints, Different Time and Ignore Student Conflicts.</line>
<line>Given classes cannot overlap in time, replacing any student conflicts between these classes.</line>
<line>When prohibited or (strongly) discouraged: every pair of classes in the constraint must overlap in time.
<line>Still, student conflicts are ignored.</line>
</line>
<line>When prohibited or (strongly) discouraged: every pair of classes in the constraint must overlap in time. Still, student conflicts are ignored.</line>
</line>
<line>FOLLOWING_DATES: Following Dates
<line>Given classes must be taught on back-to-back dates and in the given order.</line>
<line>When prohibited or (strongly) discouraged: given classes must be taught on dates in the given order, with at least one day between the following classes.</line>
<line>Note: The primary use for this constraint is for classes that meet only once.
The constraint cannot be satisfied when one of the meetings falls on a holiday, and the other does not.</line>
</line>
</description>
</item>
Expand All @@ -63,18 +69,18 @@
<name>Instructor Distribution Preferences</name>
<description>
<line>Many course timetabling distributions (group constraint and flexible constraints) have been included in the instructor scheduling problem, namely
<line>At Most N Hours A Day</line>
<line>Same Weeks</line>
<line>N Hour Workday</line>
<line>Mininal Gap Between Classes</line>
<line>Max Block</line>
<line>Max Breaks</line>
<line>Max Days</line>
<line>Break</line>
<line>Max Weeks</line>
<line>Max Holes</line>
<line>Max Half-Days</line>
<line>Max Consecutive Days</line>
<line>At Most N Hours A Day: Classes are to be placed in a way that there is no more than given number of hours in any day.</line>
<line>Same Weeks: Given classes must be taught during the same weeks (i.e., must have the same date pattern).</line>
<line>N Hour Workday: Classes are to be placed in a way that there is no more than given number of hours between the start of the first class and the end of the class one on any day.</line>
<line>Mininal Gap Between Classes: Classes need to be placed in a way that there is at least the given number of minutes between any two of them.</line>
<line>Max Block: Given classes must be taught in a way there is a break between two blocks of classes.</line>
<line>Max Breaks: Limit number of breaks between adjacent classes on a day.</line>
<line>Max Days: Limit number of days of a week.</line>
<line>Break: There must be a break of a given length in a given time interval.</line>
<line>Max Weeks: Limit number of weeks on which an a class can take place.</line>
<line>Max Holes: Minimize free time of an instructor during a day (between the first and the last class).</line>
<line>Max Half-Days: Limit number of half-days of a week.</line>
<line>Max Consecutive Days: Limit number of consecutive days of a week.</line>
</line>
<line>See https://help.unitime.org/additional-distribution-constraints for more details about the additional distribution constraint types.</line>
</description>
Expand Down

0 comments on commit 1cd6629

Please sign in to comment.