68 void Untrail(
int target_trail_index);
84 maybe_enable_phase_saving_ = save_phase;
111 if (trail_.Assignment().VariableIsAssigned(l.
Variable()))
return;
112 has_target_polarity_[l.
Variable()] =
true;
115 best_partial_assignment_.push_back(l);
119 return best_partial_assignment_;
123 has_target_polarity_.assign(has_target_polarity_.size(),
false);
124 best_partial_assignment_.clear();
138 void InitializeVariableOrdering();
141 void RescaleVariableActivities(
double scaling_factor);
145 void ResetInitialPolarity(
int from,
bool inverted =
false);
149 void RephaseIfNeeded();
150 void UseLongestAssignmentAsInitialPolarity();
151 void FlipCurrentPolarity();
152 void RandomizeCurrentPolarity();
155 bool UseLsSolutionAsInitialPolarity();
159 void PqInsertOrUpdate(BooleanVariable var);
178 struct WeightedVarQueueElement {
180 int Index()
const {
return var.value(); }
197 bool operator<(
const WeightedVarQueueElement& other)
const {
198 return weight < other.weight ||
199 (weight == other.weight && (tie_breaker < other.tie_breaker));
210 static_assert(
sizeof(WeightedVarQueueElement) == 16,
211 "ERROR_WeightedVarQueueElement_is_not_well_compacted");
213 bool var_ordering_is_initialized_ =
false;
214 IntegerPriorityQueue<WeightedVarQueueElement> var_ordering_;
223 struct NumConflictsStackEntry {
227 int64_t num_conflicts_ = 0;
228 std::vector<NumConflictsStackEntry> num_conflicts_stack_;
236 BitQueue64 pq_need_update_for_var_at_trail_index_;
239 double variable_activity_increment_ = 1.0;
243 util_intops::StrongVector<BooleanVariable, double> activities_;
244 util_intops::StrongVector<BooleanVariable, float> tie_breakers_;
245 util_intops::StrongVector<BooleanVariable, int64_t> num_bumps_;
248 util_intops::StrongVector<BooleanVariable, bool> has_forced_polarity_;
249 util_intops::StrongVector<BooleanVariable, bool> forced_polarity_;
252 bool in_stable_phase_ =
false;
253 int target_length_ = 0;
254 util_intops::StrongVector<BooleanVariable, bool> has_target_polarity_;
255 util_intops::StrongVector<BooleanVariable, bool> target_polarity_;
260 util_intops::StrongVector<BooleanVariable, bool> var_polarity_;
261 bool maybe_enable_phase_saving_ =
true;
262 int64_t polarity_phase_ = 0;
263 int64_t num_conflicts_until_rephase_ = 1000;
266 std::vector<Literal> best_partial_assignment_;
269 std::vector<BooleanVariable> tmp_variables_;