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 #ifndef __VARDATA_H__
24 #define __VARDATA_H__
25 
26 #include "constants.h"
27 #include "propby.h"
28 #include "avgcalc.h"
29 
30 namespace CMSat
31 {
32 
33 struct VarData
34 {
35     ///contains the decision level at which the assignment was made.
36     uint32_t level = 0;
37 
38     uint32_t maple_cancelled = 0;
39     uint32_t maple_last_picked = 0;
40     uint32_t maple_conflicted = 0;
41     #ifdef WEIGHTED_SAMPLING
42     double weight = 0.5;
43     #endif
44 
45     //Reason this got propagated. NULL means decision/toplevel
46     PropBy reason = PropBy();
47 
48     lbool assumption = l_Undef;
49 
50     ///Whether var has been eliminated (var-elim, different component, etc.)
51     Removed removed = Removed::none;
52 
53     ///The preferred polarity of each variable.
54     bool polarity = false;
55     bool best_polarity = false;
56     bool is_bva = false;
57     #if defined(STATS_NEEDED_BRANCH) || defined(FINAL_PREDICTOR_BRANCH)
58     uint32_t set = 0;
59     uint64_t num_propagated = 0;
60     uint64_t num_propagated_pos = 0;
61     uint64_t num_decided = 0;
62     uint64_t num_decided_pos = 0;
63     bool     last_time_set_was_dec;
64     uint32_t last_seen_in_1uip = 0;
65     uint32_t last_decided_on = 0;
66     uint32_t last_propagated = 0;
67     uint32_t last_canceled = 0;
68 
69     //these are per-solver data
70     uint64_t sumDecisions_at_picktime = 0;
71     uint64_t sumConflicts_at_picktime = 0;
72     uint64_t sumPropagations_at_picktime = 0;
73     uint64_t sumAntecedents_at_picktime = 0;
74     uint64_t sumAntecedentsLits_at_picktime = 0;
75     uint64_t sumConflictClauseLits_at_picktime = 0;
76     uint64_t sumDecisionBasedCl_at_picktime = 0;
77     uint64_t sumClLBD_at_picktime = 0;
78     uint64_t sumClSize_at_picktime = 0;
79 
80     uint64_t sumDecisions_below_during = 0;
81     uint64_t sumConflicts_below_during = 0;
82     uint64_t sumPropagations_below_during = 0;
83     uint64_t sumAntecedents_below_during = 0;
84     uint64_t sumAntecedentsLits_below_during = 0;
85     uint64_t sumConflictClauseLits_below_during = 0;
86     uint64_t sumDecisionBasedCl_below_during = 0;
87     uint64_t sumClLBD_below_during = 0;
88     uint64_t sumClSize_below_during = 0;
89 
90     //these are per-variable data
91     uint64_t inside_conflict_clause = 0;
92     uint64_t inside_conflict_clause_glue = 0;
93     uint64_t inside_conflict_clause_antecedents = 0;
94 
95     uint64_t inside_conflict_clause_at_picktime = 0;
96     uint64_t inside_conflict_clause_glue_at_picktime = 0;
97     uint64_t inside_conflict_clause_antecedents_at_picktime = 0;
98 
99     uint64_t inside_conflict_clause_during = 0;
100     uint64_t inside_conflict_clause_glue_during = 0;
101     uint64_t inside_conflict_clause_antecedents_during = 0;
102 
103     uint64_t last_flipped = 0;
104     bool dump;
105     #endif
106 };
107 
108 }
109 
110 #endif //__VARDATA_H__
111