Class: Gecode::Constraints::IntEnum::Arithmetic::MaxExpressionStub
- Inherits:
-
Gecode::Constraints::Int::CompositeStub
- Object
- ExpressionStub
- CompositeStub
- Gecode::Constraints::Int::CompositeStub
- Gecode::Constraints::IntEnum::Arithmetic::MaxExpressionStub
- Defined in:
- lib/gecoder/interface/constraints/int_enum/arithmetic.rb
Overview
Describes a CompositeStub for the max constraint, which constrains the maximum value of the integer variables in an enumeration.
Example
# The maximum must be positive.
int_enum.max.must > 0
# The maximum must equal a integer variable +max+.
int_enum.max.must == max
# The maximum must not be negative. The constraint is reified with the
# boolean variable +is_negative+ and strength +domain+ is selected.
int_enum.max.must_not_be.less_than(0, :reify => is_negative,
:strength => :domain)
Instance Method Summary collapse
Methods inherited from Gecode::Constraints::Int::CompositeStub
Methods inherited from CompositeStub
Methods included from LeftHandSideMethods
Methods inherited from ExpressionStub
Constructor Details
This class inherits a constructor from Gecode::Constraints::Int::CompositeStub
Instance Method Details
#constrain_equal(variable, params, constrain) ⇒ Object
35 36 37 38 39 40 41 42 43 |
# File 'lib/gecoder/interface/constraints/int_enum/arithmetic.rb', line 35 def constrain_equal(variable, params, constrain) enum, strength = @params.values_at(:lhs, :strength) if constrain variable.must_be.in enum.domain_range end Gecode::Raw::max(@model.active_space, enum.to_int_var_array, variable.bind, strength) end |