use of com.sri.ai.praise.evaluate.solver.SolverEvaluatorConfiguration in project aic-praise by aic-sri-international.
the class Evaluation method instantiateSolvers.
@SuppressWarnings("unchecked")
private List<SolverEvaluator> instantiateSolvers(List<SolverEvaluatorConfiguration> solverConfigurations, File workingDirectory) {
List<SolverEvaluator> result = new ArrayList<>(solverConfigurations.size());
for (SolverEvaluatorConfiguration configuration : solverConfigurations) {
Class<? extends SolverEvaluator> clazz;
try {
clazz = (Class<? extends SolverEvaluator>) Class.forName(configuration.getImplementationClassName());
} catch (ClassNotFoundException cnfe) {
throw new IllegalArgumentException("Unable to find " + SolverEvaluator.class.getName() + " implementation class: " + configuration.getImplementationClassName(), cnfe);
}
try {
SolverEvaluator solver = clazz.newInstance();
configuration.setWorkingDirectory(workingDirectory);
solver.setConfiguration(configuration);
result.add(solver);
} catch (Throwable t) {
throw new IllegalStateException("Unable to instantiate instance of " + clazz.getName(), t);
}
}
return result;
}
use of com.sri.ai.praise.evaluate.solver.SolverEvaluatorConfiguration in project aic-praise by aic-sri-international.
the class AbstractEvaluateCLI method run.
public void run(String[] args) throws Exception {
try (EvaluationArgs evaluationArgs = getArgs(args)) {
PagedModelContainer modelsContainer = makeModelsContainer(evaluationArgs);
Evaluation.Configuration configuration = new Evaluation.Configuration(Evaluation.Type.PR, evaluationArgs.workingDirectory, evaluationArgs.numberRunsToAverageOver);
List<SolverEvaluatorConfiguration> solverConfigurations = new ArrayList<>();
for (String solverImplementationClassName : evaluationArgs.solverImplementationClassNames) {
solverConfigurations.add(new SolverEvaluatorConfiguration(solverImplementationClassName, evaluationArgs.totalCPURuntimeLimitSecondsPerSolveAttempt, evaluationArgs.totalMemoryLimitInMegabytesPerSolveAttempt, !evaluationArgs.translateAlways, Collections.emptyMap()));
}
PrintStream notificationOut = evaluationArgs.notificationOut;
PrintStream resultOut = evaluationArgs.resultOut;
evaluate(configuration, modelsContainer, solverConfigurations, notificationOut, resultOut);
}
}
Aggregations