14#ifndef OR_TOOLS_SAT_PSEUDO_COSTS_H_
15#define OR_TOOLS_SAT_PSEUDO_COSTS_H_
21#include "absl/log/check.h"
28#include "ortools/sat/sat_parameters.pb.h"
60 CHECK_LT(
var, pseudo_costs_.size());
61 return pseudo_costs_[
var].CurrentAverage();
67 CHECK_LT(
var, pseudo_costs_.size());
68 return pseudo_costs_[
var].NumRecords();
72 double CombineScores(
double down_branch,
double up_branch)
const;
88 absl::Span<const double> lp_values);
93 IntegerValue objective_increase);
104 Literal decision, absl::Span<const double> lp_values);
108 struct ObjectiveInfo {
109 std::string DebugString()
const;
113 double lp_bound = -std::numeric_limits<double>::infinity();
114 bool lp_at_optimal =
false;
116 ObjectiveInfo GetCurrentObjectiveInfo();
119 const SatParameters& parameters_;
127 ObjectiveInfo saved_info_;
128 std::vector<VariableBoundChange> bound_changes_;
131 std::vector<IntegerVariable> relevant_variables_;
138 average_unit_objective_increase_;
A class that stores the collection of all LP constraints in a model.
PseudoCosts(Model *model)
void AfterTakingDecision(bool conflict=false)
double CombineScores(double down_branch, double up_branch) const
Combines the score of the two branch into one score.
int GetNumRecords(IntegerVariable var) const
void UpdateBoolPseudoCosts(absl::Span< const Literal > reason, IntegerValue objective_increase)
void BeforeTakingDecision(Literal decision)
IntegerVariable GetBestDecisionVar()
Returns the variable with best reliable pseudo cost that is not fixed.
BranchingInfo EvaluateVar(IntegerVariable var, absl::Span< const double > lp_values)
double BoolPseudoCost(Literal lit, double lp_value) const
std::vector< VariableBoundChange > GetBoundChanges(Literal decision, absl::Span< const double > lp_values)
double ObjectiveIncrease(bool conflict)
void SaveBoundChanges(Literal decision, absl::Span< const double > lp_values)
double GetCost(IntegerVariable var) const
Returns the pseudo cost of given variable. Currently used for testing only.
constexpr IntegerValue kMaxIntegerValue(std::numeric_limits< IntegerValue::ValueType >::max() - 1)
constexpr IntegerValue kMinIntegerValue(-kMaxIntegerValue.value())
const IntegerVariable kNoIntegerVariable(-1)
In SWIG mode, we don't want anything besides these top-level includes.
double down_fractionality
IntegerLiteral down_branch
IntegerValue lower_bound_change