gecoder 0.7.1 → 0.8.0

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/example/sudoku-set.rb +16 -13
  4. data/ext/extconf.rb +26 -9
  5. data/ext/missing.cpp +1 -1
  6. data/ext/missing.h +1 -1
  7. data/ext/vararray.h +4 -4
  8. data/lib/gecoder/bindings.rb +21 -1
  9. data/lib/gecoder/bindings/bindings.rb +408 -731
  10. data/lib/gecoder/interface/binding_changes.rb +1 -1
  11. data/lib/gecoder/interface/branch.rb +25 -25
  12. data/lib/gecoder/interface/constraints.rb +47 -4
  13. data/lib/gecoder/interface/constraints/bool/boolean.rb +18 -16
  14. data/lib/gecoder/interface/constraints/bool_enum/boolean.rb +13 -11
  15. data/lib/gecoder/interface/constraints/int/arithmetic.rb +5 -4
  16. data/lib/gecoder/interface/constraints/int/domain.rb +8 -9
  17. data/lib/gecoder/interface/constraints/int/linear.rb +10 -8
  18. data/lib/gecoder/interface/constraints/int_enum/arithmetic.rb +4 -4
  19. data/lib/gecoder/interface/constraints/int_enum/channel.rb +2 -2
  20. data/lib/gecoder/interface/constraints/int_enum/count.rb +4 -5
  21. data/lib/gecoder/interface/constraints/int_enum/distinct.rb +7 -2
  22. data/lib/gecoder/interface/constraints/int_enum/element.rb +2 -2
  23. data/lib/gecoder/interface/constraints/int_enum/equality.rb +6 -3
  24. data/lib/gecoder/interface/constraints/int_enum/sort.rb +17 -5
  25. data/lib/gecoder/interface/constraints/set_enum/distinct.rb +0 -36
  26. data/lib/gecoder/interface/constraints/set_var_constraints.rb +5 -0
  27. data/lib/gecoder/interface/model.rb +3 -3
  28. data/lib/gecoder/interface/search.rb +5 -4
  29. data/lib/gecoder/version.rb +1 -1
  30. data/specs/branch.rb +27 -27
  31. data/specs/constraints/arithmetic.rb +48 -30
  32. data/specs/constraints/bool_enum.rb +39 -19
  33. data/specs/constraints/boolean.rb +10 -10
  34. data/specs/constraints/cardinality.rb +12 -9
  35. data/specs/constraints/channel.rb +6 -6
  36. data/specs/constraints/connection.rb +22 -26
  37. data/specs/constraints/constraint_helper.rb +125 -41
  38. data/specs/constraints/count.rb +22 -15
  39. data/specs/constraints/distinct.rb +10 -64
  40. data/specs/constraints/element.rb +14 -12
  41. data/specs/constraints/equality.rb +4 -4
  42. data/specs/constraints/int_domain.rb +8 -7
  43. data/specs/constraints/int_relation.rb +12 -8
  44. data/specs/constraints/linear.rb +4 -4
  45. data/specs/constraints/reification_sugar.rb +22 -4
  46. data/specs/constraints/selection.rb +2 -2
  47. data/specs/constraints/set_domain.rb +7 -3
  48. data/specs/constraints/set_operation.rb +2 -2
  49. data/specs/constraints/set_relation.rb +2 -6
  50. data/specs/constraints/sort.rb +20 -16
  51. data/specs/distribution.rb +14 -0
  52. data/specs/model.rb +4 -4
  53. data/tasks/dependencies.txt +21 -0
  54. data/tasks/distribution.rake +81 -8
  55. data/tasks/svn.rake +6 -3
  56. data/vendor/rust/include/rust_checks.hh +2 -1
  57. data/vendor/rust/include/rust_conversions.hh +2 -2
  58. data/vendor/rust/rust/attribute.rb +2 -2
  59. data/vendor/rust/rust/class.rb +2 -2
  60. data/vendor/rust/rust/cxxclass.rb +0 -2
  61. data/vendor/rust/rust/function.rb +2 -2
  62. data/vendor/rust/rust/templates/AttributeDefinition.rusttpl +1 -1
  63. data/vendor/rust/rust/templates/StandaloneClassDeclarations.rusttpl +1 -1
  64. data/vendor/rust/rust/templates/VariableFunctionCall.rusttpl +1 -1
  65. data/vendor/rust/rust/type.rb +1 -1
  66. metadata +159 -157
@@ -22,7 +22,7 @@ describe Gecode::Constraints::IntEnum::Count do
22
22
  @target = @model.target
23
23
 
24
24
  # Creates an expectation corresponding to the specified input.
25
- @expect = lambda do |element, relation, target, strength, reif_var|
25
+ @expect = lambda do |element, relation, target, strength, kind, reif_var|
26
26
  @model.allow_space_access do
27
27
  target = an_instance_of(Gecode::Raw::IntVar) if target.respond_to? :bind
28
28
  element = an_instance_of(Gecode::Raw::IntVar) if element.respond_to? :bind
@@ -30,17 +30,17 @@ describe Gecode::Constraints::IntEnum::Count do
30
30
  Gecode::Raw.should_receive(:count).once.with(
31
31
  an_instance_of(Gecode::Raw::Space),
32
32
  an_instance_of(Gecode::Raw::IntVarArray),
33
- element, relation, target, strength)
33
+ element, relation, target, strength, kind)
34
34
  else
35
35
  Gecode::Raw.should_receive(:count).once.with(
36
36
  an_instance_of(Gecode::Raw::Space),
37
37
  an_instance_of(Gecode::Raw::IntVarArray),
38
38
  element, Gecode::Raw::IRT_EQ,
39
- an_instance_of(Gecode::Raw::IntVar), strength)
39
+ an_instance_of(Gecode::Raw::IntVar), strength, kind)
40
40
  Gecode::Raw.should_receive(:rel).once.with(
41
41
  an_instance_of(Gecode::Raw::Space),
42
42
  an_instance_of(Gecode::Raw::IntVar), relation,
43
- target, an_instance_of(Gecode::Raw::BoolVar), strength)
43
+ target, an_instance_of(Gecode::Raw::BoolVar), strength, kind)
44
44
  end
45
45
  end
46
46
  end
@@ -50,8 +50,9 @@ describe Gecode::Constraints::IntEnum::Count do
50
50
  @list.count(@element).must_be.greater_than(@target, hash)
51
51
  @model.solve!
52
52
  end
53
- @expect_options = lambda do |strength, reif_var|
54
- @expect.call(@element, Gecode::Raw::IRT_GR, @target, strength, reif_var)
53
+ @expect_options = option_expectation do |strength, kind, reif_var|
54
+ @expect.call(@element, Gecode::Raw::IRT_GR, @target, strength,
55
+ kind, reif_var)
55
56
  end
56
57
  end
57
58
 
@@ -61,14 +62,16 @@ describe Gecode::Constraints::IntEnum::Count do
61
62
 
62
63
  Gecode::Constraints::Util::RELATION_TYPES.each_pair do |relation, type|
63
64
  it "should translate #{relation} with variable element and target" do
64
- @expect.call(@element, type, @target, Gecode::Raw::ICL_DEF, nil)
65
+ @expect.call(@element, type, @target, Gecode::Raw::ICL_DEF,
66
+ Gecode::Raw::PK_DEF, nil)
65
67
  @list.count(@element).must.send(relation, @target)
66
68
  @model.solve!
67
69
  end
68
70
  end
69
71
  Gecode::Constraints::Util::NEGATED_RELATION_TYPES.each_pair do |relation, type|
70
72
  it "should translate negated #{relation} with variable element and target" do
71
- @expect.call(@element, type, @target, Gecode::Raw::ICL_DEF, nil)
73
+ @expect.call(@element, type, @target, Gecode::Raw::ICL_DEF,
74
+ Gecode::Raw::PK_DEF, nil)
72
75
  @list.count(@element).must_not.send(relation, @target)
73
76
  @model.solve!
74
77
  end
@@ -76,14 +79,16 @@ describe Gecode::Constraints::IntEnum::Count do
76
79
 
77
80
  Gecode::Constraints::Util::RELATION_TYPES.each_pair do |relation, type|
78
81
  it "should translate #{relation} with variable element and constant target" do
79
- @expect.call(@element, type, 2, Gecode::Raw::ICL_DEF, nil)
82
+ @expect.call(@element, type, 2, Gecode::Raw::ICL_DEF,
83
+ Gecode::Raw::PK_DEF, nil)
80
84
  @list.count(@element).must.send(relation, 2)
81
85
  @model.solve!
82
86
  end
83
87
  end
