Python icon indicating copy to clipboard operation
Python copied to clipboard

Implement genetic algorithm for optimizing continuous functions

Open UTSAVS26 opened this issue 1 year ago • 5 comments

Describe your change:

  • Added a flexible genetic algorithm that allows users to define their own target functions for optimization.

  • Included features for population initialization, fitness evaluation, selection, crossover, and mutation.

  • Example function provided for minimizing f(x, y) = x^2 + y^2.

  • Configurable parameters for population size, mutation probability, and generations.

  • Add an algorithm? ✅ Yes

  • Fix a bug or typo in an existing algorithm? ❌ No

  • Add or change doctests? ❌ No

  • Documentation change? ❌ No

Checklist:

  • [x] I have read CONTRIBUTING.md.
  • [x] This pull request is all my own work -- I have not plagiarized.
  • [x] I know that pull requests will not be merged if they fail the automated tests.
  • [x] This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
  • [x] All new Python files are placed inside an existing directory.
  • [x] All filenames are in all lowercase characters with no spaces or dashes.
  • [x] All functions and variable names follow Python naming conventions.
  • [x] All function parameters and return values are annotated with Python type hints.
  • [x] All functions have doctests that pass the automated testing.
  • [x] All new algorithms include at least one URL that points to Wikipedia or another similar explanation.
  • [x] If this pull request resolves one or more open issues, then the description above includes the issue number(s) with a closing keyword: "Fixes #ISSUE-NUMBER".

Fixes #11578

UTSAVS26 avatar Oct 13 '24 07:10 UTSAVS26

Hi @cclauss , Thank you for your guidance on PR https://github.com/TheAlgorithms/Python/pull/11670 i am able to pass all the checks successfully in this PR. Thank you once again.

UTSAVS26 avatar Oct 13 '24 13:10 UTSAVS26

And how long it takes for the PR to get merged? Can i raise new PR's till then or wait until this PR is merges?

UTSAVS26 avatar Oct 13 '24 13:10 UTSAVS26

@cclauss please review and merge my PR.

UTSAVS26 avatar Oct 15 '24 03:10 UTSAVS26

@cclauss please review my pr as i want to contribute more. thank you for your time.

UTSAVS26 avatar Oct 15 '24 08:10 UTSAVS26

@cclauss

UTSAVS26 avatar Oct 23 '24 05:10 UTSAVS26

@cclauss please review my code.

UTSAVS26 avatar Nov 09 '24 11:11 UTSAVS26