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
256 257 258 259 260 |
# File 'lib/gecoder/interface/constraints/int/linear.rb', line 256 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.
269 270 271 |
# File 'lib/gecoder/interface/constraints/int/linear.rb', line 269 def model @left.model || @right.model end |
#to_minimodel_lin_exp ⇒ Object
Converts the linear expression to an instance of Gecode::Raw::MiniModel::LinExpr
264 265 266 |
# File 'lib/gecoder/interface/constraints/int/linear.rb', line 264 def to_minimodel_lin_exp @left.to_minimodel_lin_exp.send(@operation, @right.to_minimodel_lin_exp) end |