class Gecode::Bool::Linear::ExpressionTree
Describes a binary tree of expression nodes which together form a linear expression.
Attributes
model[R]
Public Instance Methods
construct_receiver(params)
click to toggle source
# File doc/tmp/rdoc_dev/gecoder/interface/constraints/bool/linear.rb, line 140 def construct_receiver(params) receiver = pre_bool_construct_receiver(params) lhs = self receiver.instance_eval{ @lhs = lhs } class <<receiver alias_method :pre_bool_equality, :== def ==(op, options = {}) if op.respond_to? :to_bool_var (@lhs - op).must.equal(0, options) else pre_bool_equality(op, options) end end alias_comparison_methods end return receiver end
Also aliased as: pre_bool_construct_receiver
relation_constraint(relation, bool_operand_or_fix, params)
click to toggle source
# File doc/tmp/rdoc_dev/gecoder/interface/constraints/bool/linear.rb, line 158 def relation_constraint(relation, bool_operand_or_fix, params) unless params[:negate] relation_type = Gecode::Util::RELATION_TYPES[relation] else relation_type = Gecode::Util::NEGATED_RELATION_TYPES[relation] end unless bool_operand_or_fix.respond_to? :to_minimodel_lin_exp bool_operand_or_fix = Linear::ExpressionNode.new(bool_operand_or_fix); end params.update(:rhs => bool_operand_or_fix, :relation_type => relation_type) LinearRelationConstraint.new(model, params) end
to_minimodel_lin_exp()
click to toggle source
Converts the linear expression to an instance of Gecode::Raw::MiniModel::LinExpr
# File doc/tmp/rdoc_dev/gecoder/interface/constraints/bool/linear.rb, line 135 def to_minimodel_lin_exp @left.to_minimodel_lin_exp.send(@operation, @right.to_minimodel_lin_exp) end
Public Class Methods
new(left_node, right_node, operation)
click to toggle source
Constructs a new expression with the specified operands.
Calls superclass method
Gecode::Int::ShortCircuitRelationsOperand.new
# File doc/tmp/rdoc_dev/gecoder/interface/constraints/bool/linear.rb, line 125 def initialize(left_node, right_node, operation) super(left_node.model || right_node.model) @left = left_node @right = right_node @operation = operation @model = @left.model || @right.model end