 |
OR-Tools
8.1
|
Go to the documentation of this file.
14 #ifndef OR_TOOLS_SAT_LINEAR_CONSTRAINT_H_
15 #define OR_TOOLS_SAT_LINEAR_CONSTRAINT_H_
42 std::vector<IntegerVariable>
vars;
61 absl::StrAppend(&result,
lb.value(),
" <= ");
63 for (
int i = 0; i <
vars.size(); ++i) {
64 const IntegerValue coeff =
66 absl::StrAppend(&result, i > 0 ?
" " :
"", coeff.value(),
"*X",
70 absl::StrAppend(&result,
" <= ",
ub.value());
76 if (this->lb != other.
lb)
return false;
77 if (this->ub != other.
ub)
return false;
78 if (this->vars != other.
vars)
return false;
79 if (this->coeffs != other.
coeffs)
return false;
97 void AddTerm(IntegerVariable
var, IntegerValue coeff);
123 std::vector<std::pair<IntegerVariable, IntegerValue>> terms_;
129 const LinearConstraint& constraint,
141 const LinearConstraint& constraint2);
159 std::vector<std::pair<IntegerVariable, IntegerValue>>* terms,
160 LinearConstraint* constraint);
174 std::vector<IntegerVariable>
vars;
212 #endif // OR_TOOLS_SAT_LINEAR_CONSTRAINT_H_
void CleanTermsAndFillConstraint(std::vector< std::pair< IntegerVariable, IntegerValue >> *terms, LinearConstraint *constraint)
double ScalarProduct(const LinearConstraint &constraint1, const LinearConstraint &constraint2)
bool VariableIsPositive(IntegerVariable i)
std::vector< IntegerVariable > vars
bool NoDuplicateVariable(const LinearConstraint &ct)
IntegerValue LinExprUpperBound(const LinearExpression &expr, const IntegerTrail &integer_trail)
The vehicle routing library lets one model and solve generic vehicle routing problems ranging from th...
std::vector< IntegerVariable > NegationOf(const std::vector< IntegerVariable > &vars)
std::string DebugString() const
void AddTerm(IntegerVariable var, IntegerValue coeff)
IntegerValue GetCoefficient(const IntegerVariable var, const LinearExpression &expr)
LinearConstraint(IntegerValue _lb, IntegerValue _ub)
double ComputeActivity(const LinearConstraint &constraint, const absl::StrongVector< IntegerVariable, double > &values)
ABSL_MUST_USE_RESULT bool AddLiteralTerm(Literal lit, IntegerValue coeff)
constexpr IntegerValue kMaxIntegerValue(std::numeric_limits< IntegerValue::ValueType >::max() - 1)
LinearExpression CanonicalizeExpr(const LinearExpression &expr)
Class that owns everything related to a particular optimization model.
LinearExpression PositiveVarExpr(const LinearExpression &expr)
IntegerValue LinExprLowerBound(const LinearExpression &expr, const IntegerTrail &integer_trail)
void MakeAllCoefficientsPositive(LinearConstraint *constraint)
IntegerValue GetCoefficientOfPositiveVar(const IntegerVariable var, const LinearExpression &expr)
double ComputeL2Norm(const LinearConstraint &constraint)
void RemoveZeroTerms(LinearConstraint *constraint)
constexpr IntegerValue kMinIntegerValue(-kMaxIntegerValue)
void MakeAllVariablesPositive(LinearConstraint *constraint)
bool operator==(const LinearConstraint other) const
std::vector< IntegerValue > coeffs
LinearConstraintBuilder(const Model *model, IntegerValue lb, IntegerValue ub)
std::vector< IntegerVariable > vars
IntegerValue ComputeInfinityNorm(const LinearConstraint &constraint)
std::vector< IntegerValue > coeffs
void DivideByGCD(LinearConstraint *constraint)
void AddConstant(IntegerValue value)
void CanonicalizeConstraint(LinearConstraint *ct)
void AddTerm(IntegerVariable var, IntegerValue coeff)