Exemplo n.º 1
0
 public function allocate(\Kumite\Test $test, array $options)
 {
     $event = $options['event'];
     $ucbValues = array();
     foreach ($test->variantKeys() as $v) {
         $armCount = $this->getArmCount($v, $test);
         // try all variants at least once
         if ($armCount == 0) {
             return $v;
         }
         $r = $this->getConversionRate($v, $test, $event);
         $b = $this->getBonus($v, $test);
         $ucbValues[$v] = $r + $b;
     }
     // return variant with the highest chance for success
     return array_search(max($ucbValues), $ucbValues);
 }
Exemplo n.º 2
0
 public function allocate(Test $test, array $options)
 {
     $keys = $test->variantKeys();
     $index = array_rand($keys);
     return $keys[$index];
 }