Class: Gecode::Constraints::SetEnum::Selection::SelectExpressionStub
- Inherits:
-
Gecode::Constraints::Set::CompositeStub
- Object
- ExpressionStub
- CompositeStub
- Gecode::Constraints::Set::CompositeStub
- Gecode::Constraints::SetEnum::Selection::SelectExpressionStub
- Defined in:
- lib/gecoder/interface/constraints/set_enum/selection.rb
Overview
Describes a CompositeStub for the set select constraint, which constrains the set in a position specified by an integer variable in an enumeration of set variable.
Examples
# The set at the position described by the integer variable
# +singleton_zero_position+ in the enumeration +sets+ of set variables
# must equal [0].
sets[singleton_zero_position].must == 0
# The set at the position described by the integer variable +position+ in
# the enumeration +sets+ of set variables must be a subset of +set+.
sets[position].must_be.subset_of set
# The same as above, but reified with the boolean variable +bool+.
sets[position].must_be.subset_of(set, :reify => bool)
Instance Method Summary collapse
Methods inherited from Gecode::Constraints::Set::CompositeStub
Methods inherited from CompositeStub
Methods included from LeftHandSideMethods
Methods inherited from ExpressionStub
Constructor Details
This class inherits a constructor from Gecode::Constraints::Set::CompositeStub
Instance Method Details
#constrain_equal(variable, params, constrain) ⇒ Object
106 107 108 109 110 111 112 113 114 |
# File 'lib/gecoder/interface/constraints/set_enum/selection.rb', line 106 def constrain_equal(variable, params, constrain) enum, index = @params.values_at(:lhs, :index) if constrain variable.must_be.subset_of enum.upper_bound_range end Gecode::Raw::selectSet(@model.active_space, enum.to_set_var_array, index.bind, variable.bind) end |