Class: Gecode::Constraints::BoolEnum::Extensional::RegexpConstraint

Inherits:
Constraint
  • Object
show all
Defined in:
lib/gecoder/interface/constraints/bool_enum/extensional.rb

Overview

Describes a regexp constraint, which constrains the enumeration of boolean variables to match a specified regexp in the boolean domain. Neither negation nor reification is supported.

The regular expressions are specified as described in IntEnum::Extensional::RegexpConstraint but true and false can be used instead of integers.

Example

# Constrains the two boolean variables in +bools+ to be false
# and true respectively.
bools.must.match [false, true]

# Constrains the boolean variables in +bools+ to be false,
# except for three consecutive variables which should be true
# followed by false followed by true.
bools.must.match [repeat(false), true, false, true, repeat(false)]]

Instance Method Summary collapse

Methods inherited from Constraint

#initialize

Constructor Details

This class inherits a constructor from Gecode::Constraints::Constraint

Instance Method Details

#postObject



105
106
107
108
109
# File 'lib/gecoder/interface/constraints/bool_enum/extensional.rb', line 105

def post
  lhs, regexp = @params.values_at(:lhs, :regexp)
  Gecode::Raw::extensional(@model.active_space, lhs.to_bool_var_array, 
    regexp, *propagation_options)
end