use of cbit.vcell.opt.solvers.OptimizationSolver in project vcell by virtualcell.
the class LocalOptimizationService method solve.
/**
* solve method comment.
*/
public OptimizationResultSet solve(OptimizationSpec optSpec, OptimizationSolverSpec optSolverSpec, OptSolverCallbacks optSolverCallbacks) {
OptimizationSolver optSolver = null;
if (optSolverSpec.getSolverType().equals(OptimizationSolverSpec.SOLVERTYPE_POWELL)) {
optSolver = new PowellOptimizationSolver();
// }else if (optSolverSpec.getSolverType().equals(OptimizationSolverSpec.SOLVERTYPE_CONJUGATE_GRADIENT)){
// optSolver = new ConjugateGradientOptimizationSolver();
} else {
throw new RuntimeException("unsupported solver type '" + optSolverSpec.getSolverType() + "'");
}
OptimizationResultSet optResultSet = null;
try {
optResultSet = optSolver.solve(optSpec, optSolverSpec, optSolverCallbacks);
} catch (IOException e) {
e.printStackTrace(System.out);
throw new RuntimeException(e.getMessage());
} catch (ExpressionException e) {
e.printStackTrace(System.out);
throw new RuntimeException(e.getMessage());
} catch (OptimizationException e) {
e.printStackTrace(System.out);
throw new RuntimeException(e.getMessage());
}
return optResultSet;
}
Aggregations