#include "internal.hpp"
namespace CaDiCaL {
void Internal::init_scores (int old_max_var, int new_max_var) {
LOG ("initializing EVSIDS scores from %d to %d", old_max_var + 1,
new_max_var);
for (int i = old_max_var; i < new_max_var; i++)
scores.push_back (i + 1);
}
void Internal::shuffle_scores () {
if (!opts.shuffle)
return;
if (!opts.shufflescores)
return;
assert (!level);
stats.shuffled++;
LOG ("shuffling scores");
vector<int> shuffle;
if (opts.shufflerandom) {
scores.erase ();
for (int idx = max_var; idx; idx--)
shuffle.push_back (idx);
Random random (opts.seed); random += stats.shuffled; for (int i = 0; i <= max_var - 2; i++) {
const int j = random.pick_int (i, max_var - 1);
swap (shuffle[i], shuffle[j]);
}
} else {
while (!scores.empty ()) {
int idx = scores.front ();
(void) scores.pop_front ();
shuffle.push_back (idx);
}
}
score_inc = 0;
for (const auto &idx : shuffle) {
stab[idx] = score_inc++;
scores.push_back (idx);
}
}
}