Skip to content

Error in Java translation of trstlp #5

@rruusu

Description

@rruusu

On line 1078 of Cobyla.java, there is a deviation from the behavior of the original Fortran code:

                    if (mcon == m)
                    {
                        double acca = step + 0.1 * resmax;
                        double accb = step + 0.2 * resmax;
                        if (step >= acca || acca >= accb) break L_70;
                        step = Math.min(step, resmax);
                    }

This corresponds to the following Fortran code:

        if (mcon == m) then
            acca = step + 0.1_wp * resmax
            accb = step + 0.2_wp * resmax
            if (step >= acca .or. acca >= accb) go to 480
            step = min (step, resmax)
        end if

The break L_70 statement takes the Java code to line 1184:

                if (step == stpful) return true;

This is equivalent to a go to statement to the line just above the label 480 in the original Fortran. In this case, the condition step == stpful is always true, resulting in a premature exit from trstlp, causing it to return a step of size zero, while claiming to have taken a full step and thus multiple evaluations of sample points.

In order to match the effects of the go to 480 statement in the Fortran code, the break L_70 statement should instead be continue L_60.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions