gecoder-with-gecode 0.7.1-mswin32 → 0.8.0-mswin32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. data/CHANGES +7 -0
  2. data/README +10 -1
  3. data/lib/gecode.dll +0 -0
  4. data/lib/gecoder/bindings/bindings.rb +407 -731
  5. data/lib/gecoder/interface/binding_changes.rb +1 -1
  6. data/lib/gecoder/interface/branch.rb +25 -25
  7. data/lib/gecoder/interface/constraints.rb +47 -4
  8. data/lib/gecoder/interface/constraints/bool/boolean.rb +18 -16
  9. data/lib/gecoder/interface/constraints/bool_enum/boolean.rb +13 -11
  10. data/lib/gecoder/interface/constraints/int/arithmetic.rb +5 -4
  11. data/lib/gecoder/interface/constraints/int/domain.rb +8 -9
  12. data/lib/gecoder/interface/constraints/int/linear.rb +10 -8
  13. data/lib/gecoder/interface/constraints/int_enum/arithmetic.rb +4 -4
  14. data/lib/gecoder/interface/constraints/int_enum/channel.rb +2 -2
  15. data/lib/gecoder/interface/constraints/int_enum/count.rb +4 -5
  16. data/lib/gecoder/interface/constraints/int_enum/distinct.rb +7 -2
  17. data/lib/gecoder/interface/constraints/int_enum/element.rb +2 -2
  18. data/lib/gecoder/interface/constraints/int_enum/equality.rb +6 -3
  19. data/lib/gecoder/interface/constraints/int_enum/sort.rb +17 -5
  20. data/lib/gecoder/interface/constraints/set_enum/distinct.rb +0 -36
  21. data/lib/gecoder/interface/constraints/set_var_constraints.rb +5 -0
  22. data/lib/gecoder/interface/model.rb +3 -3
  23. data/lib/gecoder/interface/search.rb +5 -4
  24. data/lib/gecoder/version.rb +1 -1
  25. data/specs/branch.rb +27 -27
  26. data/specs/constraints/arithmetic.rb +48 -30
  27. data/specs/constraints/bool_enum.rb +39 -19
  28. data/specs/constraints/boolean.rb +10 -10
  29. data/specs/constraints/cardinality.rb +12 -9
  30. data/specs/constraints/channel.rb +6 -6
  31. data/specs/constraints/connection.rb +22 -26
  32. data/specs/constraints/constraint_helper.rb +125 -41
  33. data/specs/constraints/count.rb +22 -15
  34. data/specs/constraints/distinct.rb +10 -64
  35. data/specs/constraints/element.rb +14 -12
  36. data/specs/constraints/equality.rb +4 -4
  37. data/specs/constraints/int_domain.rb +8 -7
  38. data/specs/constraints/int_relation.rb +12 -8
  39. data/specs/constraints/linear.rb +4 -4
  40. data/specs/constraints/reification_sugar.rb +22 -4
  41. data/specs/constraints/selection.rb +2 -2
  42. data/specs/constraints/set_domain.rb +7 -3
  43. data/specs/constraints/set_operation.rb +2 -2
  44. data/specs/constraints/set_relation.rb +2 -6
  45. data/specs/constraints/sort.rb +20 -16
  46. data/specs/model.rb +4 -4
  47. data/tasks/dependencies.txt +21 -0
  48. data/tasks/distribution.rake +13 -5
  49. data/vendor/gecode/win32/lib/libgecodeint.dll +0 -0
  50. data/vendor/gecode/win32/lib/libgecodekernel.dll +0 -0
  51. data/vendor/gecode/win32/lib/libgecodeminimodel.dll +0 -0
  52. data/vendor/gecode/win32/lib/libgecodesearch.dll +0 -0
  53. data/vendor/gecode/win32/lib/libgecodeset.dll +0 -0
  54. data/vendor/gecode/win32/lib/libgecodesupport.dll +0 -0
  55. data/vendor/rust/include/rust_checks.hh +2 -1
  56. data/vendor/rust/include/rust_conversions.hh +2 -2
  57. data/vendor/rust/rust/attribute.rb +2 -2
  58. data/vendor/rust/rust/class.rb +2 -2
  59. data/vendor/rust/rust/cxxclass.rb +0 -2
  60. data/vendor/rust/rust/function.rb +2 -2
  61. data/vendor/rust/rust/templates/AttributeDefinition.rusttpl +1 -1
  62. data/vendor/rust/rust/templates/StandaloneClassDeclarations.rusttpl +1 -1
  63. data/vendor/rust/rust/templates/VariableFunctionCall.rusttpl +1 -1
  64. data/vendor/rust/rust/type.rb +1 -1
  65. metadata +4 -3
  66. data/tasks/building.howto +0 -65
