Ejemplo n.º 1
0
<?php

require '../util.php';
require '../solver.php';
$domain = new KnowledgeDomain();
$domain->values['light']->push('red');
$domain->values['light']->push('yellow');
$domain->values['light']->push('green');
$clause = new WhenAnyCondition();
$clause->addCondition(new FactCondition('light', 'red'));
$clause->addCondition(new FactCondition('light', 'green'));
$expect = new FactCondition('light', 'yellow');
var_dump($clause->negate($domain));
assert('simplify($clause->negate($domain)) == $expect');
Ejemplo n.º 2
0
<?php

require '../util.php';
require '../solver.php';
$domain = new KnowledgeDomain();
$domain->values['key']->push('value');
$domain->values['key']->push('nonvalue');
$subclause = new WhenAnyCondition();
$subclause->addCondition(new FactCondition('key', 'value'));
$clause = new WhenAllCondition();
$clause->addCondition($subclause);
$expect = new FactCondition('key', 'value');
assert('simplify($clause->negate($domain)->negate($domain)) == $expect');
Ejemplo n.º 3
0
<?php

require '../util.php';
require '../solver.php';
$domain = new KnowledgeDomain();
$domain->values['stoplicht']->push('rood');
$domain->values['stoplicht']->push('geel');
$domain->values['stoplicht']->push('groen');
$condition = new WhenAllCondition();
$condition->addCondition(new FactCondition('stoplicht', 'rood'));
$expected = new WhenAnyCondition();
$expected->addCondition(new FactCondition('stoplicht', 'geel'));
$expected->addCondition(new FactCondition('stoplicht', 'groen'));
assert('simplify($condition->negate($domain)) == $expected');