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

Tolerance parameters #402

Merged
merged 7 commits into from
Jun 5, 2020
Merged

Conversation

nishnash54
Copy link
Contributor

@nishnash54 nishnash54 commented May 11, 2020

Solves a number of recent cases regarding ftol, ftol_iter, their implementation, testing and usage.

Description

  • Add assertion for ftol_iter
    makes sure ftol_iter >= 0 and int
  • Optimize code using deque to replace list
    append() and popleft() methods integrated
  • Improvements in unit test
    improve unit test coverage by adding test for assertion, effects on optimizer without ftol, with ftol and with both ftol and ftol_iter based on 0-1 knapsack problem.

TODO

  • Improve documentation for ftol and ftol_iter parameters
  • Add examples and use cases (demo notebook)
  • Implement testing for BinaryPSO

Related Issue

#397 #373

Motivation and Context

Improves documentation, covers testing of tolerance based parameters and improves understanding of the effects of tolerance parameters.

How Has This Been Tested?

Additional testing script for all tolerance related parameters.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checks
- ftol_iter: int
- ftol_iter > 0
test for effects of ftol anf ftol_iter on
- GlobalBestPSO
- LocalBestPSO
- GeneralOptimizerPSO
improves complexity using
popleft() and append()
@nishnash54
Copy link
Contributor Author

nishnash54 commented May 11, 2020

Have to update the documentation. Currently the parameters are documented as follows.

  • ftol: relative error in objective_func(best_pos) acceptable for convergence. Default is -inf
  • ftol_iter: number of iterations over which the relative error in objective_func(best_pos) is acceptable for convergence. Default is 1

@ljvmiranda921 and @whzup would like your inputs on improving the documentation, making it clear as to how the features work independently as well as together.

@hakan-gecili I am aware of that. This is just a basic test bed. Later I will have to integrate this with the TestOptimizer base class, so just kept it simple for now.

@hakan-gecili
Copy link

With a very small tweak you can use the Knapsack Problem code for testing BinaryPSO

@ljvmiranda921 ljvmiranda921 self-requested a review May 13, 2020 21:03
@ljvmiranda921
Copy link
Owner

Hey @nishnash54 thanks for taking point on this. This is noted, I'll be checking this again on the weekend! Let me know if this PR is already good for review!

- knapsack problem
- working of ftol and ftol_iter
@nishnash54 nishnash54 marked this pull request as ready for review May 15, 2020 11:10
@nishnash54
Copy link
Contributor Author

Hey @ljvmiranda921 I think most of the stuff is complete and you can review the changes now.
I guess the documentation can be updated later or also moved to the documentation update milestone.

@ljvmiranda921
Copy link
Owner

Yeah, let's do the documentation after. The notebook suffices for now in this PR. Will wait for @whzup 's review before we proceed! Thanks for this, @nishnash54 !

- set maxlen = ftol_iter
- remove popleft()
@nishnash54 nishnash54 changed the title WIP: Tolerance parameters Tolerance parameters Jun 5, 2020
@nishnash54
Copy link
Contributor Author

@ljvmiranda921 @whzup
Are these changes fine?

Copy link
Collaborator

@whzup whzup left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! If @ljvmiranda921 is ok with the formatting changes it should be good to go 😄.

@ljvmiranda921
Copy link
Owner

ljvmiranda921 commented Jun 5, 2020

Let's merge this then let's resolve msat59's PR and see how we can integrate it

@ljvmiranda921 ljvmiranda921 merged commit f16e156 into ljvmiranda921:master Jun 5, 2020
@nishnash54 nishnash54 deleted the tolerance branch June 6, 2020 09:38
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.

4 participants