Class: Gecode::Constraints::Int::Linear::ExpressionTree

Inherits:
Object
  • Object
show all
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

Methods included from LeftHandSideMethods

#must, #must_not

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

#modelObject

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_expObject

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