use of com.sri.ai.expresso.type.Categorical in project aic-expresso by aic-sri-international.
the class ExpressionStepSolverToLiteralSplitterStepSolverAdapterTest method testCompoundTheoryWithDifferenceArithmeticWithRandomDisjunctiveFormulas.
@Test
public void testCompoundTheoryWithDifferenceArithmeticWithRandomDisjunctiveFormulas() {
TheoryTestingSupport theoryTestingSupport = TheoryTestingSupport.make(makeRandom(), new CompoundTheory(new EqualityTheory(false, true), new DifferenceArithmeticTheory(false, true), new PropositionalTheory()));
// using different testing variables and types to test distribution of testing information
// to sub constraint theories.
Categorical booleanType = BOOLEAN_TYPE;
Categorical dogsType = new Categorical("Dogs", 4, arrayList(parse("fido"), parse("rex")));
IntegerInterval oneTwoThree = new IntegerInterval(1, 3);
Map<String, Type> variablesAndTypes = map("F", booleanType, "G", booleanType, "R", dogsType, "S", dogsType, "T", oneTwoThree, "U", oneTwoThree);
theoryTestingSupport.setVariableNamesAndTypesForTesting(variablesAndTypes);
runRandomDisjunctiveFormulasTest(theoryTestingSupport);
}
use of com.sri.ai.expresso.type.Categorical in project aic-expresso by aic-sri-international.
the class AssignmentsIteratorTest method test1.
@Test
public void test1() {
Registry registry = new DefaultRegistry();
Type myType = new Categorical("People", 4, arrayList(makeSymbol("oscar"), makeSymbol("mary")));
Symbol x = makeSymbol("X");
Symbol y = makeSymbol("Y");
String expected = "{X=oscar, Y=oscar}\n" + "{X=mary, Y=oscar}\n" + "{X=people3, Y=oscar}\n" + "{X=people4, Y=oscar}\n" + "{X=oscar, Y=mary}\n" + "{X=mary, Y=mary}\n" + "{X=people3, Y=mary}\n" + "{X=people4, Y=mary}\n" + "{X=oscar, Y=people3}\n" + "{X=mary, Y=people3}\n" + "{X=people3, Y=people3}\n" + "{X=people4, Y=people3}\n" + "{X=oscar, Y=people4}\n" + "{X=mary, Y=people4}\n" + "{X=people3, Y=people4}\n" + "{X=people4, Y=people4}";
Symbol myTypeExpression = makeSymbol(myType.getName());
registry = registry.makeNewContextWithAddedType(myType);
registry = registry.makeCloneWithAdditionalRegisteredSymbolsAndTypes(map(x, myTypeExpression, y, myTypeExpression));
AssignmentMapsIterator assignmentsIterator = new AssignmentMapsIterator(list(x, y), registry);
String actual = join("\n", assignmentsIterator);
// System.out.println(actual);
assertEquals(expected, actual);
}
use of com.sri.ai.expresso.type.Categorical in project aic-expresso by aic-sri-international.
the class SampleCommonInterpreterTest method testCategoricalExample2.
@Test
public void testCategoricalExample2() {
updateContextWithIndexAndType("N", new Categorical("Person", 1000000));
String intensionalSet = "{{(on I in Person) if I != person1 then 20 else 30 : I != person2 }}";
String[][] functionNamesAndExactValues = new String[][] { // 42sec brute, 1186ms sample
{ "sum", "19999990" }, // 26sec brute, 762ms sample
{ "max", "30" }, // 25sec brute, 703ms sample
{ "product", "7.425492171971923688023442712229336E+1301028" } };
runSampleCompareToExact(1, true, intensionalSet, functionNamesAndExactValues);
}
use of com.sri.ai.expresso.type.Categorical in project aic-expresso by aic-sri-international.
the class MeasureTest method testThrowsUnsupportedGreaterThan1Index.
@Test(expected = UnsupportedOperationException.class)
public void testThrowsUnsupportedGreaterThan1Index() {
updateContextWithIndexAndType("N", new Categorical("People", 5, parse("p1"), parse("p2"), parse("p3"), parse("p4"), parse("p5")));
measure("{{(on I in People, J in People) (I, J) : true}}");
}
Aggregations