feat(moeo): add finalize() lifecycle hook for algorithm post-processing#84
feat(moeo): add finalize() lifecycle hook for algorithm post-processing#84evvaletov wants to merge 1 commit intonojhan:masterfrom
Conversation
9066a5d to
45b4623
Compare
|
Good idea, thanks! I would be willing to merge this if I can review the code (same comment than for PR #83 ) |
Add virtual finalize() and hasFinalize() to moeoAlgo/moeoPopAlgo hierarchy. NSGA-II implements finalize() to recompute fitness and diversity assignments after population modifications (e.g. immigrant integration in island model).
45b4623 to
d306ef8
Compare
|
Rebased onto HEAD, should be reviewable now. On the design: |
|
This is a good idea. I'm just wondering why adding a const check for the feature instead of derivating a new interface? My immediate thought would have been to add some kind of But maybe there is some problem with that? |
Summary
Adds a
finalize()extension point to the multi-objective algorithmhierarchy, allowing algorithms to perform post-processing after external
population modifications.
moeoAlgo: virtual destructor +hasFinalize() const(default false)moeoPopAlgo<MOEOT>: virtualfinalize(eoPop<MOEOT>&)(default no-op)moeoNSGAII: implementsfinalize()to recompute dominance-depthfitness and crowding diversity assignments
Motivation
In island model configurations, immigrant individuals are integrated into
an island's population between generations. NSGA-II's fitness and diversity
values become stale after integration — the non-dominated sorting ranks and
crowding distances no longer reflect the actual population composition.
Without recomputation, selection pressure degrades until the next natural
generation boundary.
The
finalize()/hasFinalize()pattern lets the island model triggerrecomputation only on algorithms that need it, without coupling the island
infrastructure to specific algorithm internals.
Changes
moeo/src/algo/moeoAlgo.hhasFinalize() constmoeo/src/algo/moeoPopAlgo.hvirtual void finalize(eoPop<MOEOT>&) {}moeo/src/algo/moeoNSGAII.hfitnessAssignment+diversityAssignment