How should I Test a Genetic Algorithm

前端 未结 10 666
心在旅途
心在旅途 2021-01-29 22:00

I have made a quite few genetic algorithms; they work (they find a reasonable solution quickly). But I have now discovered TDD. Is there a way to write a genetic algorithm (whic

10条回答
  •  执笔经年
    2021-01-29 22:41

    Well the most testable part is the fitness function - where all your logic will be. this can be in some cases quite complex (you might be running all sorts of simulations based on input parameters) so you wanna be sure all that stuff works with a whole lot of unit tests, and this work can follow whatever methodology.

    With regards to testing the GA parameters (mutation rate, cross-over strategy, whatever) if you're implementing that stuff yourself you can certainly test it (you can again have unit tests around mutation logic etc.) but you won't be able to test the 'fine-tuning' of the GA.

    In other words, you won't be able to test if GA actually performs other than by the goodness of the solutions found.

提交回复
热议问题