[PRL] How about Tues 200-300 for macro reading group?

Jeffrey D Palm jpalm at ccs.neu.edu
Fri Sep 10 09:17:43 EDT 2004


Mitchell Wand wrote:

> OK, folks, time for some constraint solving.  Can somebody try to
> figure out the most feasible time.
> 
> Here are my constraints:
> 
> Mon: 12-130 no
> Tue:  6-9pm no (so anything after 4 on Tuesdays is deprecated)
> Wed: 1145-130 pl-seminar, anything after 4 is deprecated.
> Thu: 9-11am no, 12-130 no.
> Fri: deprecated (gotta get some work done sometime...)
> 
> Would somebody like to collate these?  I believe John Clements wrote a
> program to do this a couple of years ago.
> 
> --Mitch 
> 
> 

The numbers are the number of conflicts:

Day 0800 0900 1000 1100 1200 1300 1400 1500 1600 1700 1800 1900 2000 2100
mon                     1111 1111 111
tue 1111 1111 1111 1111 1111 1111 1111 1111 2222 2222 2222 2222 2222 2222
wed                   2 2222 1111 111
thu      1111 1111      1111 1111 1111 1111 1111 1111 1111 1111 1111
fri 2222 2222 2222 2222 2222 2222 2222 2222 2222 2222 2222 2222 2222 222

if you want to add more...

#!/usr/bin/perl

@days = (mon, tue, wed, thu, fri);

# day -> constraints
# a constraints is a list of (start,stop) times
%constraints =
(
  mon => ['1200','1330' , '1330','1445' , ],
  tue => ['1145','1705' , '1600','2345' , '0800','1145' , ],
  wed => ['1145','1300' , '1145','1445' , ],
  thu => ['0900','1100' , '1200','1330' , '1330','1445' , '1445','1800', '1800','2100' , ],
  fri => ['0800','2145' , '0800','2145' , ],
  );

$ok = 1;
$start_hour = 8;
$stop_hour = 21;
print "Day ";
for (my $h = $start_hour; $h <= $stop_hour; $h++) {
     my $hour = $h < 10 ? 0 . $h : $h;
     print "$hour" . "00 ";
}
print "\n";
for (my $i = 0; $i <= $#days; $i++) {
     my $stack = 0;
     my $day = $days[$i];
     my @cst = @{ $constraints{$day} };
     print $day;
     for (my $h = $start_hour; $h <= $stop_hour; $h++) {
	my $hour = $h < 10 ? 0 . $h : $h;
	print " ";
	for (my $m = 0; $m <= 45; $m += 15) {
	    for (my $j = 0; $j <= $#cst; $j += 2) {
		my $start = $cst[$j+0];
		my $stop  = $cst[$j+1];
		my $min = $m < 10 ? 0 . $m : $m;
		my $time = $hour . $min;
		if ($time eq $start) {$stack++}
		if ($time eq $stop)  {$stack--}
	    }
	    print $stack eq 0 ? ' ' : $stack;
	}
     }
     print "\n";
}


-- 
Jeffrey Palm --> http://www.ccs.neu.edu/home/jpalm



More information about the PRL mailing list