@@ -274,7 +274,7 @@ module Gecode
274
274
  grow(@next_index + count) # See the design note for more information.
275
275
 
276
276
  if cardinality_range.nil?
277
- cardinality_range = 0..Gecode::Raw::Limits::Set::CARD_MAX
277
+ cardinality_range = 0..Gecode::Raw::SetLimits::CARD
278
278
  end
279
279
 
280
280
  params = [@space]
@@ -81,44 +81,44 @@ module Gecode
81
81
  # Maps the names of the supported variable branch strategies for integer and
82
82
  # booleans to the corresponding constant in Gecode.
83
83
  BRANCH_INT_VAR_CONSTANTS = {
84
- :none => Gecode::Raw::BVAR_NONE,
85
- :smallest_min => Gecode::Raw::BVAR_MIN_MIN,
86
- :largest_min => Gecode::Raw::BVAR_MIN_MAX,
87
- :smallest_max => Gecode::Raw::BVAR_MAX_MIN,
88
- :largest_max => Gecode::Raw::BVAR_MAX_MAX,
89
- :smallest_size => Gecode::Raw::BVAR_SIZE_MIN,
90
- :largest_size => Gecode::Raw::BVAR_SIZE_MAX,
91
- :smallest_degree => Gecode::Raw::BVAR_DEGREE_MIN,
92
- :largest_degree => Gecode::Raw::BVAR_DEGREE_MAX,
93
- :smallest_min_regret => Gecode::Raw::BVAR_REGRET_MIN_MIN,
94
- :largest_min_regret => Gecode::Raw::BVAR_REGRET_MIN_MAX,
95
- :smallest_max_regret => Gecode::Raw::BVAR_REGRET_MAX_MIN,
96
- :largest_max_regret => Gecode::Raw::BVAR_REGRET_MAX_MAX
84
+ :none => Gecode::Raw::INT_VAR_NONE,
85
+ :smallest_min => Gecode::Raw::INT_VAR_MIN_MIN,
86
+ :largest_min => Gecode::Raw::INT_VAR_MIN_MAX,
87
+ :smallest_max => Gecode::Raw::INT_VAR_MAX_MIN,
88
+ :largest_max => Gecode::Raw::INT_VAR_MAX_MAX,
89
+ :smallest_size => Gecode::Raw::INT_VAR_SIZE_MIN,
90
+ :largest_size => Gecode::Raw::INT_VAR_SIZE_MAX,
91
+ :smallest_degree => Gecode::Raw::INT_VAR_DEGREE_MIN,
92
+ :largest_degree => Gecode::Raw::INT_VAR_DEGREE_MAX,
93
+ :smallest_min_regret => Gecode::Raw::INT_VAR_REGRET_MIN_MIN,
94
+ :largest_min_regret => Gecode::Raw::INT_VAR_REGRET_MIN_MAX,
95
+ :smallest_max_regret => Gecode::Raw::INT_VAR_REGRET_MAX_MIN,
96
+ :largest_max_regret => Gecode::Raw::INT_VAR_REGRET_MAX_MAX
97
97
  }
98
98
  # Maps the names of the supported variable branch strategies for sets to
99
99
  # the corresponding constant in Gecode.
