Search in sources :

Example 1 with IsVariable

use of com.sri.ai.grinder.library.IsVariable in project aic-expresso by aic-sri-international.

the class SummationOnLinearRealArithmeticAndPolynomialStepSolver method computeSummationGivenValues.

private Expression computeSummationGivenValues(Expression literalFreeBody, Expression values, Context context) {
    Expression result;
    if (values.equals(Sets.EMPTY_SET) || Sets.isExtensionalSet(values)) {
        result = ZERO;
    } else {
        Expression lowerBound = values.get(0);
        Expression upperBound = values.get(1);
        Polynomial bodyPolynomial = DefaultPolynomial.make(literalFreeBody);
        Predicate<Expression> isVariable = new IsVariable(context.getIsUniquelyNamedConstantPredicate());
        result = PolynomialIntegration.definiteIntegral(bodyPolynomial, getIndex(), lowerBound, upperBound, isVariable);
    }
    return result;
}
Also used : Polynomial(com.sri.ai.grinder.polynomial.api.Polynomial) DefaultPolynomial(com.sri.ai.grinder.polynomial.core.DefaultPolynomial) Expression(com.sri.ai.expresso.api.Expression) IsVariable(com.sri.ai.grinder.library.IsVariable)

Aggregations

Expression (com.sri.ai.expresso.api.Expression)1 IsVariable (com.sri.ai.grinder.library.IsVariable)1 Polynomial (com.sri.ai.grinder.polynomial.api.Polynomial)1 DefaultPolynomial (com.sri.ai.grinder.polynomial.core.DefaultPolynomial)1