forked from science-ation/science-ation
Remove redundant config code. Use the judge scheduler options directly.
This commit is contained in:
parent
7451483ddf
commit
c247119663
@ -178,15 +178,4 @@ function getJudgingTeam($teamid)
|
||||
|
||||
}
|
||||
|
||||
function judges_scheduler_load_config()
|
||||
{
|
||||
global $config;
|
||||
$configq=mysql_query("SELECT * FROM config WHERE year='".$config['FAIRYEAR']."' AND category = 'Judge Scheduler'");
|
||||
$data=array();
|
||||
while($configr=mysql_fetch_object($configq)) {
|
||||
$data[$configr->var]=$configr->val;
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -267,19 +267,16 @@ for($k=0; $k<count($keys); $k++) {
|
||||
}
|
||||
}
|
||||
|
||||
TRACE("Loading Scheduler Configuration Data...\n");
|
||||
$data = judges_scheduler_load_config();
|
||||
|
||||
TRACE("Computing required judging teams...\n");
|
||||
TRACE(" Each judging team may judge {$data['max_projects_per_team']} projects\n");
|
||||
TRACE(" Each project must be judged {$data['times_judged']} times\n");
|
||||
TRACE(" Each judging team may judge {$config['max_projects_per_team']} projects\n");
|
||||
TRACE(" Each project must be judged {$config['times_judged']} times\n");
|
||||
|
||||
$keys = array_keys($jdiv);
|
||||
for($k=0; $k<count($keys); $k++) {
|
||||
$jdiv_id = $keys[$k];
|
||||
$c = count($jdiv[$jdiv_id]['projects']);
|
||||
$t=ceil($c/$data['max_projects_per_team']*$data['times_judged']);
|
||||
if($t < $data['times_judged']) $t = $data['times_judged'];
|
||||
$t=ceil($c/$config['max_projects_per_team']*$config['times_judged']);
|
||||
if($t < $config['times_judged']) $t = $config['times_judged'];
|
||||
TRACE(" $jdiv_id has $c projects, requires $t judging teams\n");
|
||||
$jdiv[$jdiv_id]['num_jteams'] = $t;
|
||||
}
|
||||
@ -302,12 +299,12 @@ for($k=0; $k<count($keys); $k++) {
|
||||
$jdiv_id = $keys[$k];
|
||||
TRACE("Judging Division $jdiv_id ({$jdiv[$jdiv_id]['num_jteams']} teams): \n");
|
||||
$project_ids = array();
|
||||
for($x=0; $x<$data['times_judged']; $x++) {
|
||||
for($x=0; $x<$config['times_judged']; $x++) {
|
||||
$project_ids = array_merge($project_ids, array_keys($jdiv[$jdiv_id]['projects']) );
|
||||
}
|
||||
$current_jdiv = $jdiv[$jdiv_id];
|
||||
|
||||
$e = 100 + 10 * ($data['effort'] / 1000);
|
||||
$e = 100 + 10 * ($config['effort'] / 1000);
|
||||
$a = new annealer($jdiv[$jdiv_id]['num_jteams'], 125, $e, 0.9,
|
||||
jdiv_compute_cost, $project_ids);
|
||||
$a->anneal();
|
||||
@ -325,8 +322,8 @@ for($k=0; $k<count($keys); $k++) {
|
||||
$jteam[$jteam_id]['divs'] = array();
|
||||
$jteam[$jteam_id]['cats'] = array();
|
||||
$jteam[$jteam_id]['langs'] = array();
|
||||
$jteam[$jteam_id]['min_judges'] = $data['min_judges_per_team'];
|
||||
$jteam[$jteam_id]['max_judges'] = $data['max_judges_per_team'];
|
||||
$jteam[$jteam_id]['min_judges'] = $config['min_judges_per_team'];
|
||||
$jteam[$jteam_id]['max_judges'] = $config['max_judges_per_team'];
|
||||
|
||||
for($y=0;$y<count($bkt); $y++) {
|
||||
$projid = $bkt[$y];
|
||||
@ -449,7 +446,7 @@ TRACE("Loaded ".count($judges)." judges.\n");
|
||||
$jteam[0]['max_judges'] = count($judges);
|
||||
|
||||
$judge_ids = array_keys($judges);
|
||||
$e = $data['effort'];
|
||||
$e = $config['effort'];
|
||||
$a = new annealer(count($jteam), 25, $e, 0.98, judges_cost_function, $judge_ids);
|
||||
$a->anneal();
|
||||
|
||||
@ -695,7 +692,7 @@ for($k=0; $k<count($keys); $k++) {
|
||||
print("Jteams ids len=".count($jteams_ids));
|
||||
print("\n");
|
||||
|
||||
$e = 500 + 50 * ($data['effort'] / 1000);
|
||||
$e = 500 + 50 * ($config['effort'] / 1000);
|
||||
$a = new annealer($n_timeslots, 100, $e, 0.98, timeslot_cost_function, $jteams_ids);
|
||||
$a->set_pick_move(timeslot_pick_move);
|
||||
$a->anneal();
|
||||
|
@ -69,10 +69,8 @@ function judges_scheduler_check_jdivs()
|
||||
|
||||
function judges_scheduler_check_judges()
|
||||
{
|
||||
global $config;
|
||||
$ok = 1;
|
||||
|
||||
$data = judges_scheduler_load_config();
|
||||
global $config;
|
||||
$ok = 1;
|
||||
|
||||
$jdiv = array();
|
||||
$q=mysql_query("SELECT * FROM judges_jdiv");
|
||||
@ -101,8 +99,8 @@ function judges_scheduler_check_judges()
|
||||
for($k=0; $k<count($keys); $k++) {
|
||||
$jdiv_id = $keys[$k];
|
||||
$c = $jdiv[$jdiv_id]['num_projects'];
|
||||
$t=ceil($c/$data['max_projects_per_team']*$data['times_judged']);
|
||||
if($t < $data['times_judged']) $t = $data['times_judged'];
|
||||
$t=ceil($c/$config['max_projects_per_team']*$config['times_judged']);
|
||||
if($t < $config['times_judged']) $t = $config['times_judged'];
|
||||
$jdiv[$jdiv_id]['num_jteams'] = $t;
|
||||
$totalteams+=$t;
|
||||
|
||||
@ -113,8 +111,8 @@ function judges_scheduler_check_judges()
|
||||
echo "<b>";
|
||||
echo "Total judging teams required: $totalteams";
|
||||
echo "<br />";
|
||||
$minjudges=($totalteams*$data['min_judges_per_team']);
|
||||
$maxjudges=($totalteams*$data['max_judges_per_team']);
|
||||
$minjudges=($totalteams*$config['min_judges_per_team']);
|
||||
$maxjudges=($totalteams*$config['max_judges_per_team']);
|
||||
echo "Minimum number of judges required: $minjudges";
|
||||
echo "<br />";
|
||||
echo "Maximum number of judges acceptable: $maxjudges";
|
||||
|
Loading…
x
Reference in New Issue
Block a user