lschlessinger1 / elementalSessionSort

A quick way to sort kids into groups.
0 stars 0 forks source link

get_best_groups() method #3

Closed lschlessinger1 closed 11 years ago

lschlessinger1 commented 11 years ago

Need to redesign algorithm slightly. Right now kids are getting pushed into groups in pairs:

    foreach($this->match_points_arr as &$kid_pair) {
        $kid_a = key($kid_pair);
    $kid_b = $kid_pair[$kid_a];
    if(!$this->in_array_r($kid_a, $return_me) && !$this->in_array_r($kid_b, $return_me) && !$this->in_array_r($return_me,$kid_pair)){
        //push kid pair
        array_push($return_me[$num_kid_pairs % $this->num_groups], $kid_a);
        array_push($return_me[$num_kid_pairs % $this->num_groups], $kid_b);
        $num_kid_pairs++;
        }
    }

It takes the match_points_arr, which has all of the pairs of kids with this structure, sorted from highest match points to lowest:

    (
        [kid_id_a] => kid_id_b,
        [match_points] => num_match_points
    )

It iterates down that array and pushes the kid pair into the group. The groups are sorted by kid pairings that have the highest match points. The method isn't aware of the other pairs.

How can I change this method so I return groups to have the groups be created that factor in more than just a kid pair's match points?