use of com.sri.ai.expresso.core.DefaultExtensionalUniSet in project aic-expresso by aic-sri-international.
the class DefaultExtensionalBound method summingBound.
public DefaultExtensionalBound summingBound(ArrayList<Expression> variablesToBeSummedOut, Context context, Theory theory) {
Expression varsSet = new DefaultExtensionalUniSet(variablesToBeSummedOut);
DefaultExtensionalBound result = summingBound(varsSet, context, theory);
return result;
}
use of com.sri.ai.expresso.core.DefaultExtensionalUniSet in project aic-expresso by aic-sri-international.
the class Expressions method makeDefaultExtensionalUniSetFromLabelAndSubTrees.
private static Expression makeDefaultExtensionalUniSetFromLabelAndSubTrees(Object label, Object[] subTreeObjects) {
if (subTreeObjects.length == 1 && subTreeObjects[0] instanceof Collection) {
subTreeObjects = ((Collection) subTreeObjects[0]).toArray();
}
ArrayList<Expression> subTreeExpressions = Util.mapIntoArrayList(subTreeObjects, Expressions::makeFromObject);
if (subTreeExpressions.size() == 1) {
subTreeExpressions = new ArrayList<Expression>(Expressions.ensureListFromKleeneList(subTreeExpressions.get(0)));
}
Expression result = new DefaultExtensionalUniSet(subTreeExpressions);
return result;
}
use of com.sri.ai.expresso.core.DefaultExtensionalUniSet in project aic-expresso by aic-sri-international.
the class FactorComponent method calculateBound.
public void calculateBound() {
Theory theory = this.model.theory;
Context context = this.model.context;
// Expression childrenBound = parse("{1}");
// for (VariableComponent children : this.children) {
// childrenBound = Bounds.boundProduct(this.model.theory, this.model.context, childrenBound, children.bound);
// }
Bound[] cildrenArray = new Bound[children.size()];
int i = 0;
for (VariableComponent children : this.children) {
cildrenArray[i] = children.bound;
i++;
}
Bound childrenBound = Bounds.boundProduct(this.model.theory, this.model.context, isExtensionalBound, cildrenArray);
Set<Expression> toSum = model.getNeighbors(phi);
for (Expression e : this.parent) {
toSum.remove(e);
}
for (Expression e : this.cutsetOutsideSubModel) {
toSum.remove(e);
}
toSum.addAll(this.cutsetInsideSubModel);
ArrayList<Expression> variablesToBeSummedOut = new ArrayList<>(toSum.size());
variablesToBeSummedOut.addAll(toSum);
// We want sum other toSum of Phi*childrenBound
DefaultExtensionalUniSet varToSum = new DefaultExtensionalUniSet(variablesToBeSummedOut);
bound = childrenBound.summingPhiTimesBound(varToSum, phi, context, theory);
}
Aggregations