Search in sources :

Example 1 with Problem

use of com.sri.ai.praise.core.representation.interfacebased.factor.api.Problem in project aic-praise by aic-sri-international.

the class ExpressionBasedProblemToInterfaceBasedProblemConversion method translate.

public static Problem translate(ExpressionBasedProblem expressionBasedProblem) {
    ExpressionVariable queryVariable = new DefaultExpressionVariable(expressionBasedProblem.getQuerySymbol());
    ExpressionFactorNetwork factorNetwork = makeFactorNetwork(expressionBasedProblem);
    Predicate<Expression> isExpressionParameterPredicate = expressionBasedProblem.getIsParameterPredicate();
    Predicate<Variable> isParameterPredicate = makeIsParameterPredicate(isExpressionParameterPredicate);
    Problem problem = new DefaultVariableMarginalQuery(queryVariable, factorNetwork, isParameterPredicate);
    return problem;
}
Also used : ExpressionFactorNetwork(com.sri.ai.praise.core.representation.interfacebased.factor.core.expression.core.ExpressionFactorNetwork) DefaultExpressionVariable(com.sri.ai.praise.core.representation.interfacebased.factor.core.expression.core.DefaultExpressionVariable) ExpressionVariable(com.sri.ai.praise.core.representation.interfacebased.factor.core.expression.api.ExpressionVariable) Variable(com.sri.ai.praise.core.representation.interfacebased.factor.api.Variable) DefaultExpressionVariable(com.sri.ai.praise.core.representation.interfacebased.factor.core.expression.core.DefaultExpressionVariable) Expression(com.sri.ai.expresso.api.Expression) DefaultVariableMarginalQuery(com.sri.ai.praise.core.representation.interfacebased.factor.core.DefaultVariableMarginalQuery) DefaultExpressionVariable(com.sri.ai.praise.core.representation.interfacebased.factor.core.expression.core.DefaultExpressionVariable) ExpressionVariable(com.sri.ai.praise.core.representation.interfacebased.factor.core.expression.api.ExpressionVariable) ExpressionBasedProblem(com.sri.ai.praise.core.representation.classbased.expressionbased.api.ExpressionBasedProblem) Problem(com.sri.ai.praise.core.representation.interfacebased.factor.api.Problem)

Example 2 with Problem

use of com.sri.ai.praise.core.representation.interfacebased.factor.api.Problem in project aic-praise by aic-sri-international.

the class SolverToExpressionBasedSolverAdapter method solveForQuerySymbolDefinedByExpressionBasedProblem.

@Override
protected Expression solveForQuerySymbolDefinedByExpressionBasedProblem(ExpressionBasedProblem expressionBasedProblem) {
    Problem problem = ExpressionBasedProblemToInterfaceBasedProblemConversion.translate(expressionBasedProblem);
    Expression result = getSolver().solve(problem);
    return result;
}
Also used : Expression(com.sri.ai.expresso.api.Expression) ExpressionBasedProblem(com.sri.ai.praise.core.representation.classbased.expressionbased.api.ExpressionBasedProblem) Problem(com.sri.ai.praise.core.representation.interfacebased.factor.api.Problem)

Aggregations

Expression (com.sri.ai.expresso.api.Expression)2 ExpressionBasedProblem (com.sri.ai.praise.core.representation.classbased.expressionbased.api.ExpressionBasedProblem)2 Problem (com.sri.ai.praise.core.representation.interfacebased.factor.api.Problem)2 Variable (com.sri.ai.praise.core.representation.interfacebased.factor.api.Variable)1 DefaultVariableMarginalQuery (com.sri.ai.praise.core.representation.interfacebased.factor.core.DefaultVariableMarginalQuery)1 ExpressionVariable (com.sri.ai.praise.core.representation.interfacebased.factor.core.expression.api.ExpressionVariable)1 DefaultExpressionVariable (com.sri.ai.praise.core.representation.interfacebased.factor.core.expression.core.DefaultExpressionVariable)1 ExpressionFactorNetwork (com.sri.ai.praise.core.representation.interfacebased.factor.core.expression.core.ExpressionFactorNetwork)1