100
100
  BRANCH_SET_VAR_CONSTANTS = { #:nodoc:
101
- :none => Gecode::Raw::SETBVAR_NONE,
102
- :smallest_cardinality => Gecode::Raw::SETBVAR_MIN_CARD,
103
- :largest_cardinality => Gecode::Raw::SETBVAR_MAX_CARD,
104
- :smallest_unknown => Gecode::Raw::SETBVAR_MIN_UNKNOWN_ELEM,
105
- :largest_unknown => Gecode::Raw::SETBVAR_MAX_UNKNOWN_ELEM
101
+ :none => Gecode::Raw::SET_VAR_NONE,
102
+ :smallest_cardinality => Gecode::Raw::SET_VAR_MIN_CARD,
103
+ :largest_cardinality => Gecode::Raw::SET_VAR_MAX_CARD,
104
+ :smallest_unknown => Gecode::Raw::SET_VAR_MIN_UNKNOWN_ELEM,
105
+ :largest_unknown => Gecode::Raw::SET_VAR_MAX_UNKNOWN_ELEM
106
106
  }
107
107
 
108
108
  # Maps the names of the supported value branch strategies for integers and
109
109
  # booleans to the corresponding constant in Gecode.
110
110
  BRANCH_INT_VALUE_CONSTANTS = { #:nodoc:
111
- :min => Gecode::Raw::BVAL_MIN,
112
- :med => Gecode::Raw::BVAL_MED,
113
- :max => Gecode::Raw::BVAL_MAX,
114
- :split_min => Gecode::Raw::BVAL_SPLIT_MIN,
115
- :split_max => Gecode::Raw::BVAL_SPLIT_MAX
111
+ :min => Gecode::Raw::INT_VAL_MIN,
112
+ :med => Gecode::Raw::INT_VAL_MED,
113
+ :max => Gecode::Raw::INT_VAL_MAX,
114
+ :split_min => Gecode::Raw::INT_VAL_SPLIT_MIN,
115
+ :split_max => Gecode::Raw::INT_VAL_SPLIT_MAX
116
116
  }
117
117
  # Maps the names of the supported value branch strategies for sets to the
118
118
  # corresponding constant in Gecode.
119
119
  BRANCH_SET_VALUE_CONSTANTS = { #:nodoc:
120
- :min => Gecode::Raw::SETBVAL_MIN,
121
- :max => Gecode::Raw::SETBVAL_MAX
120
+ :min => Gecode::Raw::SET_VAL_MIN,
121
+ :max => Gecode::Raw::SET_VAL_MAX
122
122
  }
123
123
  end
124
124
 
@@ -44,6 +44,14 @@ module Gecode
44
44
  :domain => Gecode::Raw::ICL_DOM
45
45
  }
46
46
 
47
+ # Maps the name used in options to the value used in Gecode for
48
+ # propagation kinds.
49
+ PROPAGATION_KINDS = {
50
+ :default => Gecode::Raw::PK_DEF,
51
+ :speed => Gecode::Raw::PK_SPEED,
52
+ :memory => Gecode::Raw::PK_MEMORY,
53
+ }
54
+
47
55
  # Maps the names of the methods to the corresponding integer relation
48
56
  # type in Gecode.
