use of com.sri.ai.grinder.application.CommonTheory in project aic-praise by aic-sri-international.
the class ExpressionFactorTest method testMultiply4.
@Test
public void testMultiply4() {
Theory theory = new CommonTheory();
Context context = new TrueContext(theory);
Expression a = DefaultSymbol.createSymbol("a");
ExpressionFactor aFactor = new DefaultExpressionFactor(a, context);
ConstantFactor tenFactor = new ConstantFactor(10.);
Factor result = aFactor.multiply(tenFactor);
assertEquals("10 * a", result.toString());
}
use of com.sri.ai.grinder.application.CommonTheory in project aic-praise by aic-sri-international.
the class ExpressionFactorTest method testAdd1.
@Test
public void testAdd1() {
Theory theory = new CommonTheory();
Context context = new TrueContext(theory);
Expression a = DefaultSymbol.createSymbol("a");
ExpressionFactor aFactor = new DefaultExpressionFactor(a, context);
Expression b = DefaultSymbol.createSymbol("b");
ExpressionFactor bFactor = new DefaultExpressionFactor(b, context);
Factor abFactor = (ExpressionFactor) aFactor.add(bFactor);
assertEquals("a + b", abFactor.toString());
}
use of com.sri.ai.grinder.application.CommonTheory in project aic-praise by aic-sri-international.
the class ExpressionFactorTest method testMultiply1.
@Test
public void testMultiply1() {
Theory theory = new CommonTheory();
Context context = new TrueContext(theory);
Expression a = DefaultSymbol.createSymbol("a");
ExpressionFactor aFactor = new DefaultExpressionFactor(a, context);
Expression b = DefaultSymbol.createSymbol("b");
ExpressionFactor bFactor = new DefaultExpressionFactor(b, context);
Factor abFactor = (ExpressionFactor) aFactor.multiply(bFactor);
assertEquals("a * b", abFactor.toString());
}
use of com.sri.ai.grinder.application.CommonTheory in project aic-praise by aic-sri-international.
the class ExpressionFactorTest method testMultiply2.
@Test
public void testMultiply2() {
Theory theory = new CommonTheory();
Context context = new TrueContext(theory);
Expression a = DefaultSymbol.createSymbol("a");
ExpressionFactor aFactor = new DefaultExpressionFactor(a, context);
Factor result = (ExpressionFactor) aFactor.multiply(IDENTITY_FACTOR);
assertEquals(aFactor, result);
}
use of com.sri.ai.grinder.application.CommonTheory in project aic-expresso by aic-sri-international.
the class AutomaticDifferentiationTest method makeAutoDifferentiator.
@Before
public void makeAutoDifferentiator() {
Theory theory = new CommonTheory();
Context context = new TrueContext(theory);
autoDifferentiator = new AutomaticDifferentiation(e -> context.evaluate(e));
}
Aggregations