Search in sources :

Example 1 with VectorFunction

use of cbit.function.VectorFunction in project vcell by virtualcell.

the class AugmentedObjectiveFunctionTest method getExample1.

/**
 * Insert the method's description here.
 * Creation date: (5/3/2002 2:49:06 PM)
 * @return opt.AugmentedObjectiveFunction
 */
public static AugmentedObjectiveFunction getExample1() {
    try {
        Expression scalarFn_exp = new Expression("pow(x1-2,4)+pow(x1-2*x2,2)");
        Expression[] eqConstraints_exps = { new Expression("pow(x1,2)-x2") };
        Expression[] ineqConstraints_exps = { new Expression("pow(x1,2)-x2") };
        ;
        String[] ids = { "x1", "x2" };
        ScalarFunction scalarFn = new DynamicScalarFunction(scalarFn_exp, ids);
        VectorFunction eqConstraints = new DynamicVectorFunction(eqConstraints_exps, ids);
        VectorFunction ineqConstraints = new DynamicVectorFunction(ineqConstraints_exps, ids);
        AugmentedObjectiveFunction aof = new AugmentedObjectiveFunction(scalarFn, eqConstraints, ineqConstraints, 2.0, 0.1, new DefaultOptSolverCallbacks());
        return aof;
    } catch (ExpressionException e) {
        e.printStackTrace();
        throw new RuntimeException(e.getMessage());
    }
}
Also used : DynamicScalarFunction(cbit.function.DynamicScalarFunction) DynamicScalarFunction(cbit.function.DynamicScalarFunction) ScalarFunction(cbit.function.ScalarFunction) Expression(cbit.vcell.parser.Expression) DefaultOptSolverCallbacks(org.vcell.optimization.DefaultOptSolverCallbacks) VectorFunction(cbit.function.VectorFunction) DynamicVectorFunction(cbit.function.DynamicVectorFunction) DynamicVectorFunction(cbit.function.DynamicVectorFunction) ExpressionException(cbit.vcell.parser.ExpressionException)

Example 2 with VectorFunction

use of cbit.function.VectorFunction in project vcell by virtualcell.

the class AugmentedObjectiveFunctionTest method getExample2.

/**
 * Insert the method's description here.                    // Root-finding example
 * Creation date: (5/3/2002 2:49:06 PM)
 * @return opt.AugmentedObjectiveFunction
 */
public static AugmentedObjectiveFunction getExample2() {
    try {
        Expression scalarFn_exp = new Expression("1");
        Expression[] eqConstraints_exps = { new Expression("sin(x1+x2)-exp(x1-x2)"), new Expression("cos(x1+x2)-x1*x1*x2*x2") };
        Expression[] ineqConstraints_exps = {};
        String[] ids = { "x1", "x2" };
        ScalarFunction scalarFn = new DynamicScalarFunction(scalarFn_exp, ids);
        VectorFunction eqConstraints = new DynamicVectorFunction(eqConstraints_exps, ids);
        VectorFunction ineqConstraints = new DynamicVectorFunction(ineqConstraints_exps, ids);
        AugmentedObjectiveFunction aof = new AugmentedObjectiveFunction(scalarFn, eqConstraints, ineqConstraints, 2.0, 0.1, new DefaultOptSolverCallbacks());
        return aof;
    } catch (ExpressionException e) {
        e.printStackTrace();
        throw new RuntimeException(e.getMessage());
    }
}
Also used : DynamicScalarFunction(cbit.function.DynamicScalarFunction) DynamicScalarFunction(cbit.function.DynamicScalarFunction) ScalarFunction(cbit.function.ScalarFunction) Expression(cbit.vcell.parser.Expression) DefaultOptSolverCallbacks(org.vcell.optimization.DefaultOptSolverCallbacks) VectorFunction(cbit.function.VectorFunction) DynamicVectorFunction(cbit.function.DynamicVectorFunction) DynamicVectorFunction(cbit.function.DynamicVectorFunction) ExpressionException(cbit.vcell.parser.ExpressionException)

Aggregations

DynamicScalarFunction (cbit.function.DynamicScalarFunction)2 DynamicVectorFunction (cbit.function.DynamicVectorFunction)2 ScalarFunction (cbit.function.ScalarFunction)2 VectorFunction (cbit.function.VectorFunction)2 Expression (cbit.vcell.parser.Expression)2 ExpressionException (cbit.vcell.parser.ExpressionException)2 DefaultOptSolverCallbacks (org.vcell.optimization.DefaultOptSolverCallbacks)2