49
57
  RELATION_TYPES = {
@@ -103,9 +111,10 @@ module Gecode
103
111
 
104
112
  module_function
105
113
 
106
- # Decodes the common options to constraints: strength and reification.
107
- # Returns a hash with up to two values. :strength is the strength that
108
- # should be used for the constraint and :reif is the (bound) boolean
114
+ # Decodes the common options to constraints: strength, kind and
115
+ # reification. Returns a hash with up to three values. :strength is the
116
+ # strength that should be used for the constraint, :kind is the
117
+ # propagation kind that should be used, and :reif is the (bound) boolean
109
118
  # variable that should be used for reification. The decoded options are
110
119
  # removed from the hash (so in general the hash will be consumed in the
111
120
  # process).
@@ -120,6 +129,12 @@ module Gecode
120
129
  raise ArgumentError, "Unrecognized propagation strength #{strength}."
121
130
  end
122
131
 
132
+ # Propagation kind.
133
+ kind = options.delete(:kind) || :default
134
+ unless PROPAGATION_KINDS.include? kind
135
+ raise ArgumentError, "Unrecognized propagation kind #{kind}."
136
+ end
137
+
123
138
  # Reification.
124
139
  reif_var = options.delete(:reify)
125
140
  unless reif_var.nil? or reif_var.kind_of? FreeBoolVar
@@ -131,7 +146,11 @@ module Gecode
131
146
  raise ArgumentError, 'Unrecognized constraint option: ' +
132
147
  options.keys.first.to_s
133
148
  end
134
- return {:strength => PROPAGATION_STRENGTHS[strength], :reif => reif_var}
149
+ return {
150
+ :strength => PROPAGATION_STRENGTHS[strength],
151
+ :kind => PROPAGATION_KINDS[kind],
152
+ :reif => reif_var
153
+ }
135
154
  end
136
155
 
137
156
  # Converts the different ways to specify constant sets in the interface
@@ -188,6 +207,14 @@ module Gecode
188
207
  (expression.kind_of?(Enumerable) && # It's an enum of fixnums.
189
208
  expression.all?{ |e| e.kind_of? Fixnum })
190
209
  end
210
+
211
+ # Extracts an array of the values selected for the standard propagation
212
+ # options (propagation strength and propagation kind) from the hash of
213
+ # parameters given. The options are returned in the order that they are
214
+ # given when posting constraints to Gecode.
215
+ def extract_propagation_options(params)
216
+ params.values_at(:strength, :kind)
217
+ end
191
218
  end
192
219
 
193
220
  # Describes a constraint expressions. An expression is produced by calling
@@ -368,6 +395,13 @@ module Gecode
368
395
  constrain_equal(var, params, constrain)
369
396
  end
370
397
  end
398
+
399
+ # Gives an array of the values selected for the standard propagation
400
+ # options (propagation strength and propagation kind) in the order that
401
+ # they are given when posting constraints to Gecode.
402
+ def propagation_options
403
+ Gecode::Constraints::Util::extract_propagation_options(@params)
404
+ end
371
405
  end
372
406
 
373
407
  # Base class for all constraints.
@@ -384,6 +418,15 @@ module Gecode
384
418
  def post
385
419
  raise NoMethodError, 'Abstract method has not been implemented.'
386
420
  end
421
+
422
+ private
423
+
424
+ # Gives an array of the values selected for the standard propagation
425
+ # options (propagation strength and propagation kind) in the order that
426
+ # they are given when posting constraints to Gecode.
427
+ def propagation_options
428
+ Gecode::Constraints::Util::extract_propagation_options(@params)
429
+ end
387
430
  end
388
431
  end
389
432
  end
@@ -126,8 +126,8 @@ module Gecode
126
126
  # (b1 & b2).must_not.imply b3
127
127
  class BooleanConstraint < Gecode::Constraints::ReifiableConstraint
128
128
  def post
129
- lhs, rhs, negate, strength, reif_var = @params.values_at(:lhs, :rhs,
130
- :negate, :strength, :reif)
129
+ lhs, rhs, negate, reif_var =
130
+ @params.values_at(:lhs, :rhs, :negate, :reif)
131
131
  space = (lhs.model || rhs.model).active_space
132
132
 
133
133
  # TODO: It should be possible to reduce the number of necessary
@@ -136,24 +136,25 @@ module Gecode
136
136
 
137
137
  if rhs.respond_to? :bind
138
138
  if reif_var.nil?
139
- Gecode::Raw::bool_eqv(space, lhs.bind, rhs.bind, !negate, strength)
139
+ Gecode::Raw::rel(space, lhs.bind, Gecode::Raw::BOT_EQV, rhs.bind,
140
+ (!negate ? 1 : 0), *propagation_options)
140
141
  else
141
142
  if negate
142
- Gecode::Raw::bool_xor(space, lhs.bind, rhs.bind, reif_var.bind,
143
- strength)
143
+ Gecode::Raw::rel(space, lhs.bind, Gecode::Raw::BOT_XOR, rhs.bind,
144
+ reif_var.bind, *propagation_options)
144
145
  else
145
- Gecode::Raw::bool_eqv(space, lhs.bind, rhs.bind, reif_var.bind,
146
- strength)
146
+ Gecode::Raw::rel(space, lhs.bind, Gecode::Raw::BOT_EQV, rhs.bind,
147
+ reif_var.bind, *propagation_options)
147
148
  end
148
149
  end
149
150
  else
150
151
  should_hold = !negate & rhs
151
152
  if reif_var.nil?
152
153
  Gecode::Raw::MiniModel::BoolExpr.new(lhs.bind).post(space,
153
- should_hold)
154
+ should_hold, *propagation_options)
154
155
  else