84
88
  Gecode::Constraints::Util::NEGATED_RELATION_TYPES.each_pair do |relation, type|
85
89
  it "should translate negated #{relation} with variable element and constant target" do
86
- @expect.call(@element, type, 2, Gecode::Raw::ICL_DEF, nil)
90
+ @expect.call(@element, type, 2, Gecode::Raw::ICL_DEF,
91
+ Gecode::Raw::PK_DEF, nil)
87
92
  @list.count(@element).must_not.send(relation, 2)
88
93
  @model.solve!
89
94
  end
@@ -91,14 +96,14 @@ describe Gecode::Constraints::IntEnum::Count do
91
96
 
92
97
  Gecode::Constraints::Util::RELATION_TYPES.each_pair do |relation, type|
93
98
  it "should translate #{relation} with constant element and constant target" do
94
- @expect.call(1, type, 2, Gecode::Raw::ICL_DEF, nil)
99
+ @expect.call(1, type, 2, Gecode::Raw::ICL_DEF, Gecode::Raw::PK_DEF, nil)
95
100
  @list.count(1).must.send(relation, 2)
96
101
  @model.solve!
97
102
  end
98
103
  end
99
104
  Gecode::Constraints::Util::NEGATED_RELATION_TYPES.each_pair do |relation, type|
100
105
  it "should translate negated #{relation} with constant element and constant target" do
101
- @expect.call(1, type, 2, Gecode::Raw::ICL_DEF, nil)
106
+ @expect.call(1, type, 2, Gecode::Raw::ICL_DEF, Gecode::Raw::PK_DEF, nil)
102
107
  @list.count(1).must_not.send(relation, 2)
103
108
  @model.solve!
104
109
  end
@@ -106,14 +111,16 @@ describe Gecode::Constraints::IntEnum::Count do
106
111
 
107
112
  Gecode::Constraints::Util::RELATION_TYPES.each_pair do |relation, type|
108
113
  it "should translate #{relation} with constant element and variable target" do
109
- @expect.call(1, type, @target, Gecode::Raw::ICL_DEF, nil)
114
+ @expect.call(1, type, @target, Gecode::Raw::ICL_DEF,
115
+ Gecode::Raw::PK_DEF, nil)
110
116
  @list.count(1).must.send(relation, @target)
111
117
  @model.solve!
112
118
  end
113
119
  end
114
120
  Gecode::Constraints::Util::NEGATED_RELATION_TYPES.each_pair do |relation, type|
115
121
  it "should translate negated #{relation} with constant element and variable target" do
116
- @expect.call(1, type, @target, Gecode::Raw::ICL_DEF, nil)
122
+ @expect.call(1, type, @target, Gecode::Raw::ICL_DEF,
123
+ Gecode::Raw::PK_DEF, nil)
117
124
  @list.count(1).must_not.send(relation, @target)
118
125
  @model.solve!
119
126
  end
@@ -135,5 +142,5 @@ describe Gecode::Constraints::IntEnum::Count do
135
142
  @model.solve!.should be_nil
136
143
  end
137
144
 
138
- it_should_behave_like 'constraint with options'
145
+ it_should_behave_like 'reifiable constraint'
139
146
  end
@@ -19,17 +19,17 @@ describe Gecode::Constraints::IntEnum::Distinct do
19
19
  @model.vars.must_be.distinct(hash)
20
20
  @model.solve!
21
21
  end
22
- @expect_options = lambda do |strength, reif_var|
22
+ @expect_options = option_expectation do |strength, kind, reif_var|
23
23
  Gecode::Raw.should_receive(:distinct).once.with(
24
24
  an_instance_of(Gecode::Raw::Space),
25
- an_instance_of(Gecode::Raw::IntVarArray), strength)
25
+ an_instance_of(Gecode::Raw::IntVarArray), strength, kind)
26
26
  end
27
27
  end
28
28
 
29
29
  it 'should translate into a distinct constraint' do
30
30
  Gecode::Raw.should_receive(:distinct).once.with(
31
31
  an_instance_of(Gecode::Raw::Space),
32
- anything, Gecode::Raw::ICL_DEF)
32
+ anything, Gecode::Raw::ICL_DEF, Gecode::Raw::PK_DEF)
33
33
  @invoke_options.call({})
34
34
  end
35
35
 
@@ -46,7 +46,7 @@ describe Gecode::Constraints::IntEnum::Distinct do
46
46
  Gecode::MissingConstraintError)
