Using ga to optimise a 9 input function.

조회 수: 6 (최근 30일)
daniel
daniel 2023년 11월 8일
댓글: daniel 2023년 11월 14일
I'm using MATLAB to optimise a 9 input function. I've created my function and it outputs a fitness penalty value. When im running the function there are 2 main points it can fail at (by this i mean the selected inputs provide neither a good or bad solution, just straight up fail). I have two if statements at these points, if the inputs fail at the first stage they recieve a fitness penalty of -800, if they fail at the second stage they recieve a fitness penalty of -400 (picked these kind of randomly). If they pass through both if statements succesfully then they recieve a positive fitness penalty based on how well they performed. I've set up a genetic algorithim to optimise this (find the maximum fitness penalty) and I have provided MATLAB with initial points that i know provide a positive fitness penalty. I did a couple of test runs with the ga whilst i was tweaking penalties and my function and it did work. However, I'm now running it properly and I cannot get a positive fitness penalty. I've tried adjusting my population size and elite population to no success. I suspect it's just that the ga is yet to find a succesful input to use in the next generation but i don't know for sure. Any help/advice greatly appreciated.

채택된 답변

Balavignesh
Balavignesh 2023년 11월 14일
Hi Daniel,
As per my understanding, you have a 9-input function, which outputs a fitness penalty value, and you would like to optimize the function to get a positive fitness penalty.
Optimization problems, especially with genetic algorithms (GA), can be quite tricky due to their stochastic nature. There can be several reasons why you are not getting a positive fitness penalty. Here are a few suggestions:
  • Fitness Function: You mentioned that you give a penalty of -800 or -400 if the solution fails at certain stages. I would suggest you not to return a very large negative value for the fitness function in case of failure as this might discourage the algorithm from exploring those regions of the solution space
  • Mutation and Crossover Rates: You could try adjusting the mutation and crossover rates. If the mutation rate is too low, the algorithm might not explore the solution space sufficiently. If it's too high, the algorithm might become a random search. Similarly, the crossover rate controls the extent to which information is shared between individuals.
  • Stall Generations: You could also try increasing the number of stall generations. This is the number of generations without any improvement after which the algorithm stops. Increasing this number gives the algorithm more time to find a better solution.
  • Constraint Handling: Make sure to handle the problem constraints correctly. Improper constraint handling can lead the algorithm to infeasible solutions.
Kindly refer to the following documentation links to have more information on the following:
Hope that helps!
Balavignesh
  댓글 수: 1
daniel
daniel 2023년 11월 14일
Thank you very much! I shall give that a go.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Genetic Algorithm에 대해 자세히 알아보기

제품


릴리스

R2023b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by