i wrote this simple GA simulator (missing the crucial fitness func)
i am new to cpp and would like to get feed back if it has any important errors before diving head first into the fitness func
also tipps on how to implement or what modules to use for my fitness func are welcome
i wish to approximate 2d shapes with simple rectangles and circles
#Code review
11 messages · Page 1 of 1 (latest)
When your question is answered use !solved or the button below to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.
it compiles but i have no idea if it has any other errors
i started testing it and added a few things i missed but i dont see anything else than the fitness left
Better suited for #1078717238678409369
Not quite sure what the purpose of the program is but for starters, you should take parameters of large objects by reference to avoid unecessary copies
Especially types like vectors that can be very expensive to copy
If the parameter is only read from in the body, define the parameter as const type&, it's free performance without it breaking existing calls
take std::vectors by reference
no need to static_cast from int to bool but if you like explicitly casting its fine
use enum class instead of just enum to prevent polluting the namespace
use constexpr variables instead of macros
constexpr double PI = 3.14; //type safe :)
Its supposed to be a generic algorithm just i didnt do the fitness function yet