155
- Gecode::Raw::bool_eqv(space, lhs.bind, reif_var.bind, should_hold,
156
- strength)
156
+ Gecode::Raw::rel(space, lhs.bind, Gecode::Raw::BOT_EQV,
157
+ reif_var.bind, (should_hold ? 1 : 0), *propagation_options)
157
158
  end
158
159
  end
159
160
  end
@@ -169,10 +170,10 @@ module Gecode
169
170
  # Maps the names of the methods to the corresponding bool constraint in
170
171
  # Gecode.
171
172
  OPERATION_TYPES = {
172
- :| => :bool_or,
173
- :& => :bool_and,
174
- :^ => :bool_xor,
175
- :implies => :bool_imp
173
+ :| => Gecode::Raw::BOT_OR,
174
+ :& => Gecode::Raw::BOT_AND,
175
+ :^ => Gecode::Raw::BOT_XOR,
176
+ :implies => Gecode::Raw::BOT_IMP
176
177
  }
177
178
 
178
179
  public
@@ -185,8 +186,9 @@ module Gecode
185
186
  end
186
187
  ExpressionTree.new(self, expression) do |model, var1, var2|
187
188
  new_var = model.bool_var
188
- Gecode::Raw::#{operation}(model.active_space, var1.bind, var2.bind,
189
- new_var.bind, Gecode::Raw::ICL_DEF)
189
+ Gecode::Raw::rel(model.active_space, var1.bind, #{operation},
190
+ var2.bind, new_var.bind, Gecode::Raw::ICL_DEF,
191
+ Gecode::Raw::PK_DEF)
190
192
  new_var
191
193
  end
192
194
  end
@@ -36,16 +36,16 @@ module Gecode
36
36
  # :strength => :domain)
37
37
  class ConjunctionStub < Gecode::Constraints::Bool::CompositeStub
38
38
  def constrain_equal(variable, params, constrain)
39
- enum, strength = @params.values_at(:lhs, :strength)
39
+ enum = @params[:lhs]
40
40
 
41
41
  @model.add_interaction do
42
42
  if variable.respond_to? :bind
43
43
  bound = variable.bind
44
44
  else
45
- bound = variable
45
+ bound = variable ? 1 : 0
46
46
  end
47
- Gecode::Raw::bool_and(@model.active_space, enum.to_bool_var_array,
48
- bound, strength)
47
+ Gecode::Raw::rel(@model.active_space, Gecode::Raw::BOT_AND,
48
+ enum.to_bool_var_array, bound, *propagation_options)
49
49
  end
50
50
  return variable
51
51
  end
@@ -69,15 +69,17 @@ module Gecode
69
69
  # :strength => :domain)
70
70
  class DisjunctionStub < Gecode::Constraints::Bool::CompositeStub
71
71
  def constrain_equal(variable, params, constrain)
72
- enum, strength = @params.values_at(:lhs, :strength)
72
+ enum = @params[:lhs]
73
73
 
74
- if variable.respond_to? :bind
75
- bound = variable.bind
76
- else
77
- bound = variable
74
+ @model.add_interaction do
75
+ if variable.respond_to? :bind
76
+ bound = variable.bind
77
+ else
78
+ bound = variable ? 1 : 0
79
+ end
80
+ Gecode::Raw::rel(@model.active_space, Gecode::Raw::BOT_OR,
81
+ enum.to_bool_var_array, bound, *propagation_options)
78
82
  end
79
- Gecode::Raw::bool_or(@model.active_space, enum.to_bool_var_array,
80
- bound, strength)
81
83
  end
82
84
  end
83
85
  end
@@ -33,13 +33,14 @@ module Gecode::Constraints::Int::Arithmetic #:nodoc:
33
33
  # x.abs.must_be.in(5..7, :reify => bool, :strength => :value)
34
34
  class AbsExpressionStub < Gecode::Constraints::Int::CompositeStub
