A simple script for allocating projects to groups of students based on entered preferences. This script currently generates a random set of preferences, and then passes it through three approaches:
- Generate a random, valid solution (based on the preferences to improve the likelihood of a good solution being found).
- If this solution is better than the current best solution, save it. Otherwise, throw it away.
- Repeat.
- Generate a random, valid solution (based on the preferences to improve the likelihood of a good solution being found).
- Save this as the current best solution.
- Mutate the solution slightly by changing a random project allocation to another preference.
- Check if this is better than the current best solution. If so, save it. Otherwise, throw it away.
- Repeat from step 3 onwards.
- Generate a population of random, valid solutions (but without looking at the preferences).
- Rank these solutions based on their costs.
- Save the best x solutions, and throw away the rest.
- Generate mutations of the best solutions to create a new population.
- Repeat from step 2 onwards.
Valid solutions are ones where all groups are allocated a project with no duplicates (i.e. no projects are allocated more than once). The script prints out the number of iterations, cost of best solution, and time taken for each of the three approaches, followed by the best solution of the genetic algorithm (which generally does produce the best result).
- numprojects = Total number of projects available
- numgroups = Total number of groups needing projects
- numprefs = Number of preferences expressed by each group
- testiterations = Maximum number of iterations before each method should stop and present the best solution found so far
- minimabreak = When the hill climbing and genetic algorithm approaches should stop if they are not making much progress (i.e. they are already in a minima and the solution isn't likely to get much better). Expressed as a percentage of testiterations, so a larger minimabreak means that the algorithms should try for longer.