1 /******************************************
2 Copyright (c) 2016, Mate Soos
3 
4 Permission is hereby granted, free of charge, to any person obtaining a copy
5 of this software and associated documentation files (the "Software"), to deal
6 in the Software without restriction, including without limitation the rights
7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 copies of the Software, and to permit persons to whom the Software is
9 furnished to do so, subject to the following conditions:
10 
11 The above copyright notice and this permission notice shall be included in
12 all copies or substantial portions of the Software.
13 
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 THE SOFTWARE.
21 ***********************************************/
22 
23 #include <vector>
24 #include <cstdint>
25 
26 #ifndef VARDISTGEN_H
27 #define VARDISTGEN_H
28 
29 using std::vector;
30 
31 namespace CMSat {
32 
33 class Solver;
34 class Clause;
35 
36 struct VarData2
37 {
38     struct Dat {
39         uint32_t num_times_in_bin_clause = 0;
40         uint32_t num_times_in_long_clause = 0;
41         uint32_t satisfies_cl = 0;
42         uint32_t falsifies_cl = 0;
43         uint32_t tot_num_lit_of_bin_it_appears_in =0;
44         uint32_t tot_num_lit_of_long_cls_it_appears_in = 0;
45         double sum_var_act_of_cls;
46     };
47     Dat irred;
48     Dat red;
49     double tot_act_long_red_cls;
50 };
51 
52 class VarDistGen {
53 public:
54     VarDistGen(Solver* solver);
55     void calc();
56     #ifdef STATS_NEEDED_BRANCH
57     void dump();
58     #endif
59 
60 private:
61     double compute_tot_act_vsids(Clause* cl) const;
62 
63     Solver* solver;
64     vector<VarData2> data;
65 
66 };
67 
68 }
69 
70 #endif
71