Refactor optimization type handling and update documentation#17
Conversation
This commit refactors the optimization type handling across the framework to use the new `min` and `max` values instead of the previous `MINIMIZE` and `MAXIMIZE`. Key changes include: - Updated the `OptimizationType` enum and related classes to reflect the new naming convention. - Adjusted the `Problem` and `Population` interfaces to utilize the new optimization types. - Modified selection algorithms to ensure compatibility with the new optimization logic. - Enhanced documentation in `README.md`, `configuration.md`, and `architecture.md` to clarify the changes and usage of the new optimization types. - Removed deprecated classes and methods related to the old optimization type handling. These changes improve code clarity and maintainability while ensuring backward compatibility with existing configurations.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| for (int i = 0; i < config.getPopulationSize(); i++) { | ||
| offspring.add(createOffspring()); | ||
| } | ||
|
|
||
| // Evaluate all offspring in parallel if context provides executor | ||
| long e0 = System.nanoTime(); | ||
| evaluatePopulation(offspring); |
There was a problem hiding this comment.
Avoid re-evaluating CGP offspring twice per generation
In generational mode each child is already evaluated inside createOffspring() (problem.evaluate(child)), yet runGenerationalEpoch() immediately calls evaluatePopulation(offspring) on the same collection. This invokes problem.evaluate a second time for every individual, doubling runtime and inflating evaluation counters. For problems with side effects or stochastic evaluation this also changes fitness values unexpectedly. Drop the extra evaluatePopulation call or skip the per-child evaluation to ensure each offspring is scored exactly once.
Useful? React with 👍 / 👎.
This commit refactors the optimization type handling across the framework to use the new
minandmaxvalues instead of the previousMINIMIZEandMAXIMIZE. Key changes include:OptimizationTypeenum and related classes to reflect the new naming convention.ProblemandPopulationinterfaces to utilize the new optimization types.README.md,configuration.md, andarchitecture.mdto clarify the changes and usage of the new optimization types.These changes improve code clarity and maintainability while ensuring backward compatibility with existing configurations.