forked from science-ation/science-ation
- Finish the cost function explanation
This commit is contained in:
parent
c5887eb432
commit
5ad72acabf
@ -69,8 +69,15 @@ set_percent(0);
|
|||||||
- Foreach student in a tour
|
- Foreach student in a tour
|
||||||
+15 - Above the grade level
|
+15 - Above the grade level
|
||||||
+25 - Below the grade level
|
+25 - Below the grade level
|
||||||
|
+5 - Noone from the same school
|
||||||
|
If ranked (rank=1,2,3,4,...):
|
||||||
|
+(rank*rank*5 - 5) = +0, +15, +40, +75
|
||||||
|
If not ranked:
|
||||||
|
+(max_choices*max_choices*5) (always greater than ranked)
|
||||||
|
- Foreach tour
|
||||||
|
+100 for each student above the capacity
|
||||||
|
+200 for each student below 1/4 the capacity,but
|
||||||
|
zero if the tour is empty
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Compute the cost of adding a judge to a team */
|
/* Compute the cost of adding a judge to a team */
|
||||||
@ -95,7 +102,11 @@ function tour_cost_function($annealer, $bucket_id, $ids)
|
|||||||
/* Compute the over max / under min costs */
|
/* Compute the over max / under min costs */
|
||||||
$c = count($ids);
|
$c = count($ids);
|
||||||
$over = ($c > $t['capacity']) ? $c - $t['capacity'] : 0;
|
$over = ($c > $t['capacity']) ? $c - $t['capacity'] : 0;
|
||||||
$under = ($c < ($t['capacity']/4)) ? ($t['capacity']/4) - $c : 0;
|
if($c > 0)
|
||||||
|
$under = ($c < ($t['capacity']/4)) ? ($t['capacity']/4) - $c : 0;
|
||||||
|
else
|
||||||
|
$under = 0;
|
||||||
|
|
||||||
$cost += $over * 100;
|
$cost += $over * 100;
|
||||||
$cost += $under * 200;
|
$cost += $under * 200;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user