Re: How to assign seats with limit

Interesting problem. I read this blog and the link to the other forum. I started down a side path to the one suggested by Craige Hales. I stacked the wishes to get find the most requested (desired) program. My thoughts were to maximize desirability (6 - wish rank), and start assigments by most popular ( programs with the highest desirability). I have limited time today to pursue, but thought, hey this should be a common problem. I googled for algorithm to assign limited resources based upon ranked desirability and found several interesting links.

This paper below describes a similar problem but it uses a totally random (fair) assignment vs. GPA criteria. I am posting this link as an FYI. It might provide a few leads (TBD).

Notice the comma in your code. The two statements just before the comma are part of the then clause. "if seatrow has a seat left, then give one of those seats to the student and take it away from the available seats."

"else find a program with a seat." Notice the seat is not given to a student, and not taken away from the available seats. That might be why nothing happened after 11 students. To get more info...

A big debugging aid: add show(...); statements in the JSL and read the log to understand what is happening:

If( dtSeats:seats[seatrow]>0, show("got wish",iStudent,seatrow); ... grant wish by assigning it to student and decrement the seat count, // else show("sorry",iStudent); ... pick alternate program and assign it to the student and decrement the seat count show("you get",seatrow););

Re: How to assign seats with limit

I don't think the == error is in the JSL you posted. The comparison operators are <, <=, >, >=, == and are used to compare two values. The comparison operators happen in the 1st, 3rd, 5th, 7th, etc parts of the if statement. The assignment operator is = and happens in the 2nd, 4th, 6th, etc parts of the if. You need to study the structure of the if statement (the commas are really important!) and fix that, not just change an = to ==. JMP is reporting an error that you have used an = where an == was more likely correct. JMP is not telling you to change the = to ==, it is telling you there is something wrong near the =.

There are also several errors with the lookup function being called with two arguments ("HRS - HS - Epi", "HRS - HS - Epi") for example.

Re: How to assign seats with limit

Also: lookup is probably not a function, but an associative array. You need to use square brackets for the subscript, not round parenthesis for the argument. (I'm pretty sure I made the paren mistake a few posts back.)