lib/gecoder/interface/constraints/int_enum/equality.rb in gecoder-0.7.1 vs lib/gecoder/interface/constraints/int_enum/equality.rb in gecoder-0.8.0
- old
+ new
@@ -6,10 +6,14 @@
# The best we could implement it as from here would be a bunch of
# reified pairwise inequality constraints.
raise Gecode::MissingConstraintError, 'A negated equality is not ' +
'implemented.'
end
+ unless options[:reify].nil?
+ raise ArgumentError, 'Reification is not supported by the equality ' +
+ 'constraint.'
+ end
@model.add_constraint Equality::EqualityConstraint.new(@model,
@params.update(Gecode::Constraints::Util.decode_options(options)))
end
end
@@ -25,14 +29,13 @@
# # Constrains all variables in +int_enum+ to be equal.
# int_enum.must_be.equal
class EqualityConstraint < Gecode::Constraints::Constraint
def post
# Bind lhs.
- @params[:lhs] = @params[:lhs].to_int_var_array
+ lhs = @params[:lhs].to_int_var_array
# Fetch the parameters to Gecode.
- params = @params.values_at(:lhs, :strength)
- Gecode::Raw::eq(@model.active_space, *params)
+ Gecode::Raw::eq(@model.active_space, lhs, *propagation_options)
end
end
end
end
\ No newline at end of file