47
47
  end
48
48
 
49
- it_should_behave_like 'constraint with strength option'
49
+ it_should_behave_like 'non-reifiable constraint'
50
50
  end
51
51
 
52
52
  describe Gecode::Constraints::IntEnum::Distinct, ' (with offsets)' do
@@ -56,16 +56,16 @@ describe Gecode::Constraints::IntEnum::Distinct, ' (with offsets)' do
56
56
  @model.vars.with_offsets(1,2).must_be.distinct(hash)
57
57
  @model.solve!
58
58
  end
59
- @expect_options = lambda do |strength, reif_var|
59
+ @expect_options = option_expectation do |strength, kind, reif_var|
60
60
  if reif_var.nil?
61
61
  Gecode::Raw.should_receive(:distinct).once.with(
62
62
  an_instance_of(Gecode::Raw::Space),
63
- anything, an_instance_of(Gecode::Raw::IntVarArray), strength)
63
+ anything, an_instance_of(Gecode::Raw::IntVarArray), strength, kind)
64
64
  else
65
65
  Gecode::Raw.should_receive(:distinct).once.with(
66
66
  an_instance_of(Gecode::Raw::Space),
67
- anything, an_instance_of(Gecode::Raw::IntVarArray), strength,
68
- an_instance_of(Gecode::Raw::BoolVar))
67
+ anything, an_instance_of(Gecode::Raw::IntVarArray),
68
+ strength, kind, reif_var)
69
69
  end
70
70
  end
71
71
  end
@@ -73,7 +73,7 @@ describe Gecode::Constraints::IntEnum::Distinct, ' (with offsets)' do
73
73
  it 'should translate into a distinct constraint with offsets' do
74
74
  Gecode::Raw.should_receive(:distinct).once.with(
75
75
  an_instance_of(Gecode::Raw::Space),
76
- anything, anything, Gecode::Raw::ICL_DEF)
76
+ anything, anything, Gecode::Raw::ICL_DEF, Gecode::Raw::PK_DEF)
77
77
  @invoke_options.call({})
78
78
  end
79
79
 
@@ -103,61 +103,7 @@ describe Gecode::Constraints::IntEnum::Distinct, ' (with offsets)' do
103
103
  raise_error(Gecode::MissingConstraintError)
104
104
  end
105
105
 
106
- it_should_behave_like 'constraint with strength option'
107
- end
108
-
109
- describe Gecode::Constraints::SetEnum::Distinct do
110
- before do
111
- @model = DistinctSampleProblem.new
112
- @sets = @model.sets
113
- @size = 1
114
-
115
- @invoke_options = lambda do |hash|
116
- @sets.must_be.distinct(hash.update(:size => @size))
117
- @model.solve!
118
- end
119
- @expect_options = lambda do |strength, reif_var|
120
- Gecode::Raw.should_receive(:distinct).once.with(
121
- an_instance_of(Gecode::Raw::Space),
122
- an_instance_of(Gecode::Raw::SetVarArray), @size)
123
- end
124
- end
125
-
126
- it 'should translate into a distinct constraint' do
127
- Gecode::Raw.should_receive(:distinct).once.with(
128
- an_instance_of(Gecode::Raw::Space),
129
- an_instance_of(Gecode::Raw::SetVarArray), @size)
130
- @sets.must_be.distinct(:size => @size)
131
- @model.solve!
132
- end
133
-
134
- it 'should constrain sets to be distinct' do
135
- @sets.must_be.distinct(:size => @size)
136
- @sets[0].must_be.superset_of 0
137
- solution = @model.solve!
138
- solution.should_not be_nil
139
- set1, set2 = solution.sets
140
- set1.value.size.should == @size
141
- set2.value.size.should == @size
142
- set1.value.should_not == set2.value
143
- end
144
-
145
- it 'should not allow negation' do
146
- lambda{ @sets.must_not_be.distinct(:size => @size) }.should raise_error(
147
- Gecode::MissingConstraintError)
148
- end
149
-
150
- it 'should not allow options other than :size' do
151
- lambda do
152
- @sets.must_be.distinct(:size => @size, :foo => 17)
153
- end.should raise_error(ArgumentError)
154
- end
155
-
156
- it 'should raise error if :size is not specified' do
157
- lambda{ @sets.must_be.distinct }.should raise_error(ArgumentError)
158
- end
159
-
160
- it_should_behave_like 'non-reifiable set constraint'
106
+ it_should_behave_like 'non-reifiable constraint'
161
107
  end
