Search in sources :

Example 1 with OptimizationSolver

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;
}
Also used : OptimizationException(cbit.vcell.opt.OptimizationException) PowellOptimizationSolver(cbit.vcell.opt.solvers.PowellOptimizationSolver) OptimizationSolver(cbit.vcell.opt.solvers.OptimizationSolver) PowellOptimizationSolver(cbit.vcell.opt.solvers.PowellOptimizationSolver) OptimizationResultSet(cbit.vcell.opt.OptimizationResultSet) IOException(java.io.IOException) ExpressionException(cbit.vcell.parser.ExpressionException)

Aggregations

OptimizationException (cbit.vcell.opt.OptimizationException)1 OptimizationResultSet (cbit.vcell.opt.OptimizationResultSet)1 OptimizationSolver (cbit.vcell.opt.solvers.OptimizationSolver)1 PowellOptimizationSolver (cbit.vcell.opt.solvers.PowellOptimizationSolver)1 ExpressionException (cbit.vcell.parser.ExpressionException)1 IOException (java.io.IOException)1