forked from science-ation/science-ation
- Handle the case where a student doesn't use all their tour rankings.
This commit is contained in:
parent
1dd573ab63
commit
c8d01cb8fb
@ -70,13 +70,26 @@ set_percent(0);
|
|||||||
+5 - Noone from the same school
|
+5 - Noone from the same school
|
||||||
If ranked (rank=1,2,3,4,...):
|
If ranked (rank=1,2,3,4,...):
|
||||||
+(rank*rank*5 - 5) = +0, +15, +40, +75
|
+(rank*rank*5 - 5) = +0, +15, +40, +75
|
||||||
If not ranked:
|
If not ranked and max choices specified
|
||||||
+(max_choices*max_choices*5) (always greater than ranked)
|
+(max_choices*max_choices*5) (always greater than ranked)
|
||||||
|
else max choices not specified
|
||||||
|
+((max_choices-1)*(max_choices-1)*5)
|
||||||
- Foreach tour
|
- Foreach tour
|
||||||
+100 for each student above the capacity
|
+100 for each student above the capacity
|
||||||
+200 for each student below 1/4 the capacity,but
|
+200 for each student below 1/4 the capacity,but
|
||||||
zero if the tour is empty
|
zero if the tour is empty
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
- If a student doesn't fill in all their choices, we don't want to give
|
||||||
|
them an unfair scheduling advantage. They'll significantly increase
|
||||||
|
the cost if they don't get their chosen tour, whereas someone who
|
||||||
|
specifies all the choices will gradually increase the cost. So, we
|
||||||
|
want to make it "more ok" for the annealer to place someone who
|
||||||
|
hasn't ranked their max number of tours in any tour, and make it
|
||||||
|
"less ok" for someone who has specified all the rankings to be placed
|
||||||
|
anywhere.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function tour_cost_function($annealer, $bucket_id, $ids)
|
function tour_cost_function($annealer, $bucket_id, $ids)
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
@ -118,8 +131,14 @@ function tour_cost_function($annealer, $bucket_id, $ids)
|
|||||||
if($rank_tid != $tid) continue;
|
if($rank_tid != $tid) continue;
|
||||||
$rank_cost = ($rank * $rank * 5) - 5;
|
$rank_cost = ($rank * $rank * 5) - 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($rank_cost == -1) {
|
if($rank_cost == -1) {
|
||||||
$rank_cost = $config['tours_choices_max'] * $config['tours_choices_max'] * 5;
|
/* Coulnd't find tour id in the student ranks*/
|
||||||
|
if(count($s['rank']) < $config['tours_choices_max']) {
|
||||||
|
$rank_cost = ($config['tours_choices_max']-1) * ($config['tours_choices_max']-1) * 5;
|
||||||
|
} else {
|
||||||
|
$rank_cost = $config['tours_choices_max'] * $config['tours_choices_max'] * 5;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$cost += $rank_cost;
|
$cost += $rank_cost;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user