commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rsloma <>
Subject BOBYQA Optimization - Passing Coefficient Arrays For Objective Function
Date Sat, 30 Jun 2012 19:24:27 GMT
I could use some help with this issue.  I am not an expert with Java
programming. Maybe this should be obvious, so excuse me if this is trivial.

I have the code working to pass the starting point array to the class
implementing MultivariateFunction.  An example of the class code I am
working with is below.  I am trying to pass the coefficient ThreeYrRet
arraylist, but when I attempt to add the arraylist to public double
value(...., I get the message that the class *Portfolio is not abstract and
does not override abstract method value(double[]) in
org.apache.commons.math3.analysis.MultivariateFunction*.  Making the class
abstract does not work, as well as implementing abstract methods.

Your help on this is greatly appreciated.

    public static class Portfolio implements MultivariateFunction  {
        public double value(double[] x) {

        double Rp = 0;
        double RFR = 0.0007;

            for (int i = 0; i < x.length; ++i) {
            Rp += x[i] * ThreeYrRet.get(i).get(0);

        double f = (Rp - RFR);
        System.out.println("weights = " + x);
        System.out.println("f = " + f);
        return f;

View this message in context:
Sent from the Commons - User mailing list archive at
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message