class Gecode::Bool::ExpressionTree
Describes a binary tree of expression nodes which together form a boolean expression.
Constants
- OPERATION_TYPES
Maps the names of the methods to the corresponding bool constraint in Gecode.
Public Instance Methods
model()
click to toggle source
Fetches the space that the expression’s variables is in.
# File doc/tmp/rdoc_dev/gecoder/interface/constraints/bool/boolean.rb, line 210 def model @left.model || @right.model end
to_bool_var()
click to toggle source
# File doc/tmp/rdoc_dev/gecoder/interface/constraints/bool/boolean.rb, line 214 def to_bool_var bool_var = model.bool_var tree = ExpressionTree.new(self, :==, ExpressionNode.new(bool_var)) model.add_interaction do tree.to_minimodel_bool_expr.post(model.active_space, true, Gecode::Raw::ICL_DEF, Gecode::Raw::PK_DEF) end return bool_var end
to_minimodel_bool_expr()
click to toggle source
Returns a MiniModel boolean expression representing the tree.
# File doc/tmp/rdoc_dev/gecoder/interface/constraints/bool/boolean.rb, line 203 def to_minimodel_bool_expr Gecode::Raw::MiniModel::BoolExpr.new( @left.to_minimodel_bool_expr, OPERATION_TYPES[@operation], @right.to_minimodel_bool_expr) end
Public Class Methods
new(left_tree, operation, right_tree)
click to toggle source
Constructs a new expression with the specified binary operation applied to the specified trees.
# File doc/tmp/rdoc_dev/gecoder/interface/constraints/bool/boolean.rb, line 196 def initialize(left_tree, operation, right_tree) @left = left_tree @operation = operation @right = right_tree end