From 7e8186df9bdb8bcc0177cb572f39ae96fb046004 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 7 Dec 2007 05:26:52 +0000 Subject: Fix termination of evolution and resumed Jack execution. git-svn-id: http://svn.drobilla.net/lad/machina@960 a436a847-0d15-0410-975c-d299462d15a1 --- src/engine/Evolver.cpp | 6 ++++-- src/engine/Problem.cpp | 8 ++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/engine/Evolver.cpp b/src/engine/Evolver.cpp index 73ff12f..e509d97 100644 --- a/src/engine/Evolver.cpp +++ b/src/engine/Evolver.cpp @@ -72,9 +72,9 @@ Evolver::_run() { float old_best = _ga->best_fitness(); - while (true) { + while (!_exit_flag) { + cout << "{"; _ga->iteration(); - //cout << "I" << endl; float new_best = _ga->best_fitness(); if (new_best > old_best) { @@ -82,6 +82,8 @@ Evolver::_run() old_best = new_best; cout << "NEW BEST: " << new_best << endl; } + + cout << "}" << endl; } } diff --git a/src/engine/Problem.cpp b/src/engine/Problem.cpp index 6c6fdd3..1d11870 100644 --- a/src/engine/Problem.cpp +++ b/src/engine/Problem.cpp @@ -49,7 +49,8 @@ Problem::Problem(const std::string& target_midi, SharedPtr seed) } } - cout << "Target length: " << _target._length << endl; + cout << "Target notes: " << _target._n_notes << endl; + cout << "Target duration: " << _target._length << endl; _target.compute(); } @@ -58,7 +59,7 @@ Problem::Problem(const std::string& target_midi, SharedPtr seed) float Problem::fitness(const Machine& const_machine) const { - //cout << "f"; + cout << "("; // kluuudge Machine& machine = const_cast(const_machine); @@ -94,6 +95,9 @@ Problem::fitness(const Machine& const_machine) const else f -= _target._note_frequency[i] - eval->_note_frequency[i]; } + + + cout << ")"; return f; } -- cgit v1.2.1