Class: Gecode::Constraints::Int::Linear::ExpressionTree
- Inherits:
-
Object
- Object
- Gecode::Constraints::Int::Linear::ExpressionTree
- Includes:
- Helper
- Defined in:
- lib/gecoder/interface/constraints/int/linear.rb
Overview
Describes a binary tree of expression nodes which together form a linear expression.
Instance Method Summary collapse
-
#initialize(left_node, right_node, operation) ⇒ ExpressionTree
constructor
Constructs a new expression with the specified variable.
-
#model ⇒ Object
Fetches the space that the expression’s variables is in.
-
#to_minimodel_lin_exp ⇒ Object
Converts the linear expression to an instance of Gecode::Raw::MiniModel::LinExpr.
Methods included from LeftHandSideMethods
Constructor Details
#initialize(left_node, right_node, operation) ⇒ ExpressionTree
Constructs a new expression with the specified variable
185 186 187 188 189 |
# File 'lib/gecoder/interface/constraints/int/linear.rb', line 185 def initialize(left_node, right_node, operation) @left = left_node @right = right_node @operation = operation end |
Instance Method Details
#model ⇒ Object
Fetches the space that the expression’s variables is in.
198 199 200 |
# File 'lib/gecoder/interface/constraints/int/linear.rb', line 198 def model @left.model || @right.model end |
#to_minimodel_lin_exp ⇒ Object
Converts the linear expression to an instance of Gecode::Raw::MiniModel::LinExpr
193 194 195 |
# File 'lib/gecoder/interface/constraints/int/linear.rb', line 193 def to_minimodel_lin_exp @left.to_minimodel_lin_exp.send(@operation, @right.to_minimodel_lin_exp) end |