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

Fix case where Seek goes backwards #780

Open grumpyinca opened 1 year ago

grumpyinca commented 1 year ago

The attached design file illustrates a Seek failure in v4.3.3. It should be investigated and if possible, improvements to the Seek algorithm should be implemented to prevent this kind of failure.

  1. Expand the attached .ZIP file
  2. Launch the ODOP app & File : Import the SeekMaxCycle_LifeFails.json file
  3. Seek Max Cycle_Life
  4. Observe that the value of Cycle_Life decreases from 19,689 to 18,977 but is reported as a 3.615% improvement.

What went wrong ?

Notes: Imposing a Cycle_Life MIN of 34,800 and running search will result in a (just barely) feasible design. Other parameters can produce a similar backwards move with Seek Max Cycle_life

SeekMaxCycle_LifeFails.zip

grumpyinca commented 1 year ago

The console log with IOOPT = 6 is:

seek.js:27 00 In seek {type: 'SEEK', payload: {…}}
seek.js:30 01 SEEK:    OBJ = 0
seek.js:37 02A THE NUMBER OF FIXED INDEPENDENT VARIABLES IS: 3
seek.js:38 02B THE NUMBER OF FREE INDEPENDENT VARIABLES IS: 3
seek.js:72 03 THE CURRENT VALUE OF Cycle_Life IS: 19689.07103881637 cycles
seek.js:73 04 THE CURRENT ESTIMATED OPTIMUM IS: 21657.978142698008 cycles
seek.js:74 05 ESTIMATING VALUE OF OPTIMUM ...
seek.js:87 06 THE CURRENT VALUE OF Cycle_Life IS: 170263494885.515 cycles
seek.js:88 07 THE CURRENT ESTIMATED OPTIMUM IS: 170263494885.515 cycles
seek.js:109 08 SEARCHING FOR A FEASIBLE START POINT ...
seek.js:115 09 THE CURRENT VALUE OF Cycle_Life IS: 18977.251529746023 cycles
seek.js:116 10 THE CURRENT ESTIMATED OPTIMUM IS: 170263494885.515 cycles
seek.js:120 11 SEEKING OPTIMUM Cycle_Life USING ESTIMATE OF: 170263494885.515 cycles
seek.js:130 12 RETURN ON: Search terminated when step size reached the minimum limit (DELMIN). 
    Low iteration count may produce low precision results.     OBJ =0.009999998885418655
seek.js:131 13 CURRENT VALUE OF Cycle_Life IS 18977.251529746023 cycles
seek.js:155 14 Merit Function =  0.009999998885418655
grumpyinca commented 1 year ago

An obvious fix here is to make sure that Seek never returns a worse value of the merit function. Perhaps in the case of Seek failure, the AutoSaved pre-Seek design can be restored along with providing an appropriate termination condition message.

However, there are cases to consider before implementing such an approach. Specifically:

This is a bit of a stretch but ... in the case of Seek failure and where there is no user-established constraint on the Seek target variable, it should be possible to establish a temporary trial constraint on that variable and then run a Search. This should change the design and provide a different starting point for a new Seek (with temporary constraint removed). If that Seek succeeds there will be no need to re-impose the original Auto_Save point and alert the user.