68 void Untrail(
int target_trail_index);
84 maybe_enable_phase_saving_ = save_phase;
114 return best_partial_assignment_;
120 void InitializeVariableOrdering();
123 void RescaleVariableActivities(
double scaling_factor);
127 void ResetInitialPolarity(
int from,
bool inverted =
false);
131 void RephaseIfNeeded();
132 void UseLongestAssignmentAsInitialPolarity();
133 void FlipCurrentPolarity();
134 void RandomizeCurrentPolarity();
137 bool UseLsSolutionAsInitialPolarity();
141 void PqInsertOrUpdate(BooleanVariable var);
144 const SatParameters& parameters_;
160 struct WeightedVarQueueElement {
162 int Index()
const {
return var.value(); }
179 bool operator<(
const WeightedVarQueueElement& other)
const {
180 return weight < other.weight ||
181 (weight == other.weight && (tie_breaker < other.tie_breaker));
192 static_assert(
sizeof(WeightedVarQueueElement) == 16,
193 "ERROR_WeightedVarQueueElement_is_not_well_compacted");
195 bool var_ordering_is_initialized_ =
false;
196 IntegerPriorityQueue<WeightedVarQueueElement> var_ordering_;
205 struct NumConflictsStackEntry {
209 int64_t num_conflicts_ = 0;
210 std::vector<NumConflictsStackEntry> num_conflicts_stack_;
218 BitQueue64 pq_need_update_for_var_at_trail_index_;
221 double variable_activity_increment_ = 1.0;
225 util_intops::StrongVector<BooleanVariable, double> activities_;
226 util_intops::StrongVector<BooleanVariable, float> tie_breakers_;
227 util_intops::StrongVector<BooleanVariable, int64_t> num_bumps_;
230 util_intops::StrongVector<BooleanVariable, bool> has_forced_polarity_;
231 util_intops::StrongVector<BooleanVariable, bool> forced_polarity_;
234 bool in_stable_phase_ =
false;
235 int target_length_ = 0;
236 util_intops::StrongVector<BooleanVariable, bool> has_target_polarity_;
237 util_intops::StrongVector<BooleanVariable, bool> target_polarity_;
242 util_intops::StrongVector<BooleanVariable, bool> var_polarity_;
243 bool maybe_enable_phase_saving_ =
true;
244 int64_t polarity_phase_ = 0;
245 int64_t num_conflicts_until_rephase_ = 1000;
248 std::vector<Literal> best_partial_assignment_;
251 std::vector<BooleanVariable> tmp_variables_;