162
108
 
163
109
  describe Gecode::Constraints::SetEnum::Distinct, ' (at most one)' do
@@ -26,7 +26,7 @@ describe Gecode::Constraints::IntEnum::Element do
26
26
  @fixnum_prices = @model.fixnum_prices
27
27
 
28
28
  # Creates an expectation corresponding to the specified input.
29
- @expect = lambda do |element, relation, target, strength, reif_var, negated|
29
+ @expect = lambda do |element, relation, target, strength, kind, reif_var, negated|
30
30
  @model.allow_space_access do
31
31
  target = an_instance_of(Gecode::Raw::IntVar) if target.respond_to? :bind
32
32
  element = an_instance_of(Gecode::Raw::IntVar) if element.respond_to? :bind
@@ -36,25 +36,26 @@ describe Gecode::Constraints::IntEnum::Element do
36
36
  Gecode::Raw.should_receive(:element).once.with(
37
37
  an_instance_of(Gecode::Raw::Space),
38
38
  an_instance_of(Gecode::Raw::IntVarArray),
39
- element, target, strength)
39
+ element, target, strength, kind)
40
40
  else
41
41
  Gecode::Raw.should_receive(:element).once.with(
42
42
  an_instance_of(Gecode::Raw::Space),
43
43
  an_instance_of(Gecode::Raw::IntVarArray),
44
- element, an_instance_of(Gecode::Raw::IntVar), strength)
44
+ element, an_instance_of(Gecode::Raw::IntVar), strength, kind)
45
45
  Gecode::Raw.should_receive(:rel).once.with(
46
46
  an_instance_of(Gecode::Raw::Space),
47
- an_instance_of(Gecode::Raw::IntVar), relation, target, strength)
47
+ an_instance_of(Gecode::Raw::IntVar),
48
+ relation, target, strength, kind)
48
49
  end
49
50
  else
50
51
  Gecode::Raw.should_receive(:element).once.with(
51
52
  an_instance_of(Gecode::Raw::Space),
52
53
  an_instance_of(Gecode::Raw::IntVarArray),
53
- element, an_instance_of(Gecode::Raw::IntVar), strength)
54
+ element, an_instance_of(Gecode::Raw::IntVar), strength, kind)
54
55
  Gecode::Raw.should_receive(:rel).once.with(
55
56
  an_instance_of(Gecode::Raw::Space),
56
57
  an_instance_of(Gecode::Raw::IntVar), relation, target,
57
- an_instance_of(Gecode::Raw::BoolVar), strength)
58
+ an_instance_of(Gecode::Raw::BoolVar), strength, kind)
58
59
  end
59
60
  end
60
61
  end
@@ -64,9 +65,9 @@ describe Gecode::Constraints::IntEnum::Element do
64
65
  @prices[@store].must_be.greater_than(@price, hash)
65
66
  @model.solve!
66
67
  end
67
- @expect_options = lambda do |strength, reif_var|
68
- @expect.call(@store, Gecode::Raw::IRT_GR, @price, strength, reif_var,
69
- false)
68
+ @expect_options = option_expectation do |strength, kind, reif_var|
69
+ @expect.call(@store, Gecode::Raw::IRT_GR, @price, strength, kind,
70
+ reif_var, false)
70
71
  end
71
72
 
72
73
  # For composite spec.
@@ -79,7 +80,8 @@ describe Gecode::Constraints::IntEnum::Element do
79
80
  @model.solve!
80
81
  end
81
82
  @expect_relation = lambda do |relation, target, negated|
82
- @expect.call(@store, relation, target, Gecode::Raw::ICL_DEF, nil, negated)
83
+ @expect.call(@store, relation, target, Gecode::Raw::ICL_DEF,
84
+ Gecode::Raw::PK_DEF, nil, negated)
83
85
  end
84
86
  end
85
87
 
@@ -96,11 +98,11 @@ describe Gecode::Constraints::IntEnum::Element do
96
98
  it 'should translate reification when using equality' do
97
99
  bool_var = @model.bool_var
98
100
  @expect.call(@store, Gecode::Raw::IRT_EQ, @target, Gecode::Raw::ICL_DEF,
99
- bool_var, false)
101
+ Gecode::Raw::PK_DEF, bool_var, false)
100
102
  @prices[@store].must_be.equal_to(@target, :reify => bool_var)
