14#ifndef OR_TOOLS_SAT_LINEAR_CONSTRAINT_H_
15#define OR_TOOLS_SAT_LINEAR_CONSTRAINT_H_
43 std::vector<IntegerVariable>
vars;
62 absl::StrAppend(&result,
lb.value(),
" <= ");
64 for (
int i = 0; i <
vars.size(); ++i) {
65 const IntegerValue coeff =
67 absl::StrAppend(&result, i > 0 ?
" " :
"", coeff.value(),
"*X",
71 absl::StrAppend(&result,
" <= ",
ub.value());
77 if (this->lb != other.
lb)
return false;
78 if (this->ub != other.
ub)
return false;
79 if (this->vars != other.
vars)
return false;
80 if (this->coeffs != other.
coeffs)
return false;
98 void AddTerm(IntegerVariable
var, IntegerValue coeff);
124 std::vector<std::pair<IntegerVariable, IntegerValue>> terms_;
130 const LinearConstraint& constraint,
142 const LinearConstraint& constraint2);
160 std::vector<std::pair<IntegerVariable, IntegerValue>>* terms,
161 LinearConstraint* constraint);
175 std::vector<IntegerVariable>
vars;
ABSL_MUST_USE_RESULT bool AddLiteralTerm(Literal lit, IntegerValue coeff)
void AddConstant(IntegerValue value)
LinearConstraintBuilder(const Model *model, IntegerValue lb, IntegerValue ub)
void AddTerm(IntegerVariable var, IntegerValue coeff)
Class that owns everything related to a particular optimization model.
void CleanTermsAndFillConstraint(std::vector< std::pair< IntegerVariable, IntegerValue > > *terms, LinearConstraint *constraint)
bool VariableIsPositive(IntegerVariable i)
IntegerValue LinExprLowerBound(const LinearExpression &expr, const IntegerTrail &integer_trail)
constexpr IntegerValue kMinIntegerValue(-kMaxIntegerValue)
void RemoveZeroTerms(LinearConstraint *constraint)
LinearExpression PositiveVarExpr(const LinearExpression &expr)
double ScalarProduct(const LinearConstraint &constraint1, const LinearConstraint &constraint2)
void MakeAllCoefficientsPositive(LinearConstraint *constraint)
LinearExpression CanonicalizeExpr(const LinearExpression &expr)
void CanonicalizeConstraint(LinearConstraint *ct)
bool NoDuplicateVariable(const LinearConstraint &ct)
double ComputeL2Norm(const LinearConstraint &constraint)
IntegerValue GetCoefficient(const IntegerVariable var, const LinearExpression &expr)
void MakeAllVariablesPositive(LinearConstraint *constraint)
std::vector< IntegerVariable > NegationOf(const std::vector< IntegerVariable > &vars)
IntegerValue GetCoefficientOfPositiveVar(const IntegerVariable var, const LinearExpression &expr)
IntegerValue ComputeInfinityNorm(const LinearConstraint &constraint)
IntegerValue LinExprUpperBound(const LinearExpression &expr, const IntegerTrail &integer_trail)
void DivideByGCD(LinearConstraint *constraint)
double ComputeActivity(const LinearConstraint &constraint, const absl::StrongVector< IntegerVariable, double > &values)
constexpr IntegerValue kMaxIntegerValue(std::numeric_limits< IntegerValue::ValueType >::max() - 1)
The vehicle routing library lets one model and solve generic vehicle routing problems ranging from th...
std::vector< IntegerValue > coeffs
bool operator==(const LinearConstraint other) const
std::vector< IntegerVariable > vars
std::string DebugString() const
LinearConstraint(IntegerValue _lb, IntegerValue _ub)
void AddTerm(IntegerVariable var, IntegerValue coeff)
std::vector< IntegerValue > coeffs
std::vector< IntegerVariable > vars