# Assigning Classes

Avishalom Shalit avishalom at gmail.com
Mon Sep 9 22:31:59 BST 2013

```I would agree that the problem is ill posed.

a formal (and therefor solvable ) definition would be e.g. by defining the
cost of a solution and minimizing it.
e.g. for each student, for each of his two courses  his personal cost  for
that course is the square of his raking.
(so if he ranked it 4, his cost for the course is 16)

now you can add the constraints as further "costs"

e.g. for every course with more than LIMIT students. you add 1000 *
(enrolled-LIMIT)^2
for every course with under 2 students you add 10000*(2-number of students
in course)^2
you could add another term to compensate students. (e.g. every student with
a course rated 4 or 5 gets a (Course1rate+course2rate)^4 price)

sum over all prices, and minimize.*
but there needs to be a defined cost of getting the lower ranked classes,
and for "bumping" somone

* (e.g. by moving players at random, occasionally by switching players. and
if you end up with lower price, accept the change, if you raise the price,
revert with some probability (1-exp(-beta*deltaPrice)))
____________________

<http://en.wikipedia.org/wiki/Stable_marriage_problem>

-- vish

On 9 September 2013 11:21, James Laver <james.laver at gmail.com> wrote:

> On Mon, Sep 9, 2013 at 4:10 PM, Dave Cross <dave at dave.org.uk> wrote:
> >
> > I'm pretty sure that Paul wasn't actually dismissing Prolog. I think
> you'll
> > find he was making a joke.
>
> ...which I should have gotten but I'm full of cold.
>
> James
>
```