thegrumpys / odop

Open Design Optimization Platform (ODOP) - Coil spring design app; mechanical springs; compression spring, extension spring, torsion spring
https://www.springdesignsoftware.org
MIT License
4 stars 5 forks source link

Seek calc of % improved can be incorrect #731

Closed grumpyinca closed 2 years ago

grumpyinca commented 2 years ago

The Seek algorithm conducts a second search in the case where the first search does not produce a feasible result.

By observation of the termination message and console log output (see below) it is apparent that current coding resets the reference point used in the calculation of % improvement with each search. Thus, in those cases where the Seek algorithm requires second search, the stated % improvement can be significantly incorrect.

Example using tutor7 p5:

  1. Reset ODOP app; keep default design type of compression spring
  2. Help : Tutorial ... : tutor7
  3. Click "Next" until reaching p5
  4. File : Preferences : ioopt = 6 : Save & Close
  5. Open browser console window; clear console log
  6. Observe that current (starting) value of Weight is 0.06747 pounds.
  7. Click "Next" to execute "Seek Min Weight"
  8. Observe termination message: "Seek completed. Weight 0.01743 --> 0.01146 pounds; 34.22% improvement."
  9. Observe the console log line that says: "13 CURRENT VALUE OF Weight IS 0.017426032985242836 pounds"
  10. The Bug: The reference value used in the % improvement calculation should have been 0.06747, not 0.01743.
1fifoto commented 2 years ago

The tutor7 script calls seek twice causing it to overlay the first seek's message with the second seek's message.

        title: "Page 06 of 17",
        text: (
            <>
                <p>
                If you see the Feasibility status shown as "NOT FEASIBLE",
                It means that the solution point has slightly violated constraints
                in order to achieve improvements in the result 
                (minimum Weight in this case).
                </p>
                <p>
                You may see the message:
                <br />
                "TO FURTHER IMPROVE RESULT, RE-EXECUTE SEEK"
                <br />
                This can happen when the optimum is far from the starting point.
                As a result, the internal estimate of the optimum was not perfect.
                Simply re-execute Seek to refine the result.
                </p>

                <p>
                Let's try exploring in a different direction.
                Perhaps this will be a design that prioritizes a softer spring 
                with a reduced spring rate.
                Take note of the current value of Rate. 
                </p>

                <p>
                In the process of moving to the next page 
                the tutorial will execute:
                <br /><br />
                SEEK  MIN  Rate
                </p>
                <br />
            </>
        ),
        actions: [
            seek("Weight", MIN),
            seek("Weight", MIN)
        ]

Re-running with manually issuing first one seek, then a search, then another seek does the following

Screen Shot 2022-08-27 at 9 53 47 AM

Screen Shot 2022-08-27 at 9 54 25 AM

This is not a programming issue, instead is it a tutor7 script issue. Closing and marking as invalid