class
ORTools::Sat::LinearExpression
- ORTools::Sat::LinearExpression
- Reference
- Object
Overview
LinearExpression class provides an expression of variables and fixed coefficients The expression is used as input to constraints that accept linear expressions
Defined in:
ortools-sat/linear-expression.crConstructors
Class Method Summary
-
.zero
Needed to allow sum of an array of LinearExpression
Instance Method Summary
- #!=(other : Expressible)
- #+(other : Expressible)
- #-(other : Expressible)
- #-
- #<(other : Expressible)
- #<=(other : Expressible)
- #==(other : Expressible)
- #>(other : Expressible)
- #>=(other : Expressible)
- #coefficients : Array(Int64)
- #constant : Int64
-
#normalize : LinearExpression
Combines duplicate variables by summing their coefficients and drops any term whose coefficient is zero; the constant is preserved.
- #proto
- #to_lexpr : LinearExpression
- #variables : Array(Int32)
Constructor Detail
def self.new(variables : Array(Int32) = [] of Int32, coefficients : Array(Int64) = [] of Int64, constant : Int64 = 0_i64)
#
Class Method Detail
Instance Method Detail
def normalize : LinearExpression
#
Combines duplicate variables by summing their coefficients and drops any
term whose coefficient is zero; the constant is preserved. Returns a new,
equivalent expression in which each variable appears at most once. This
keeps expressions like x + x from emitting a proto with repeated
variable references.