diff options
Diffstat (limited to 'src/engine/Problem.hpp')
-rw-r--r-- | src/engine/Problem.hpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/engine/Problem.hpp b/src/engine/Problem.hpp index ced3675..81e67d7 100644 --- a/src/engine/Problem.hpp +++ b/src/engine/Problem.hpp @@ -17,7 +17,10 @@ #ifndef MACHINA_PROBLEM_HPP #define MACHINA_PROBLEM_HPP +#include <stdint.h> + #include <map> +#include <stdexcept> #include "machina/Machine.hpp" #include "eugene/Problem.hpp" @@ -26,7 +29,7 @@ namespace machina { -class Problem : public Eugene::Problem<Machine> { +class Problem : public eugene::Problem<Machine> { public: Problem(TimeUnit unit, const std::string& target_midi, @@ -35,14 +38,16 @@ public: void seed(SPtr<Machine> parent) { _seed = parent; } - float fitness(const Machine& machine) const; + float evaluate(const Machine& machine) const; bool fitness_less_than(float a, float b) const { return a < b; } void clear_fitness_cache() { _fitness.clear(); } - boost::shared_ptr<Population> - initial_population(size_t gene_size, size_t pop_size) const; + void initial_population(eugene::Random& rng, + Population& pop, + size_t gene_size, + size_t pop_size) const; private: size_t distance(const std::vector<uint8_t>& source, @@ -83,7 +88,7 @@ private: float _counts[128]; };*/ - struct Evaluator : public Raul::MIDISink { + struct Evaluator : public MIDISink { explicit Evaluator(const Problem& problem) : _problem(problem) , _order(4) |