14 #ifndef OR_TOOLS_SAT_LINEAR_CONSTRAINT_H_ 15 #define OR_TOOLS_SAT_LINEAR_CONSTRAINT_H_ 36 std::vector<IntegerVariable>
vars;
48 lb =
ub = IntegerValue(0);
60 absl::StrAppend(&result,
lb.value(),
" <= ");
62 for (
int i = 0; i <
vars.size(); ++i) {
63 absl::StrAppend(&result, i > 0 ?
" " :
"",
67 absl::StrAppend(&result,
" <= ",
ub.value());
73 if (this->lb != other.
lb)
return false;
74 if (this->ub != other.
ub)
return false;
75 if (this->vars != other.
vars)
return false;
76 if (this->coeffs != other.
coeffs)
return false;
82 os <<
ct.DebugString();
89 std::vector<IntegerVariable>
vars;
91 IntegerValue
offset = IntegerValue(0);
157 void AddTerm(IntegerVariable
var, IntegerValue coeff);
200 std::vector<std::pair<IntegerVariable, IntegerValue>> terms_;
206 const LinearConstraint& constraint,
218 const LinearConstraint& constraint2);
236 std::vector<std::pair<IntegerVariable, IntegerValue>>* terms,
237 LinearConstraint* constraint);
251 #endif // OR_TOOLS_SAT_LINEAR_CONSTRAINT_H_
IntegerValue GetCoefficient(const IntegerVariable var, const LinearExpression &expr)
void AddTerm(IntegerVariable var, IntegerValue coeff)
double ComputeL2Norm(const LinearConstraint &constraint)
IntegerValue LinExprLowerBound(const LinearExpression &expr, const IntegerTrail &integer_trail)
Class that owns everything related to a particular optimization model.
std::vector< IntegerValue > coeffs
constexpr IntegerValue kMinIntegerValue(-kMaxIntegerValue)
void CleanTermsAndFillConstraint(std::vector< std::pair< IntegerVariable, IntegerValue >> *terms, LinearConstraint *constraint)
void AddLinearExpression(const LinearExpression &expr)
std::string IntegerTermDebugString(IntegerVariable var, IntegerValue coeff)
LinearExpression PositiveVarExpr(const LinearExpression &expr)
void AddTerm(IntegerVariable var, IntegerValue coeff)
ABSL_MUST_USE_RESULT bool AddLiteralTerm(Literal lit, IntegerValue coeff)
LinearConstraintBuilder(const Model *model, IntegerValue lb, IntegerValue ub)
void MakeAllCoefficientsPositive(LinearConstraint *constraint)
double LpValue(const absl::StrongVector< IntegerVariable, double > &lp_values) const
constexpr IntegerValue kMaxIntegerValue(std::numeric_limits< IntegerValue::ValueType >::max() - 1)
std::vector< IntegerValue > coeffs
LinearExpression CanonicalizeExpr(const LinearExpression &expr)
double ComputeActivity(const LinearConstraint &constraint, const absl::StrongVector< IntegerVariable, double > &values)
std::vector< IntegerVariable > vars
std::vector< IntegerVariable > vars
void DivideByGCD(LinearConstraint *constraint)
IntegerValue ComputeInfinityNorm(const LinearConstraint &constraint)
LinearConstraint(IntegerValue _lb, IntegerValue _ub)
std::string DebugString() const
bool operator==(const LinearConstraint other) const
bool ValidateLinearConstraintForOverflow(const LinearConstraint &constraint, const IntegerTrail &integer_trail)
double ScalarProduct(const LinearConstraint &constraint1, const LinearConstraint &constraint2)
IntegerValue LinExprUpperBound(const LinearExpression &expr, const IntegerTrail &integer_trail)
std::vector< IntegerVariable > NegationOf(const std::vector< IntegerVariable > &vars)
void CanonicalizeConstraint(LinearConstraint *ct)
void AddConstant(IntegerValue value)
Collection of objects used to extend the Constraint Solver library.
std::ostream & operator<<(std::ostream &os, const BoolVar &var)
void MakeAllVariablesPositive(LinearConstraint *constraint)
std::string DebugString() const
void RemoveZeroTerms(LinearConstraint *constraint)
void AddQuadraticLowerBound(AffineExpression left, AffineExpression right, IntegerTrail *integer_trail)
IntegerValue GetCoefficientOfPositiveVar(const IntegerVariable var, const LinearExpression &expr)
bool NoDuplicateVariable(const LinearConstraint &ct)