[ 
https://issues.apache.org/jira/browse/MATH-1137?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14065074#comment-14065074
 ] 

Nigel Goodwin commented on MATH-1137:
-------------------------------------

I have changed very, very little.

The current tests may not exercise that code, but the tests provided by Powell 
in his Fortran, when implemented in Java, do exercise it (but not when 
implemented in Fortran, so far...). At the very least, we should add the Powell 
tests to the set of tests (see below).

Changes:

Line 403 initialise trustRegionCenterInterpolationPointIndex to -1

Line 420 initialise knew to -1

Line 894 set knew to -1

Line 1137 change to if (knew > -1)   (of course, this has no effect, but is 
more consistent and readable because -1 means 'not set')

Of course, -1 is just a Fortran workaround to mean 'null' or NA or whatever. I 
would suggest using Integer.NaN, but there isn't such a thing, which is 
strange....So -1 will have to do. But we ought to make a static final integer 
to take the place of '-1', so it is more readable.

I don't know whether the above changes had any effect, but they are certainly a 
better and more consistent  translation of the Fortran. Line 1117 already set 
knew to -1, but in other places it was set to 0 (as per the Fortran), which is 
incorrect because knew is a zero based index. This was dangerous practice.

I also did changes to make double comparisons more consistent with the Fortran. 
This was so I could compare as closely as possible to the Fortran, and these 
changes were necessary (but not sufficient) to do this. I can see, longer term, 
value in making it as close as possible, and ideally the same changes would be 
done to the Fortran. In this way, we can do a head to head comparison between 
Java and Fortran. They start deviating as they converge to the solution, and 
the higher the dimensions and the number of interpolation points used, the more 
quickly they deviate. But I still like the idea of trying to make them as close 
as possible.

The things I changed were:

Line 787  if ((temp * den - scaden) > scaden * 1.0e-10)
Line 915 if ((temp * den - scaden) > scaden * 1.0e-10)
Line 1403 if ((predsq - presav)> presav * 1.0e-10)

No doubt there are others, but this was enough for the moment.

Now, there is no reason to believe that in general these will behave the same 
as the Fortran, so really the Fortran should have the same changes, and then we 
have a closer correspondence between java and Fortran which we can use for 
future testing.

Does that make sense?

When I tested, I ran the Fortran and Java side by side, output a host of 
diagnostics, used the debugger extensively, and gradually convinced myself 
that, with the above changes, they were doing the same thing. I now need to go 
to specsavers. I still don't know what country you are based in.

The Powell test example looks like a good test, and it almost certainly covers 
branches which the existing tests did not. I have, of course, the java code for 
my test environment.

Now, I have never participated in open source, I don't know what the procedure 
is, I don't know your role, bla bla bla. But it would be nice to get my changes 
into Apache. What is the best way to do this? Of course, I want somebody else 
(you?) to examine my changes and review them. Also, all the existing tests need 
to be re run and results compared.

I run my own self employed business, I have spent maybe $6000 USD on this per 
my day rates. I don't have an employer (or taxpayer) who can absorb these costs.

Also, of course, not to forget my original bug correction!

What is the best way forward?



> BOBYQA incorrect indexing
> -------------------------
>
>                 Key: MATH-1137
>                 URL: https://issues.apache.org/jira/browse/MATH-1137
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.3
>            Reporter: Nigel Goodwin
>




--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to