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 {
@Override
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:
http://apache-commons.680414.n4.nabble.com/BOBYQA-Optimization-Passing-Coefficient-Arrays-For-Objective-Function-tp4635765.html
Sent from the Commons - User mailing list archive at Nabble.com.