Class: Gecode::Constraints::Bool::ExpressionTree

Inherits:
Object
  • Object
show all
Includes:
OperationMethods
Defined in:
lib/gecoder/interface/constraints/bool/boolean.rb

Overview

Describes a binary tree of expression nodes which together form a boolean expression.

Instance Method Summary collapse

Methods included from LeftHandSideMethods

#must, #must_not

Constructor Details

#initialize(left_tree, operation, right_tree) ⇒ ExpressionTree

Constructs a new expression with the specified binary operation applied to the specified trees.



219
220
221
222
223
# File 'lib/gecoder/interface/constraints/bool/boolean.rb', line 219

def initialize(left_tree, operation, right_tree)
  @left = left_tree
  @operation = operation
  @right = right_tree
end

Instance Method Details

#model ⇒ Object

Fetches the space that the expression's variables is in.



233
234
235
# File 'lib/gecoder/interface/constraints/bool/boolean.rb', line 233

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

#to_minimodel_bool_expr ⇒ Object

Returns a MiniModel boolean expression representing the tree.



226
227
228
229
230
# File 'lib/gecoder/interface/constraints/bool/boolean.rb', line 226

def to_minimodel_bool_expr
  Gecode::Raw::MiniModel::BoolExpr.new(
    @left.to_minimodel_bool_expr, @operation, 
    @right.to_minimodel_bool_expr)
end