commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gilles Sadowski <gil...@harfang.homelinux.org>
Subject Re: BOBYQA Optimization - Passing Coefficient Arrays For Objective Function
Date Sat, 30 Jun 2012 23:53:12 GMT
Hi.

[When posting to this list, you should always indicate to which Commons
project the message is targetted. e.g. in this case by adding a "[Math]"
prefix to the subject line.]

> 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;
>         }
>         }

Unfortunately, I cannot help with so little information. Please post the
the Java file which you try to compile, together with the full output of the
compiler.


Regards,
Gilles

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message