use of com.sri.ai.praise.core.representation.classbased.hogm.HOGModel in project aic-praise by aic-sri-international.
the class ExpressionBasedModelExamples method buildModel2.
public static ExpressionBasedModel buildModel2() {
String modelString = "random terrorAttacks : 0..20;\n" + "random newJobs : 0..100000;\n" + "random dow: 11000..18000;\n" + "random economyIsPoor : Boolean;\n" + "random economyIsGreat : Boolean;\n" + "random attackPerception: Boolean;\n" + "random likeIncumbent : 0..100000000;\n" + "random likeChallenger : 0..100000000;\n" + "constant Alpha: Real;\n" + "economyIsPoor <=> dow < 13000 and newJobs < 30000;\n" + "economyIsGreat <=> dow > 16000 and newJobs > 70000;\n" + "attackPerception <=> terrorAttacks > 4;\n" + "if economyIsGreat\n" + "then if likeIncumbent > 70000000 then Alpha/30000000 else 1-Alpha/(70000000 + 1)\n" + "else if economyIsPoor\n" + "then if likeIncumbent < 40000000 then 0.8/40000000 else 0.2/(60000000 + 1)\n" + "else if attackPerception\n" + "then if likeIncumbent < 60000000 then 0.9/60000000 else 0.1/(40000000 + 1);\n";
List<HOGMProblemError> modelErrors = new ArrayList<>();
HOGModel hogmModel = parseModelStringToHOGMModel(modelString, modelErrors);
ExpressionBasedModel expressionBasedModel = parseHOGModelToExpressionBasedModel(hogmModel);
return expressionBasedModel;
}
use of com.sri.ai.praise.core.representation.classbased.hogm.HOGModel in project aic-praise by aic-sri-international.
the class UsefulOperationsParameterEstimation method parseModelStringToHOGMModel.
/**
* To convert a model String into a HOGModel.
*/
public static HOGModel parseModelStringToHOGMModel(String modelString, List<HOGMProblemError> modelErrors) {
HOGMModelParsing parsingWithErrorCollecting = new HOGMModelParsing(modelString, modelErrors);
HOGModel result = parsingWithErrorCollecting.getModel();
return result;
}
use of com.sri.ai.praise.core.representation.classbased.hogm.HOGModel in project aic-praise by aic-sri-international.
the class ParameterEstimationForHOGModel method buildOptimizedHOGModel.
/**
* Return the optimized HOGModel.
*/
public HOGModel buildOptimizedHOGModel(Map<Expression, Double> optimizedParameters) {
String optimizedStringModel = buildOptimizedStringModel(optimizedParameters);
HOGModel result = parseModelStringToHOGMModel(optimizedStringModel, this.modelErrors);
return result;
}
use of com.sri.ai.praise.core.representation.classbased.hogm.HOGModel in project aic-praise by aic-sri-international.
the class HOGMParserWrapper method parseModel.
public HOGModel parseModel(String string, Parser.ErrorListener errorListener) {
Expression modelTupleExpression = parse(string, errorListener);
HOGModel result = new HOGModel(string, modelTupleExpression);
return result;
}
Aggregations