48 lines
1.2 KiB
C++
48 lines
1.2 KiB
C++
#pragma once
|
|
|
|
/**
|
|
* @file evolution.hpp
|
|
* @brief EvolutionManager — orchestrates population dynamics.
|
|
*
|
|
* Port of: packages/fces/core/evolution_manager.py
|
|
*/
|
|
|
|
#include "population.hpp"
|
|
|
|
namespace fces {
|
|
|
|
/**
|
|
* EvolutionManager — controls the scheduling of evolutionary operations.
|
|
*
|
|
* Responsibilities:
|
|
* - Controller rotation (sticky selection with interval)
|
|
* - Population dynamics (auto-sizing, lockdown)
|
|
* - Triggering evolution at intervals
|
|
*/
|
|
class EvolutionManager {
|
|
public:
|
|
explicit EvolutionManager(Population &population, int selection_interval = 50,
|
|
bool auto_population = false,
|
|
bool direct_construction = false);
|
|
|
|
/// Get the currently active controller
|
|
FuzzyController &get_active_controller();
|
|
|
|
/// Update population dynamics based on current training state
|
|
void update_population_dynamics(float loss_velocity, float ema_loss,
|
|
int step_counter, int total_steps);
|
|
|
|
/// Steps the active controller has been in control
|
|
int steps_active = 0;
|
|
|
|
/// Selection interval (how long a controller stays active)
|
|
int selection_interval;
|
|
|
|
private:
|
|
Population &population_;
|
|
bool auto_population_;
|
|
bool direct_construction_;
|
|
};
|
|
|
|
} // namespace fces
|