Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add linear optimization to Optimize Recoils or Fluence #252

Merged
merged 50 commits into from
Mar 22, 2022

Conversation

tpitkanen
Copy link
Member

@tpitkanen tpitkanen commented Feb 17, 2022

Issue: #193

TODO:

  • _generate_mev_to_nm_function(): handle the case where there are really short peaks at surface or between valid peaks (ignore missing peaks or use the longest streak of non-zeroish peaks)
  • unit tests
  • add an option to get the starting solution from user

Future TODO:

  • remember which combination of NSGA-II/Linear and recoil/fluence is selected (not as simple as saving the other settings because the settings are saved using PropertySavingWidget, which doesn't work well on individual variables). As a quick fix, linear optimization could be the new default selection.
  • add support for fluence optimization (currently only recoil optimization is supported)
  • multi-thread initial espe runs (ElementSimulation.calculate_espe() uses multiple recoils for some reason, including self.optimization_recoils[0]. Check if a single recoil can be safely used instead.)
  • customizable shape (number of peaks, rectangular or not, peak at surface or deeper)
  • selectable number of iterations

- the button doesn't affect optimization yet
- move general optimization methods from Nsgaii to BaseOptimizer
- input types have more leeway (e.g. np.ndarray or list)
- temporarily uses constant values for things
- returns a duplicated med_sol
- doesn't optimize that well, probably because SciPy's minimize decides
the step size from initial values, some of which are almost 0
- mean squared error is a better estimator than absolute error sum
- sum is usually a better optimization target
- separate methods for finding peak information
- function for splitting Espe
- namedtuple for peak information
- remove unused enumerate
- valley information is not used yet
- retry until enough peaks are found
- remove least prominent peaks
- remove most_prominent_i from PeakInfo
- add TODOs
- update peak methods
- update comments
- add TODO for x monotony check
- median solution is now the first round's result
- check error messages are not shown to user yet
- add solution checking
- update Peak methods
- update documentation
- fix prevents wrong order error if the last peak exceeds max width
- remove unused imports
- rename _generate_mev_to_nm_function parameters
- remove old TODOs
- remove unused y argument
- remove _get_bounds and bounds argument
- add check for solution type (WIP)
- falsy espe is most likely caused by missing simulated data (like in
  nsgaii)
- remove old pass statement
- remove old TODO
- period separates error message from "Optimization stopped" at the end
- messages are shown in the optimization state field
- add TODO
- a missing peak doesn't break the loop anymore
- rows and columns were out of order
- only affects version control, UI remains unchanged
- add member variables
- remove arguments from _generate_mev_to_nm_function
- update docstrings
- remove old TODOs
- fixes KeyError
- partially untested (LinearOptimizer doesn't implement fluence
  optimization yet)
- enable_sim_params was not run until the skip simulation checkbox was
  pressed
- update documentation
- settings can be edited, but they are not persisted after closing the
  dialog like for nsgaii
- fluence is allowed despite being unimplemented
- UI files and optimization_linear_parameters.py contain a lot of
  copy-paste
- previous version locked out the "skip simulation" button that toggles
  editing
- enable_sim_params is already called in __init__s
@tpitkanen tpitkanen self-assigned this Feb 17, 2022
@tpitkanen tpitkanen marked this pull request as draft February 17, 2022 20:46
@tpitkanen tpitkanen changed the title Linear optimization Add linear optimization to Optimize Recoils or Fluence Feb 17, 2022
@tpitkanen tpitkanen marked this pull request as ready for review March 22, 2022 21:23
@tpitkanen
Copy link
Member Author

This isn't entirely polished yet (missing some edge cases, a bit clunky settings, no tests), but it's usable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant