From 2292af320635d3e81f8ef3f4e43c24eaeb295dcc Mon Sep 17 00:00:00 2001 From: james Date: Wed, 22 Sep 2010 18:28:51 +0000 Subject: [PATCH] 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) --- admin/judges_sa.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/admin/judges_sa.php b/admin/judges_sa.php index 2fab663..6f13258 100644 --- a/admin/judges_sa.php +++ b/admin/judges_sa.php @@ -109,7 +109,7 @@ function judges_cost_function($annealer, $bucket_id, $ids) if($bucket_id == 0) { /* This is the placeholder for all judges, there's a slight * cost for not using a judge */ - $cost = count($ids) * 5; + $cost = count($ids) * 8; // TRACE("Extra judge team cost=$cost\n"); return $cost; } @@ -139,15 +139,19 @@ function judges_cost_function($annealer, $bucket_id, $ids) for($y=0; $y < count($t['cats']); $y++) { $l = $t['cats'][$y]; /* 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) */ + //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; } $dpref = 0; for($y=0; $y < count($t['divs']); $y++) { $l = $t['divs'][$y]; /* 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) */ $dpref += $pref; } @@ -158,6 +162,8 @@ function judges_cost_function($annealer, $bucket_id, $ids) //division matching is more important than category matching $cost += 3 * $dpref; +// TRACE(" div/cat cost=$cost\n"); + /* See if the judge is willing to chair a team */ 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, * but only if there's more than 1 person on the team */ + $exp_cost = 0; 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");