Skip to content

Commit

Permalink
Fixing output for tuning strategies to be more helpful.
Browse files Browse the repository at this point in the history
  • Loading branch information
khuck committed Apr 26, 2024
1 parent f5f8582 commit f253535
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/apex/exhaustive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,20 @@ class log_wrapper {
};

void Exhaustive::evaluate(double new_cost) {
/*
static log_wrapper log(vars);
static size_t count{0};
if (++count % 10000 == 0) { std::cout << count << std::endl; }
log.getstream() << count << ",";
for (auto& v : vars) { log.getstream() << v.second.toString() << ","; }
log.getstream() << new_cost << std::endl;
*/
if (new_cost < cost) {
if (new_cost < best_cost) {
best_cost = new_cost;
std::cout << "New best! " << new_cost << " k: " << k;
for (auto& v : vars) { v.second.save_best(); }
for (auto& v : vars) { std::cout << ", value: " << v.second.toString(); }
for (auto& v : vars) { std::cout << ", " << v.first << ": " << v.second.toString(); }
std::cout << std::endl;
}
cost = new_cost;
Expand Down
4 changes: 3 additions & 1 deletion src/apex/genetic_search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,16 +158,18 @@ void GeneticSearch::getNewSettings() {
}

void GeneticSearch::evaluate(double new_cost) {
/*
static log_wrapper log(vars);
log.getstream() << k << ",";
for (auto& v : vars) { log.getstream() << v.second.toString() << ","; }
log.getstream() << new_cost << std::endl;
*/
if (new_cost < cost) {
if (new_cost < best_cost) {
best_cost = new_cost;
std::cout << "New best! " << new_cost << " k: " << k;
for (auto& v : vars) { v.second.save_best(); }
for (auto& v : vars) { std::cout << ", value: " << v.second.toString(); }
for (auto& v : vars) { std::cout << ", " << v.first << ": " << v.second.toString(); }
std::cout << std::endl;
}
cost = new_cost;
Expand Down
4 changes: 3 additions & 1 deletion src/apex/random.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,20 @@ class log_wrapper {
};

void Random::evaluate(double new_cost) {
/*
static log_wrapper log(vars);
static size_t count{0};
if (++count % 10000 == 0) { std::cout << count << std::endl; }
log.getstream() << count << ",";
for (auto& v : vars) { log.getstream() << v.second.toString() << ","; }
log.getstream() << new_cost << std::endl;
*/
if (new_cost < cost) {
if (new_cost < best_cost) {
best_cost = new_cost;
std::cout << "New best! " << new_cost << " k: " << k;
for (auto& v : vars) { v.second.save_best(); }
for (auto& v : vars) { std::cout << ", value: " << v.second.toString(); }
for (auto& v : vars) { std::cout << ", " << v.first << ": " << v.second.toString(); }
std::cout << std::endl;
}
cost = new_cost;
Expand Down
2 changes: 1 addition & 1 deletion src/apex/simulated_annealing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void SimulatedAnnealing::evaluate(double new_cost) {
best_cost = new_cost;
std::cout << "New best! " << new_cost << " k: " << k << " temp: " << temp;
for (auto& v : vars) { v.second.save_best(); }
for (auto& v : vars) { std::cout << ", value: " << v.second.toString(); }
for (auto& v : vars) { std::cout << ", " << v.first << ": " << v.second.toString(); }
std::cout << std::endl;
since_restart = 1;
}
Expand Down

0 comments on commit f253535

Please sign in to comment.