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

Genetic Algorithm for Function Optimization #11578

Open
UTSAVS26 opened this issue Sep 21, 2024 · 3 comments
Open

Genetic Algorithm for Function Optimization #11578

UTSAVS26 opened this issue Sep 21, 2024 · 3 comments
Labels
enhancement This PR modified some existing files

Comments

@UTSAVS26
Copy link

Feature description

This feature would introduce a new genetic algorithm-based approach to optimize mathematical functions. It would allow users to find the minimum or maximum values of continuous functions using genetic algorithms.

Key Components:

  • Target Function: The user can define their own function to optimize, for example, ( f(x, y) = x^2 + y^2 ), or more complex functions.
  • Population Initialization: Randomly generate initial solutions (chromosomes) within a defined search space.
  • Fitness Function: Evaluate each chromosome's fitness based on how close the function value is to the desired optimum (minimization or maximization).
  • Selection: Use selection methods like tournament selection or roulette wheel to pick parents for crossover based on their fitness scores.
  • Crossover: Implement crossover strategies such as one-point, two-point, or uniform crossover to combine parent chromosomes into offspring.
  • Mutation: Introduce random mutations to offspring to maintain diversity in the population and avoid local minima.
  • Termination Condition: Allow the algorithm to stop after a set number of generations or when the improvement between generations is minimal.

This implementation would be useful for users needing a flexible and easy-to-use method for solving optimization problems in continuous spaces.

@UTSAVS26 UTSAVS26 added the enhancement This PR modified some existing files label Sep 21, 2024
@athulraj909
Copy link

This is a great feature proposal! Here's my understanding and thoughts on the approach:

The genetic algorithm-based optimization will provide a flexible solution for users to find minima or maxima for a wide variety of continuous functions.
The ability for users to define their own target function adds great versatility, whether they want to solve simple problems like f(x, y) = x^2 + y^2 or more complex equations.
The key components, from population initialization, selection methods (like tournament or roulette wheel), to crossover and mutation strategies, provide a solid framework for diversity and adaptability in the optimization process.
I appreciate the emphasis on avoiding local minima by introducing mutations, which is crucial for maintaining genetic diversity.
Termination conditions based on either generation count or improvement threshold give the algorithm flexibility to suit different optimization scenarios.
I’d love to contribute to implementing this, particularly around the crossover and mutation strategies. Feel free to assign me if needed. Looking forward to collaborating!

@night-spring
Copy link

how are the test cases are being checked. I also made a new function and tried to push it. It wen till build with nno errors but in the end saying failed to test .

@night-spring
Copy link

review my pr please its running successfully

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This PR modified some existing files
Projects
None yet
3 participants