Scheduling Course / Teacher Combinations (cpm22)
/****************************************************************/
/* S A S S A M P L E L I B R A R Y */
/* */
/* NAME: CPM22 */
/* TITLE: Scheduling Course / Teacher Combinations (cpm22) */
/* PRODUCT: OR */
/* SYSTEM: ALL */
/* KEYS: CPM */
/* PROCS: CPM */
/* DATA: */
/* */
/* SUPPORT: UPDATE: */
/* REF: Example 22 from the CPM Chapter (PM User's Guide) */
/* MISC: */
/* */
/****************************************************************/
title 'Scheduling Course / Teacher Combinations';
data classes;
input class $ succ $ dur c1-c4 t1-t3 nrooms;
datalines;
c1t1 . 1 1 . . . 1 . . 1
c1t2 . 1 1 . . . . 1 . 1
c1t3 . 1 1 . . . . . 1 1
c2t1 . 1 . 1 . . 1 . . 1
c2t3 . 1 . 1 . . . . 1 1
c3t1 . 1 . . 1 . 1 . . 1
c3t2 . 1 . . 1 . . 1 . 1
c3t3 . 1 . . 1 . . . 1 1
c4t1 . 1 . . . 1 1 . . 1
c4t2 . 1 . . . 1 . 1 . 1
;
data resource;
input per c1-c4 t1-t3 nrooms;
datalines;
1 1 1 1 1 1 . 1 3
4 . . . . . 1 . .
;
proc cpm data=classes out=sched
resin=resource;
activity class;
duration dur;
successor succ;
resource c1-c4 t1-t3 nrooms / period=per stopdate=6;
run;
proc format;
value classtim
1 = 'Saturday 9:00-10:00'
2 = 'Saturday 10:00-11:00'
3 = 'Saturday 11:00-12:00'
4 = 'Sunday 9:00-10:00'
5 = 'Sunday 10:00-11:00'
6 = 'Sunday 11:00-12:00'
7 = 'Not Scheduled'
;
value $classt
c1t1 = 'Class 1, Teacher 1'
c1t2 = 'Class 1, Teacher 2'
c1t3 = 'Class 1, Teacher 3'
c2t1 = 'Class 2, Teacher 1'
c2t2 = 'Class 2, Teacher 2'
c2t3 = 'Class 2, Teacher 3'
c3t1 = 'Class 3, Teacher 1'
c3t2 = 'Class 3, Teacher 2'
c3t3 = 'Class 3, Teacher 3'
c4t1 = 'Class 4, Teacher 1'
c4t2 = 'Class 4, Teacher 2'
c4t3 = 'Class 4, Teacher 3'
;
data schedtim;
set sched;
format classtim classtim.;
format class $classt.;
if (s_start <= 6) then classtim = s_start;
else classtim = 7;
run;
title2 'Schedule of Classes';
proc print;
id class;
var classtim;
run;
data resourc2;
input per c1-c4 t1-t3 nrooms;
datalines;
1 1 1 1 1 1 . 1 1
2 . . . . . . . 3
3 . . . . . . . 2
4 . . . . . 1 . 1
5 . . . . . . . 3
;
proc cpm data=classes out=sched2
resin=resourc2;
activity class;
duration dur;
successor succ;
resource c1-c4 t1-t3 nrooms / period=per stopdate=6;
run;
data schedtim;
set sched2;
format classtim classtim.;
format class $classt.;
if (s_start <= 6) then classtim = s_start;
else classtim = 7;
run;
title2 'Alternate Schedule with Additional Constraints';
proc print;
id class;
var classtim;
run;