private function disparaLiteral(literal $literal, bh $bh)
 {
     foreach ($bh->getHechos() as $i => $hecho) {
         if (strcmp($hecho->getVariable(), $literal->getVariable()) == 0) {
             return $this->dispara($literal, $hecho);
         }
     }
     return false;
 }
Example #2
0
//        $reglas[]=$regla2;
//
//        //iniciamos el backwardchain
//        $bwc=new backwardchain();
//        $bwc->bawc($bh, $meta, $reglas);
//        var_dump($bh);
$bwx = new backwardchain();
$h1 = new hecho();
$h1->setVariable('z');
$h1->setValor(0);
$h1->setEsNumerico(TRUE);
$h2 = new hecho();
$h2->setVariable('y');
$h2->setValor('A');
$h2->setEsNumerico(FALSE);
$bh = new bh();
$bh->addHecho($h1);
$bh->addHecho($h2);
////bh////////////////////
///////////////////////////
$h3 = new hecho();
$h3->setVariable('y');
$h3->setValor('A');
$h3->setEsNumerico(FALSE);
$l1 = new literal();
$l1->setHecho($h3);
$l1->setOprel(literal::$IGUAL);
$h4 = new hecho();
$h4->setVariable('x');
$h4->setValor('b');
$h4->setEsNumerico(FALSE);