Class: Gecode::Constraints::BoolEnum::ConjunctionStub
- Inherits:
-
Gecode::Constraints::Bool::CompositeStub
- Object
- ExpressionStub
- CompositeStub
- Gecode::Constraints::Bool::CompositeStub
- Gecode::Constraints::BoolEnum::ConjunctionStub
- Defined in:
- lib/gecoder/interface/constraints/bool_enum/boolean.rb
Overview
Describes a CompositeStub for the conjunction constraint, which constrain the conjunction of all boolean variables in an enumeration.
Example
# The conjunction of all variables in +bool_enum+ must be true. I.e. all
# boolean variables must take the value true.
bool_enum.conjunction.must_be.true
# The conjunction of all variables in +bool_enum+ must equal b1.
bool_enum.conjunction.must == b1
# The conjunction 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.conjunction.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
38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/gecoder/interface/constraints/bool_enum/boolean.rb', line 38 def constrain_equal(variable, params, constrain) enum, strength = @params.values_at(:lhs, :strength) @model.add_interaction do if variable.respond_to? :bind bound = variable.bind else bound = variable end Gecode::Raw::bool_and(@model.active_space, enum.to_bool_var_array, bound, strength) end return variable end |