Merge d306ef81d9 into 3259d1b452
This commit is contained in:
commit
145babc2e5
3 changed files with 27 additions and 2 deletions
|
|
@ -42,6 +42,12 @@
|
||||||
* Abstract class for multi-objective algorithms.
|
* Abstract class for multi-objective algorithms.
|
||||||
*/
|
*/
|
||||||
class moeoAlgo
|
class moeoAlgo
|
||||||
{};
|
{
|
||||||
|
public:
|
||||||
|
virtual ~moeoAlgo() = default;
|
||||||
|
|
||||||
|
/** Whether this algorithm supports finalize() for post-integration updates. */
|
||||||
|
virtual bool hasFinalize() const { return false; }
|
||||||
|
};
|
||||||
|
|
||||||
#endif /*MOEOALGO_H_*/
|
#endif /*MOEOALGO_H_*/
|
||||||
|
|
|
||||||
|
|
@ -148,6 +148,17 @@ public:
|
||||||
while (continuator (_pop));
|
while (continuator (_pop));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Recompute fitness and diversity assignments on the population.
|
||||||
|
* Useful after integrating immigrants from an island model.
|
||||||
|
* @param _pop the population to finalize
|
||||||
|
*/
|
||||||
|
void finalize(eoPop<MOEOT>& _pop) override {
|
||||||
|
fitnessAssignment(_pop);
|
||||||
|
diversityAssignment(_pop);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool hasFinalize() const override { return true; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,14 @@
|
||||||
*/
|
*/
|
||||||
template < class MOEOT >
|
template < class MOEOT >
|
||||||
class moeoPopAlgo : public moeoAlgo, public eoAlgo < MOEOT >
|
class moeoPopAlgo : public moeoAlgo, public eoAlgo < MOEOT >
|
||||||
{};
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Recompute fitness/diversity after external population changes (e.g. immigrant integration).
|
||||||
|
* Default implementation is a no-op. Override in subclasses that need it.
|
||||||
|
* @param _pop the population to finalize
|
||||||
|
*/
|
||||||
|
virtual void finalize(eoPop<MOEOT>&) {}
|
||||||
|
};
|
||||||
|
|
||||||
#endif /*MOEOPOPALGO_H_*/
|
#endif /*MOEOPOPALGO_H_*/
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue