Use div_prefs and cat_prefs (make the scheduler work again)

Give higher preference to not having leftover judges
Treat 'indifferent' cat_prefs as cost=0 even though its a 2 (on the 0-4 scale)
This commit is contained in:
james 2010-09-22 18:28:51 +00:00
parent a8fa8e7a99
commit 2292af3206

View File

@ -109,7 +109,7 @@ function judges_cost_function($annealer, $bucket_id, $ids)
if($bucket_id == 0) { if($bucket_id == 0) {
/* This is the placeholder for all judges, there's a slight /* This is the placeholder for all judges, there's a slight
* cost for not using a judge */ * cost for not using a judge */
$cost = count($ids) * 5; $cost = count($ids) * 8;
// TRACE("Extra judge team cost=$cost\n"); // TRACE("Extra judge team cost=$cost\n");
return $cost; return $cost;
} }
@ -139,15 +139,19 @@ function judges_cost_function($annealer, $bucket_id, $ids)
for($y=0; $y < count($t['cats']); $y++) { for($y=0; $y < count($t['cats']); $y++) {
$l = $t['cats'][$y]; $l = $t['cats'][$y];
/* Lookup the judge cat pref for this category */ /* Lookup the judge cat pref for this category */
$pref = -$j['catprefs'][$l] + 2; $pref = -$j['cat_prefs'][$l] + 2;
/* $pref = 0 (best match) --- 4 (worst match) */ /* $pref = 0 (best match) --- 4 (worst match) */
//but wait, if they're "indifferent" then we really dont care, so the cost for it shoudl be 0.
if($pref==2) $pref=0;
$cpref += $pref; $cpref += $pref;
} }
$dpref = 0; $dpref = 0;
for($y=0; $y < count($t['divs']); $y++) { for($y=0; $y < count($t['divs']); $y++) {
$l = $t['divs'][$y]; $l = $t['divs'][$y];
/* Lookup the judge cat pref for this category */ /* Lookup the judge cat pref for this category */
$pref = -$j['divprefs'][$l] + 2; $pref = -$j['div_prefs'][$l] + 5;
/* $pref = 0 (best match) --- 4 (worst match) */ /* $pref = 0 (best match) --- 4 (worst match) */
$dpref += $pref; $dpref += $pref;
} }
@ -158,6 +162,8 @@ function judges_cost_function($annealer, $bucket_id, $ids)
//division matching is more important than category matching //division matching is more important than category matching
$cost += 3 * $dpref; $cost += 3 * $dpref;
// TRACE(" div/cat cost=$cost\n");
/* See if the judge is willing to chair a team */ /* See if the judge is willing to chair a team */
if($j['willing_chair'] == 'yes') $have_chair = true; if($j['willing_chair'] == 'yes') $have_chair = true;
@ -196,9 +202,12 @@ function judges_cost_function($annealer, $bucket_id, $ids)
/* Small penalty for a jteam with very little experience, /* Small penalty for a jteam with very little experience,
* but only if there's more than 1 person on the team */ * but only if there's more than 1 person on the team */
$exp_cost = 0;
if($years_experience_weighted<5 && count($ids)>1) { if($years_experience_weighted<5 && count($ids)>1) {
$cost += (5-$years_experience_weighted)*2; $exp_cost += (5-$years_experience_weighted)*2;
} }
$cost += $exp_cost;
// TRACE("Experience cost: $exp_cost\n");
// TRACE("Team $bucket_id, cost is $cost\n"); // TRACE("Team $bucket_id, cost is $cost\n");