101
103
  @model.solve!
102
104
  end
103
105
 
104
106
  it_should_behave_like 'composite constraint'
105
- it_should_behave_like 'constraint with options'
107
+ it_should_behave_like 'reifiable constraint'
106
108
  end
@@ -9,15 +9,15 @@ describe Gecode::Constraints::IntEnum::Equality do
9
9
  @vars.must_be.equal(hash)
10
10
  @model.solve!
11
11
  end
12
- @expect_options = lambda do |strength, reif_var|
12
+ @expect_options = option_expectation do |strength, kind, reif_var|
13
13
  Gecode::Raw.should_receive(:eq).once.with(
14
14
  an_instance_of(Gecode::Raw::Space),
15
- anything, strength)
15
+ anything, strength, kind)
16
16
  end
17
17
  end
18
18
 
19
19
  it 'should translate equality constraints' do
20
- @expect_options.call(Gecode::Raw::ICL_DEF, nil)
20
+ @expect_options.call({})
21
21
  @invoke_options.call({})
22
22
  @vars.must_be.equal
23
23
  end
@@ -27,5 +27,5 @@ describe Gecode::Constraints::IntEnum::Equality do
27
27
  Gecode::MissingConstraintError)
28
28
  end
29
29
 
30
- it_should_behave_like 'constraint with strength option'
30
+ it_should_behave_like 'non-reifiable constraint'
31
31
  end
@@ -14,19 +14,20 @@ describe Gecode::Constraints::Int::Domain do
14
14
  @x.must_be.in(@non_range_domain, hash)
15
15
  @model.solve!
16
16
  end
17
- @expect_options = lambda do |strength, reif_var|
17
+ @expect_options = option_expectation do |strength, kind, reif_var|
18
18
  @model.allow_space_access do
19
19
  if reif_var.nil?
20
20
  Gecode::Raw.should_receive(:dom).once.with(
21
21
  an_instance_of(Gecode::Raw::Space),
22
22
  an_instance_of(Gecode::Raw::IntVar),
23
- an_instance_of(Gecode::Raw::IntSet), strength)
23
+ an_instance_of(Gecode::Raw::IntSet),
24
+ strength, kind)
24
25
  else
25
26
  Gecode::Raw.should_receive(:dom).once.with(
26
27
  an_instance_of(Gecode::Raw::Space),
27
28
  an_instance_of(Gecode::Raw::IntVar),
28
29
  an_instance_of(Gecode::Raw::IntSet),
29
- an_instance_of(Gecode::Raw::BoolVar), strength)
30
+ reif_var, strength, kind)
30
31
  end
31
32
  end
32
33
  end
@@ -36,7 +37,7 @@ describe Gecode::Constraints::Int::Domain do
36
37
  Gecode::Raw.should_receive(:dom).once.with(
37
38
  an_instance_of(Gecode::Raw::Space),
38
39
  an_instance_of(Gecode::Raw::IntVar), @range_domain.first,
39
- @range_domain.last, Gecode::Raw::ICL_DEF)
40
+ @range_domain.last, Gecode::Raw::ICL_DEF, Gecode::Raw::PK_DEF)
40
41
  @x.must_be.in @range_domain
41
42
  @model.solve!
42
43
  end
@@ -45,13 +46,13 @@ describe Gecode::Constraints::Int::Domain do
45
46
  Gecode::Raw.should_receive(:dom).once.with(
46
47
  an_instance_of(Gecode::Raw::Space),
47
48
  an_instance_of(Gecode::Raw::IntVar), @three_dot_range_domain.first,
48
- @three_dot_range_domain.last, Gecode::Raw::ICL_DEF)
49
+ @three_dot_range_domain.last, Gecode::Raw::ICL_DEF, Gecode::Raw::PK_DEF)
49
50
  @x.must_be.in @three_dot_range_domain
50
51
  @model.solve!
51
52
  end
52
53
 
53
54
  it 'should translate domain constraints with non-range domains' do
54
- @expect_options.call(Gecode::Raw::ICL_DEF, nil)
55
+ @expect_options.call({})
55
56
  @invoke_options.call({})
56
57
  end
57
58
 
@@ -65,5 +66,5 @@ describe Gecode::Constraints::Int::Domain do
65
66
  lambda{ @x.must_be.in 'hello' }.should raise_error(TypeError)
