Class: Gecode::Bool::BooleanConstraint
- Inherits:
-
ReifiableConstraint
- Object
- Constraint
- ReifiableConstraint
- Gecode::Bool::BooleanConstraint
- Defined in:
- lib/gecoder/interface/constraints/bool/boolean.rb
Overview
:nodoc:
Instance Method Summary collapse
Methods inherited from ReifiableConstraint
#&, #reification_var, #reification_var=, #|
Methods inherited from Constraint
Constructor Details
This class inherits a constructor from Gecode::Constraint
Instance Method Details
#post ⇒ Object
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
# File 'lib/gecoder/interface/constraints/bool/boolean.rb', line 137 def post lhs, rhs, negate, reif_var = @params.values_at(:lhs, :rhs, :negate, :reif) if lhs.respond_to? :to_bool_var lhs = ExpressionNode.new(lhs, @model) end space = (lhs.model || rhs.model).active_space bot_eqv = Gecode::Raw::IRT_EQ bot_xor = Gecode::Raw::IRT_NQ if rhs.respond_to? :to_minimodel_bool_expr if reif_var.nil? tree = ExpressionTree.new(lhs, :==, rhs) tree.to_minimodel_bool_expr.post(space, !negate, *) else tree = ExpressionTree.new(lhs, :==, rhs) var = tree.to_minimodel_bool_expr.post(space, *) Gecode::Raw::rel(space, var, (negate ? bot_xor : bot_eqv), reif_var.to_bool_var.bind, *) end else should_hold = !negate & rhs if reif_var.nil? lhs.to_minimodel_bool_expr.post(space, should_hold, *) else var = lhs.to_minimodel_bool_expr.post(space, *) Gecode::Raw::rel(space, var, (should_hold ? bot_eqv : bot_xor), reif_var.to_bool_var.bind, *) end end end |