14 #ifndef OR_TOOLS_SAT_SAT_DECISION_H_
15 #define OR_TOOLS_SAT_SAT_DECISION_H_
71 void Untrail(
int target_trail_index);
87 maybe_enable_phase_saving_ = save_phase;
108 void InitializeVariableOrdering();
111 void RescaleVariableActivities(
double scaling_factor);
115 void ResetInitialPolarity(
int from,
bool inverted =
false);
119 void RephaseIfNeeded();
120 void UseLongestAssignmentAsInitialPolarity();
121 void FlipCurrentPolarity();
122 void RandomizeCurrentPolarity();
126 void PqInsertOrUpdate(BooleanVariable
var);
129 const SatParameters& parameters_;
139 struct WeightedVarQueueElement {
141 int Index()
const {
return var.value(); }
158 bool operator<(
const WeightedVarQueueElement& other)
const {
159 return weight < other.weight ||
160 (
weight == other.weight && (tie_breaker < other.tie_breaker));
171 static_assert(
sizeof(WeightedVarQueueElement) == 16,
172 "ERROR_WeightedVarQueueElement_is_not_well_compacted");
174 bool var_ordering_is_initialized_ =
false;
175 IntegerPriorityQueue<WeightedVarQueueElement> var_ordering_;
184 struct NumConflictsStackEntry {
188 int64_t num_conflicts_ = 0;
189 std::vector<NumConflictsStackEntry> num_conflicts_stack_;
197 BitQueue64 pq_need_update_for_var_at_trail_index_;
200 double variable_activity_increment_ = 1.0;
213 bool in_stable_phase_ =
false;
214 int target_length_ = 0;
222 bool maybe_enable_phase_saving_ =
true;
223 int64_t polarity_phase_ = 0;
224 int64_t num_conflicts_until_rephase_ = 1000;
227 std::vector<Literal> best_partial_assignment_;
233 std::vector<BooleanVariable> tmp_variables_;
Class that owns everything related to a particular optimization model.
std::vector< std::pair< Literal, double > > AllPreferences() const
void IncreaseNumVariables(int num_variables)
void ResetDecisionHeuristic()
void UpdateVariableActivityIncrement()
void SetStablePhase(bool is_stable)
void SetAssignmentPreference(Literal literal, double weight)
void MaybeEnablePhaseSaving(bool save_phase)
void Untrail(int target_trail_index)
void BumpVariableActivities(const std::vector< Literal > &literals)
void BeforeConflict(int trail_index)
void UpdateWeightedSign(const std::vector< LiteralWithCoeff > &terms, Coefficient rhs)
SatDecisionPolicy(Model *model)
bool InStablePhase() const
Collection of objects used to extend the Constraint Solver library.