Class: Gecode::Constraints::BoolEnum::DisjunctionStub
- Inherits:
-
Gecode::Constraints::Bool::CompositeStub
- Object
- ExpressionStub
- CompositeStub
- Gecode::Constraints::Bool::CompositeStub
- Gecode::Constraints::BoolEnum::DisjunctionStub
- Defined in:
- lib/gecoder/interface/constraints/bool_enum/boolean.rb
Overview
Describes a CompositeStub for the disjunction constraint, which constrain the disjunction of all boolean variables in an enumeration.
Example
# The disjunction of all variables in +bool_enum+ must be true. I.e. at
# least one of the boolean variables must take the value true.
bool_enum.disjunction.must_be.true
# The disjunction of all variables in +bool_enum+ must equal b1.
bool_enum.conjunction.must == b1
# The disjunction of all variables in +bool_enum+ must not equal b1 and
# b2. It's reified it with +bool+ and selects the strength +domain+.
bool_enum.disjunction.must_not.equal(b1 & b2, :reify => bool,
:strength => :domain)
Instance Method Summary collapse
Methods inherited from Gecode::Constraints::Bool::CompositeStub
Methods inherited from CompositeStub
Methods included from LeftHandSideMethods
Methods inherited from ExpressionStub
Constructor Details
This class inherits a constructor from Gecode::Constraints::Bool::CompositeStub
Instance Method Details
#constrain_equal(variable, params, constrain) ⇒ Object
71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/gecoder/interface/constraints/bool_enum/boolean.rb', line 71 def constrain_equal(variable, params, constrain) enum, strength = @params.values_at(:lhs, :strength) if variable.respond_to? :bind bound = variable.bind else bound = variable end Gecode::Raw::bool_or(@model.active_space, enum.to_bool_var_array, bound, strength) end |