Now that we have gone over how to setup LDAP, and went into some more depth about how to search using it, we will now look at actually writing a web page in PHP that uses LDAP. As always, I will be using RPI as my example but this should work for anyone with an LDAP system. (Note to people at RPI, you need to VPN in unless you are in the VCC for this to work, I have had luck with doing this in Lally, but in the Union it failed) The first example will go over how to just use LDAP to return information; the second one will incorporate the CAS example that was done before, and search for the user that logs in, this will be put out in a few days. The LDAP servers I am using do not require authentication, if the one you are using does then you will need to go to http://www.php.net/manual/en/function.ldap-bind.php and look at using authentication on your command.
The next post will go over combining CAS and LDAP. Until then thanks for commenting and feel free to ask questions.
Download: http://programs.buildingtents.com/ldap.php.zip
References:
http://www.php.net/manual/en/function.ldap-search.php

I performed at a party we held to celebrate changes happening among many friends at one of my favorite spots in San Francisco with wonderful people! Here is a recording of the set:
Colin’s Dore “Changes” Party Set
Download:
Apple Lossless .m4a
.flac
.mp3
.ogg
This semester we made some modifications to the integer program we solve in SCIP to schedule exams.
We have people (instructors and students) who give/take exams. Exams are given during time slots which occur over several days. We want to minimize the number of people who have conflicts (more than one exam at one time) and overload (three or more exams in one day). We count conflicts as twice as bad as overloading since conflicts always require rescheduling, whereas overloading is optional to reschedule (at RPI).
We use binary variables called examIsAt to indicate when each exam meets. There is an examIsAt variable for every combination of exam and timeslot, and the variable will equal one in a solution when the exam meets at that time slot, else it equals zero.
We use non-negative integer variables called conflictAt to indicate how many exams a person has during a given time. The conflictAt variable for a person and time will be zero if the person has zero exams during that time, and equal to one less than the number of exams he/she has during the time otherwise.
To indicate which persons have three or more exams in some day we use threePlus variables. These are set to zero if the person never has more than two exams in one day, otherwise it is set to the number of exams that a person has on their worst day ABOVE 2. For example, if person X has all 5 of their exams on a single day then their threePlus variable will be set to 3. This set up means that we don't keep track of how many days someone goes over, so for example a person with 6 exams spread out evenly over two days is only counted as one overload. The advantage of this set up is that it cuts down on the number of variables and constraints we need.
In total, if P is the number of people, E the number of exams, T the number of time slots and D the number of days then we have:
(ET + P + PT) variables and
(E + TP + PD) constraints.
For example if E = 300, P = 5000, T = 20, D = 5 then we have 111,000 variables and 125,300 constraints.
In the modelling language Zimpl this program could look like:
set PEOPLE;
set EXAMS[PEOPLE];
set ALL_EXAMS := union < p > in PEOPLE : EXAMS[p];
set TSLOT;
set DAYS;
set DAYSLOT [DAYS] ;
var examIsAt [ < e , t > in ALL_EXAMS cross TSLOT] binary;
var threePlus[ < t, p > in PEOPLE] integer >= 0;
var conflictAt[ < t , p > in TSLOT cross PEOPLE] integer >= 0;
minimize clashes:
(sum < p > in PEOPLE : threePlus[p])
+ 2 * (sum < t > in TSLOT : (sum < p > in PEOPLE : conflictAt[t,p]) )
subto once:
forall < e > in ALL_EXAMS do
sum< t > in TSLOT : examIsAt [e,t] == 1;
subto conflicts:
forall < t, p > in TSLOT cross PEOPLE do
- conflictAt[t,p] + (sum < e > in EXAMS[p]: examIsAt[e,t]) <= 1;
subto overload:
forall < p, d > in PEOPLE cross DAYS do
- threePlus[p] + sum < e > in EXAMS[p]: (sum < t > in DAYSLOT[d]: examIsAt [e,t]) <= 2;
In the modeling language AMPL the model could be written similarly as:
set PEOPLE;
set EXAMS {PEOPLE} ordered;
set ALL_EXAMS=union {p in PEOPLE} EXAMS[p];
set TSLOT ordered;
set DAYS;
set DAYSLOT {DAYS};
var examIsAt{e in ALL_EXAMS,t in TSLOT} binary;
var threePlus{p in PEOPLE} binary;
var conflictAt{t in TSLOT, p in PEOPLE} >= 0;
minimize Clashes:
sum {p in PEOPLE} threePlus[p] + sum{t in TSLOT, p in PEOPLE} 2 * conflictAt[t,p];
subject to Once{e in ALL_EXAMS}: sum {t in TSLOT} examIsAt[e,t] = 1;
subject to Conflicts{t in TSLOT, p in PEOPLE}: -conflictAt[t,p] + sum {e in EXAMS[p]} examIsAt[e,t] <= 1;
subject to Overload {p in PEOPLE, d in DAYS}: sum {e in EXAMS[p], t in DAYSLOT[d]} examIsAt[e,t] - threePlus[p] <= 2;
Spring 2013 was a bit of a tough semester for YAExS. We weren't able to get as much realistic testing in as we'd have liked due to problems gathering data. We have data on students from Fall 2011 but we no longer have access to course information from that semester, so to preform tests we created a mapping between Fall 2011 CRNs and 2013 CRNs.
Improvements: - Memory usage was reduced by changing the integer program. The constraints that set indicator variables for students having too many exams in one day were streamlined so that we only need one variable per student, not two. This reduces the number of variables by the number of students, several thousand, or about 5% of the total variables.
Bugs in the upper/lower bounds of variables in the optimizer were identified and corrected.
Department Schedulers can enter exam preferences using a lightbox interface.