35
35
  def constrain_equal(variable, params, constrain)
36
- lhs, strength = @params.values_at(:lhs, :strength)
36
+ lhs = @params[:lhs]
37
37
  if constrain
38
38
  bounds = [lhs.min.abs, lhs.max.abs]
39
39
  variable.must_be.in bounds.min..bounds.max
40
40
  end
41
41
 
42
- Gecode::Raw::abs(@model.active_space, lhs.bind, variable.bind, strength)
42
+ Gecode::Raw::abs(@model.active_space, lhs.bind, variable.bind,
43
+ *propagation_options)
43
44
  end
44
45
  end
45
46
 
@@ -56,7 +57,7 @@ module Gecode::Constraints::Int::Arithmetic #:nodoc:
56
57
  # (x*y).must_be.less_than(17, :reify => bool, :strength => :domain)
57
58
  class MultExpressionStub < Gecode::Constraints::Int::CompositeStub
58
59
  def constrain_equal(variable, params, constrain)
59
- lhs, lhs2, strength = @params.values_at(:lhs, :var, :strength)
60
+ lhs, lhs2 = @params.values_at(:lhs, :var)
60
61
  if constrain
61
62
  a_min = lhs.min; a_max = lhs.max
62
63
  b_min = lhs2.min; b_max = lhs2.max
@@ -65,7 +66,7 @@ module Gecode::Constraints::Int::Arithmetic #:nodoc:
65
66
  end
66
67
 
67
68
  Gecode::Raw::mult(@model.active_space, lhs.bind, lhs2.bind,
68
- variable.bind, strength)
69
+ variable.bind, *propagation_options)
69
70
  end
70
71
  end
71
72
  end
@@ -34,12 +34,13 @@ module Gecode::Constraints::Int
34
34
  # x.must_not_be.in(-5...5, :reify => bool, :strength => :value)
35
35
  class RangeDomainConstraint < Gecode::Constraints::ReifiableConstraint
36
36
  def post
37
- var, domain, reif_var, strength = @params.values_at(:lhs, :domain,
38
- :reif, :strength)
37
+ var, domain, reif_var = @params.values_at(:lhs, :domain, :reif)
38
+
39
39
  (params = []) << var.bind
40
40
  params << domain.first << domain.last
41
41
  params << reif_var.bind if reif_var.respond_to? :bind
42
- params << strength
42
+ params.concat propagation_options
43
+
43
44
  Gecode::Raw::dom(@model.active_space, *params)
44
45
  end
45
46
  negate_using_reification
@@ -61,16 +62,14 @@ module Gecode::Constraints::Int
61
62
  # x.must_not_be.in(-[5,6,7,17], :reify => bool, :strength => :value)
62
63
  class EnumDomainConstraint < Gecode::Constraints::ReifiableConstraint
63
64
  def post
64
- space = @model.active_space
65
-
66
- var, domain, reif_var, strength = @params.values_at(:lhs, :domain,
67
- :reif, :strength)
65
+ var, domain, reif_var = @params.values_at(:lhs, :domain, :reif)
68
66
 
69
67
  (params = []) << var.bind
70
68
  params << Gecode::Constraints::Util.constant_set_to_int_set(domain)
71
69
  params << reif_var.bind if reif_var.respond_to? :bind
72
- params << strength
73
- Gecode::Raw::dom(space, *params)
70
+ params.concat propagation_options
71
+
72
+ Gecode::Raw::dom(@model.active_space, *params)
74
73
  end
75
74
  negate_using_reification
76
75
  end
@@ -141,8 +141,8 @@ module Gecode
141
141
  # (x + y)*10.must_not_be.greater_than(x*3, :reify => bool, :strength => :domain)
142
142
  class LinearConstraint < Gecode::Constraints::ReifiableConstraint
143
143
  def post
144
- lhs, rhs, relation_type, reif_var, strength = @params.values_at(:lhs,
145
- :rhs, :relation_type, :reif, :strength)
144
+ lhs, rhs, relation_type, reif_var =
145
+ @params.values_at(:lhs, :rhs, :relation_type, :reif)
146
146
  reif_var = reif_var.bind if reif_var.respond_to? :bind
