Fixed seed for the genetic optimizer for support generation

This commit is contained in:
tamasmeszaros 2019-03-12 15:21:55 +01:00
parent 6ae869f3b1
commit 1778c51af1
2 changed files with 4 additions and 0 deletions

View file

@ -14,6 +14,8 @@ public:
localmethod_ = m; localmethod_ = m;
return *this; return *this;
} }
inline void seed(unsigned long val) { nlopt::srand(val); }
}; };
template<> template<>

View file

@ -1479,6 +1479,7 @@ public:
stc.relative_score_difference = m_cfg.optimizer_rel_score_diff; stc.relative_score_difference = m_cfg.optimizer_rel_score_diff;
stc.stop_score = w; // space greater than w is enough stc.stop_score = w; // space greater than w is enough
GeneticOptimizer solver(stc); GeneticOptimizer solver(stc);
solver.seed(0); // we want deterministic behavior
auto oresult = solver.optimize_max( auto oresult = solver.optimize_max(
[this, pin_r, w, hp](double plr, double azm) [this, pin_r, w, hp](double plr, double azm)
@ -1778,6 +1779,7 @@ public:
stc.relative_score_difference = m_cfg.optimizer_rel_score_diff; stc.relative_score_difference = m_cfg.optimizer_rel_score_diff;
stc.stop_score = 1e6; stc.stop_score = 1e6;
GeneticOptimizer solver(stc); GeneticOptimizer solver(stc);
solver.seed(0); // we want deterministic behavior
double r_back = head.r_back_mm; double r_back = head.r_back_mm;