Exemple #1
0
 public function watch2OnHighest(Decisions $decisions)
 {
     $literals = $this->rule->getLiterals();
     if ($literals < 3) {
         return;
     }
     $watchLevel = 0;
     foreach ($literals as $literal) {
         $level = $decisions->decisionLevel($literal);
         if ($level > $watchLevel) {
             $this->watch2 = $literal;
             $watchLevel = $level;
         }
     }
 }
 /**
  * Places the second watch on the rule's literal, decided at the highest level
  *
  * Useful for learned rules where the literal for the highest rule is most
  * likely to quickly lead to further decisions.
  *
  * @param Decisions $decisions The decisions made so far by the solver
  */
 public function watch2OnHighest(Decisions $decisions)
 {
     $literals = $this->rule->getLiterals();
     // if there are only 2 elements, both are being watched anyway
     if ($literals < 3) {
         return;
     }
     $watchLevel = 0;
     foreach ($literals as $literal) {
         $level = $decisions->decisionLevel($literal);
         if ($level > $watchLevel) {
             $this->watch2 = $literal;
             $watchLevel = $level;
         }
     }
 }