5#include "scippp/var.hpp"
16 double m_constant { 0.0 };
18 std::vector<Var> m_vars {};
20 std::vector<double> m_coeffs {};
36 template <
typename Arithmetic, std::enable_if_t<std::is_arithmetic_v<Arithmetic>,
bool> = true>
38 : m_constant { static_cast<double>(constant) }
Represents a linear combination of variables plus a constant term.
LinExpr & operator*=(double factor)
Multiply all coefficients.
LinExpr(const Var &var)
Creates a linear expression with zero as constant the given variable with coefficient one.
LinExpr & operator+=(const LinExpr &expr)
Add another linear expression to this.
LinExpr(Arithmetic constant)
Creates a linear expression with no variables.
LinExpr & operator-=(const LinExpr &expr)
Subtract another expression from this.
LinExpr()=default
Sets constant term and linear combination to zero.
double getConstant() const
Returns the constant term of the expression.
A SCIP optimization model.
LinExpr operator*(double factor, LinExpr rhs)
Scales a linear expression by a factor.
LinExpr operator+(LinExpr lhs, const LinExpr &rhs)
Creates a new linear expression as the sum of two.
LinExpr operator-(LinExpr lhs, const LinExpr &rhs)
Creates the new linear expression lhs - rhs.
Wrapper for a SCIP variable.