Search in sources :

Example 1 with Simplex

use of com.sri.ai.praise.core.representation.interfacebased.polytope.core.byexpressiveness.convexhull.Simplex in project aic-praise by aic-sri-international.

the class GradientAnytimeExactBP method getIndices.

private static Set<? extends Variable> getIndices(AtomicPolytope subAtomicPolytope) {
    Set<Variable> result = new HashSet<>();
    if (subAtomicPolytope instanceof Simplex) {
        Simplex subSimplex = (Simplex) subAtomicPolytope;
        result.add(subSimplex.getVariable());
    } else if (subAtomicPolytope instanceof IntensionalConvexHullOfFactors) {
        IntensionalConvexHullOfFactors subConvexHull = (IntensionalConvexHullOfFactors) subAtomicPolytope;
        result.addAll(subConvexHull.getIndices());
    } else {
        throw new Error("New unsupported type of atomic polytope added");
    }
    return result;
}
Also used : Simplex(com.sri.ai.praise.core.representation.interfacebased.polytope.core.byexpressiveness.convexhull.Simplex) Variable(com.sri.ai.praise.core.representation.interfacebased.factor.api.Variable) IntensionalConvexHullOfFactors(com.sri.ai.praise.core.representation.interfacebased.polytope.core.byexpressiveness.convexhull.IntensionalConvexHullOfFactors) HashSet(java.util.HashSet)

Example 2 with Simplex

use of com.sri.ai.praise.core.representation.interfacebased.polytope.core.byexpressiveness.convexhull.Simplex in project aic-praise by aic-sri-international.

the class AbstractAEBPTreeNode method addSimplexOrFactortoTheListOfProducts.

public void addSimplexOrFactortoTheListOfProducts(List<Polytope> polytopesToMultiply) {
    if (isRootAFactor()) {
        IntensionalConvexHullOfFactors singletonConvexHullOfFactorAtRoot = new IntensionalConvexHullOfFactors(list(), (Factor) this.getRoot());
        polytopesToMultiply.add(singletonConvexHullOfFactorAtRoot);
    } else if (!isExhausted.apply((Variable) this.getRoot())) {
        polytopesToMultiply.add(new Simplex((Variable) this.getRoot()));
    }
}
Also used : Simplex(com.sri.ai.praise.core.representation.interfacebased.polytope.core.byexpressiveness.convexhull.Simplex) IntensionalConvexHullOfFactors(com.sri.ai.praise.core.representation.interfacebased.polytope.core.byexpressiveness.convexhull.IntensionalConvexHullOfFactors)

Aggregations

IntensionalConvexHullOfFactors (com.sri.ai.praise.core.representation.interfacebased.polytope.core.byexpressiveness.convexhull.IntensionalConvexHullOfFactors)2 Simplex (com.sri.ai.praise.core.representation.interfacebased.polytope.core.byexpressiveness.convexhull.Simplex)2 Variable (com.sri.ai.praise.core.representation.interfacebased.factor.api.Variable)1 HashSet (java.util.HashSet)1