ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
cadical_score.cpp
Go to the documentation of this file.
1#include "global.h"
2
3#include "internal.hpp"
4
6
7namespace CaDiCaL {
8
9// This initializes variables on the binary 'scores' heap also with
10// smallest variable index first (thus picked first) and larger indices at
11// the end.
12//
13void Internal::init_scores (int old_max_var, int new_max_var) {
14 LOG ("initializing EVSIDS scores from %d to %d", old_max_var + 1,
15 new_max_var);
16 for (int i = old_max_var; i < new_max_var; i++)
17 scores.push_back (i + 1);
18}
19
20// Shuffle the EVSIDS heap.
21
23 if (!opts.shuffle)
24 return;
25 if (!opts.shufflescores)
26 return;
28 stats.shuffled++;
29 LOG ("shuffling scores");
30 vector<int> shuffle;
31 if (opts.shufflerandom) {
32 scores.erase ();
33 for (int idx = max_var; idx; idx--)
34 shuffle.push_back (idx);
35 Random random (opts.seed); // global seed
36 random += stats.shuffled; // different every time
37 for (int i = 0; i <= max_var - 2; i++) {
38 const int j = random.pick_int (i, max_var - 1);
39 swap (shuffle[i], shuffle[j]);
40 }
41 } else {
42 while (!scores.empty ()) {
43 int idx = scores.front ();
44 (void) scores.pop_front ();
45 shuffle.push_back (idx);
46 }
47 }
48 score_inc = 0;
49 for (const auto &idx : shuffle) {
50 stab[idx] = score_inc++;
51 scores.push_back (idx);
52 }
53}
54
55} // namespace CaDiCaL
56
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
#define CADICAL_assert(ignore)
Definition global.h:14
#define LOG(...)
void init_scores(int old_max_var, int new_max_var)
vector< double > stab
Definition internal.hpp:230
ScoreSchedule scores
Definition internal.hpp:229
long random()