147
147
  if rhs.respond_to? :to_minimodel_lin_exp
148
148
  rhs = rhs.to_minimodel_lin_exp
@@ -152,9 +152,11 @@ module Gecode
152
152
 
153
153
  final_exp = (lhs.to_minimodel_lin_exp - rhs)
154
154
  if reif_var.nil?
155
- final_exp.post(@model.active_space, relation_type, strength)
155
+ final_exp.post(@model.active_space, relation_type,
156
+ *propagation_options)
156
157
  else
157
- final_exp.post(@model.active_space, relation_type, reif_var)
158
+ final_exp.post(@model.active_space, relation_type, reif_var,
159
+ *propagation_options)
158
160
  end
159
161
  end
160
162
  end
@@ -199,16 +201,16 @@ module Gecode
199
201
  class SimpleRelationConstraint < Gecode::Constraints::ReifiableConstraint
200
202
  def post
201
203
  # Fetch the parameters to Gecode.
202
- lhs, relation, rhs, reif_var, strength = @params.values_at(:lhs,
203
- :relation_type, :element, :reif, :strength)
204
+ lhs, relation, rhs, reif_var =
205
+ @params.values_at(:lhs, :relation_type, :element, :reif)
204
206
 
205
207
  rhs = rhs.bind if rhs.respond_to? :bind
206
208
  if reif_var.nil?
207
209
  Gecode::Raw::rel(@model.active_space, lhs.bind, relation, rhs,
208
- strength)
210
+ *propagation_options)
209
211
  else
210
212
  Gecode::Raw::rel(@model.active_space, lhs.bind, relation, rhs,
211
- reif_var.bind, strength)
213
+ reif_var.bind, *propagation_options)
212
214
  end
213
215
  end
214
216
  end
@@ -33,13 +33,13 @@ module Gecode::Constraints::IntEnum::Arithmetic #:nodoc:
33
33
  # :strength => :domain)
34
34
  class MaxExpressionStub < Gecode::Constraints::Int::CompositeStub
35
35
  def constrain_equal(variable, params, constrain)
36
- enum, strength = @params.values_at(:lhs, :strength)
36
+ enum = @params[:lhs]
37
37
  if constrain
38
38
  variable.must_be.in enum.domain_range
39
39
  end
40
40
 
41
41
  Gecode::Raw::max(@model.active_space, enum.to_int_var_array,
42
- variable.bind, strength)
42
+ variable.bind, *propagation_options)
43
43
  end
44
44
  end
45
45
 
@@ -60,13 +60,13 @@ module Gecode::Constraints::IntEnum::Arithmetic #:nodoc:
60
60
  # :strength => :domain)
61
61
  class MinExpressionStub < Gecode::Constraints::Int::CompositeStub
62
62
  def constrain_equal(variable, params, constrain)
63
- enum, strength = @params.values_at(:lhs, :strength)
63
+ enum = @params[:lhs]
64
64
  if constrain
65
65
  variable.must_be.in enum.domain_range
66
66
  end
67
67
 
68
68
  Gecode::Raw::min(@model.active_space, enum.to_int_var_array,
69
- variable.bind, strength)
69
+ variable.bind, *propagation_options)
70
70
  end
71
71
  end
72
72
  end
@@ -83,13 +83,13 @@ module Gecode::Constraints::IntEnum
83
83
  # set_enum.must.channel int_enum
84
84
  class ChannelConstraint < Gecode::Constraints::Constraint
85
85
  def post
86
- lhs, rhs, strength = @params.values_at(:lhs, :rhs, :strength)
86
+ lhs, rhs = @params.values_at(:lhs, :rhs)
87
87
 
88
88
  lhs = lhs.to_int_var_array
89
89
  if rhs.respond_to? :to_int_var_array
90
90
  # Int var array.
91
91
  Gecode::Raw::channel(@model.active_space, lhs, rhs.to_int_var_array,
92
- strength)
92
+ *propagation_options)
93
93
  else
94
94
  # Set var array, no strength.
95
95
  Gecode::Raw::channel(@model.active_space, lhs, rhs.to_set_var_array)