Skip to content

Commit

Permalink
debugging simulated annealing with one variable of only a few values.
Browse files Browse the repository at this point in the history
  • Loading branch information
khuck committed Apr 26, 2024
1 parent f253535 commit abb795e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/apex/simulated_annealing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ size_t SimulatedAnnealing::get_max_iterations() {
}
//return max_iter / vars.size();
//return max_iter * vars.size() *vars.size();
auto foo = std::min(max_iterations, (std::max(min_iterations, max_iter*vars.size())));
auto foo = max_iter;
if (vars.size() == 1) {
foo = max_iter * max_iter;
} else {
foo = std::min(max_iterations, (std::max(min_iterations, max_iter)));
}
//std::cout << "Max iterations: " << foo << std::endl;
return foo;
}
Expand Down
7 changes: 6 additions & 1 deletion src/apex/simulated_annealing.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,12 @@ class SimulatedAnnealing {
kmax = get_max_iterations();
/* get max iterations */
//std::cout << vars.size() << " Vars, Max iterations : " << kmax << std::endl;
restart = kmax / 10;
// prevent restart getting set to 0
if (kmax < 10) {
restart = kmax;
} else {
restart = kmax / 10;
}
}
};

Expand Down

0 comments on commit abb795e

Please sign in to comment.