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



254
255
256
257
258
# File 'lib/gecoder/interface/constraints/int/linear.rb', line 254

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.



267
268
269
# File 'lib/gecoder/interface/constraints/int/linear.rb', line 267

def model
  @left.model || @right.model
end

#to_minimodel_lin_expObject

Converts the linear expression to an instance of Gecode::Raw::MiniModel::LinExpr



262
263
264
# File 'lib/gecoder/interface/constraints/int/linear.rb', line 262

def to_minimodel_lin_exp
  @left.to_minimodel_lin_exp.send(@operation, @right.to_minimodel_lin_exp)
end