66
67
  end
67
68
 
68
- it_should_behave_like 'constraint with options'
69
+ it_should_behave_like 'reifiable constraint'
69
70
  end
@@ -13,17 +13,17 @@ describe Gecode::Constraints::Int::Linear, ' (simple ones)' do
13
13
  @x.must_be.greater_than(3, hash)
14
14
  @model.solve!
15
15
  end
16
- @expect_options = lambda do |strength, reif_var|
16
+ @expect_options = option_expectation do |strength, kind, reif_var|
17
17
  if reif_var.nil?
18
18
  Gecode::Raw.should_receive(:rel).once.with(
19
19
  an_instance_of(Gecode::Raw::Space),
20
20
  anything, Gecode::Raw::IRT_GR, anything,
21
- strength)
21
+ strength, kind)
22
22
  else
23
23
  Gecode::Raw.should_receive(:rel).once.with(
24
24
  an_instance_of(Gecode::Raw::Space),
25
25
  an_instance_of(Gecode::Raw::IntVar), Gecode::Raw::IRT_GR, anything,
26
- an_instance_of(Gecode::Raw::BoolVar), strength)
26
+ reif_var, strength, kind)
27
27
  end
28
28
  end
29
29
  end
@@ -32,7 +32,8 @@ describe Gecode::Constraints::Int::Linear, ' (simple ones)' do
32
32
  it "should translate #{relation} with constant to simple relation" do
33
33
  Gecode::Raw.should_receive(:rel).once.with(
34
34
  an_instance_of(Gecode::Raw::Space),
35
- an_instance_of(Gecode::Raw::IntVar), type, @int, Gecode::Raw::ICL_DEF)
35
+ an_instance_of(Gecode::Raw::IntVar),
36
+ type, @int, Gecode::Raw::ICL_DEF, Gecode::Raw::PK_DEF)
36
37
  @x.must.send(relation, @int)
37
38
  @model.solve!
38
39
  end
@@ -42,7 +43,8 @@ describe Gecode::Constraints::Int::Linear, ' (simple ones)' do
42
43
  it "should translate negated #{relation} with constant to simple relation" do
43
44
  Gecode::Raw.should_receive(:rel).once.with(
44
45
  an_instance_of(Gecode::Raw::Space),
45
- an_instance_of(Gecode::Raw::IntVar), type, @int, Gecode::Raw::ICL_DEF)
46
+ an_instance_of(Gecode::Raw::IntVar),
47
+ type, @int, Gecode::Raw::ICL_DEF, Gecode::Raw::PK_DEF)
46
48
  @x.must_not.send(relation, @int)
47
49
  @model.solve!
48
50
  end
@@ -53,7 +55,8 @@ describe Gecode::Constraints::Int::Linear, ' (simple ones)' do
53
55
  Gecode::Raw.should_receive(:rel).once.with(
54
56
  an_instance_of(Gecode::Raw::Space),
55
57
  an_instance_of(Gecode::Raw::IntVar), type,
56
- an_instance_of(Gecode::Raw::IntVar), Gecode::Raw::ICL_DEF)
58
+ an_instance_of(Gecode::Raw::IntVar),
59
+ Gecode::Raw::ICL_DEF, Gecode::Raw::PK_DEF)
57
60
  @x.must.send(relation, @y)
58
61
  @model.solve!
59
62
  end
@@ -64,7 +67,8 @@ describe Gecode::Constraints::Int::Linear, ' (simple ones)' do
64
67
  Gecode::Raw.should_receive(:rel).once.with(
65
68
  an_instance_of(Gecode::Raw::Space),
66
69
  an_instance_of(Gecode::Raw::IntVar), type,
67
- an_instance_of(Gecode::Raw::IntVar), Gecode::Raw::ICL_DEF)
70
+ an_instance_of(Gecode::Raw::IntVar),
71
+ Gecode::Raw::ICL_DEF, Gecode::Raw::PK_DEF)
68
72
  @x.must_not.send(relation, @y)
69
73
  @model.solve!
70
74
  end
@@ -74,5 +78,5 @@ describe Gecode::Constraints::Int::Linear, ' (simple ones)' do
74
78
  lambda{ @x.must == 'hello' }.should raise_error(TypeError)
75
79
  end
76
80
 
77
- it_should_behave_like 'constraint with options'
81
+ it_should_behave_like 'reifiable constraint'
78
82
  end