示例#1
0
 /**
  * Start up the bandit.
  *
  * @since 0.4.0
  *
  * @access protected
  */
 protected function go()
 {
     $this->set_random();
     $strategy = \MaBandit\Strategy\EpsilonGreedy::withExplorationEvery(3);
     $persistor = $this->create_persistor();
     $this->bandit = \MaBandit\MaBandit::withStrategy($strategy)->withPersistor($persistor);
     try {
         $this->experiment = $this->bandit->getExperiment((string) $this->ID);
     } catch (\MaBandit\Exception\ExperimentNotFoundException $e) {
         $this->create_experiment();
     }
 }
示例#2
0
 /**
  * @expectedException \PHPUnit_Framework_Error
  */
 public function testWithPersistorRaisesOnInvalidStrategy()
 {
     $s = \MaBandit\Strategy\EpsilonGreedy::withExplorationEvery(10);
     $p = new \stdClass();
     $bandit = \MaBandit\MaBandit::withStrategy($s)->withPersistor($p);
 }