gecoder 0.9.0 → 0.9.1

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 +6 -0
  2. data/README +1 -1
  3. data/THANKS +18 -0
  4. data/example/equation_system.rb +3 -1
  5. data/example/magic_sequence.rb +3 -1
  6. data/example/queens.rb +3 -1
  7. data/example/send_more_money.rb +24 -30
  8. data/example/send_most_money.rb +15 -26
  9. data/example/square_tiling.rb +3 -1
  10. data/example/sudoku-set.rb +3 -1
  11. data/lib/gecoder/bindings.rb +7 -5
  12. data/lib/gecoder/bindings/bindings.rb +8 -8
  13. data/lib/gecoder/interface.rb +4 -2
  14. data/lib/gecoder/interface/binding_changes.rb +1 -1
  15. data/lib/gecoder/interface/branch.rb +1 -1
  16. data/lib/gecoder/interface/constraints/bool_enum_constraints.rb +4 -4
  17. data/lib/gecoder/interface/constraints/bool_var_constraints.rb +2 -2
  18. data/lib/gecoder/interface/constraints/extensional_regexp.rb +1 -1
  19. data/lib/gecoder/interface/constraints/fixnum_enum_constraints.rb +2 -2
  20. data/lib/gecoder/interface/constraints/int_enum/extensional.rb +5 -5
  21. data/lib/gecoder/interface/constraints/int_enum_constraints.rb +4 -4
  22. data/lib/gecoder/interface/constraints/int_var_constraints.rb +2 -2
  23. data/lib/gecoder/interface/constraints/selected_set/select.rb +8 -8
  24. data/lib/gecoder/interface/constraints/set_enum/{select.rb → element.rb} +10 -10
  25. data/lib/gecoder/interface/constraints/set_enum_constraints.rb +5 -5
  26. data/lib/gecoder/interface/constraints/set_var_constraints.rb +2 -2
  27. data/lib/gecoder/interface/{model_sugar.rb → convenience.rb} +19 -4
  28. data/lib/gecoder/interface/enum_wrapper.rb +1 -1
  29. data/lib/gecoder/interface/{model.rb → mixin.rb} +93 -60
  30. data/lib/gecoder/interface/search.rb +23 -22
  31. data/lib/gecoder/version.rb +1 -1
  32. data/specs/branch.rb +5 -3
  33. data/specs/constraints/bool/boolean.rb +3 -1
  34. data/specs/constraints/bool/linear.rb +3 -1
  35. data/specs/constraints/bool_enum/bool_enum_relation.rb +3 -1
  36. data/specs/constraints/bool_enum/channel.rb +3 -1
  37. data/specs/constraints/fixnum_enum/element.rb +3 -1
  38. data/specs/constraints/int/arithmetic.rb +3 -1
  39. data/specs/constraints/int/channel.rb +3 -1
  40. data/specs/constraints/int/linear.rb +3 -1
  41. data/specs/constraints/int/linear_properties.rb +3 -1
  42. data/specs/constraints/int_enum/arithmetic.rb +3 -1
  43. data/specs/constraints/int_enum/channel.rb +3 -1
  44. data/specs/constraints/int_enum/count.rb +3 -1
  45. data/specs/constraints/int_enum/distinct.rb +3 -1
  46. data/specs/constraints/int_enum/element.rb +3 -1
  47. data/specs/constraints/int_enum/sort.rb +3 -1
  48. data/specs/constraints/property_helper.rb +10 -10
  49. data/specs/constraints/reification_sugar.rb +3 -1
  50. data/specs/constraints/selected_set/select.rb +6 -5
  51. data/specs/constraints/selected_set/select_properties.rb +12 -10
  52. data/specs/constraints/set/channel.rb +3 -1
  53. data/specs/constraints/set/domain.rb +4 -4
  54. data/specs/constraints/set/relation.rb +4 -4
  55. data/specs/constraints/set_enum/channel.rb +3 -1
  56. data/specs/constraints/set_enum/distinct.rb +3 -1
  57. data/specs/constraints/set_enum/{select.rb → element.rb} +13 -9
  58. data/specs/enum_wrapper.rb +1 -1
  59. data/specs/mixin.rb +78 -0
  60. data/specs/model.rb +5 -5
  61. data/specs/search.rb +20 -14
  62. data/specs/selected_set.rb +3 -3
  63. data/specs/set_elements.rb +2 -2
  64. data/tasks/distribution.rake +25 -4
  65. metadata +15 -12
  66. data/example/money.rb +0 -36
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gecoder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gecode/R Development Team
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-08-18 00:00:00 +02:00
12
+ date: 2008-08-29 00:00:00 +02:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -22,17 +22,18 @@ extensions:
22
22
  extra_rdoc_files:
23
23
  - README
24
24
  - CHANGES
25
+ - THANKS
25
26
  - LGPL-LICENSE
26
27
  - lib/gecoder.rb
27
28
  - lib/gecoder/bindings.rb
28
29
  - lib/gecoder/interface/branch.rb
29
30
  - lib/gecoder/interface/enum_matrix.rb
30
- - lib/gecoder/interface/model_sugar.rb
31
31
  - lib/gecoder/interface/search.rb
32
32
  - lib/gecoder/interface/constraints.rb
33
+ - lib/gecoder/interface/convenience.rb
33
34
  - lib/gecoder/interface/variables.rb
35
+ - lib/gecoder/interface/mixin.rb
34
36
  - lib/gecoder/interface/enum_wrapper.rb
35
- - lib/gecoder/interface/model.rb
36
37
  - lib/gecoder/interface/constraints/set_var_constraints.rb
37
38
  - lib/gecoder/interface/constraints/extensional_regexp.rb
38
39
  - lib/gecoder/interface/constraints/selected_set_constraints.rb
@@ -75,8 +76,8 @@ extra_rdoc_files:
75
76
  - lib/gecoder/interface/constraints/int_var_constraints.rb
76
77
  - lib/gecoder/interface/constraints/reifiable_constraints.rb
77
78
  - lib/gecoder/interface/constraints/set_enum/channel.rb
78
- - lib/gecoder/interface/constraints/set_enum/select.rb
79
79
  - lib/gecoder/interface/constraints/set_enum/distinct.rb
80
+ - lib/gecoder/interface/constraints/set_enum/element.rb
80
81
  - lib/gecoder/interface/constraints/set_enum/operation.rb
81
82
  - lib/gecoder/interface/binding_changes.rb
82
83
  - lib/gecoder/version.rb
@@ -85,6 +86,7 @@ extra_rdoc_files:
85
86
  files:
86
87
  - README
87
88
  - LGPL-LICENSE
89
+ - THANKS
88
90
  - CHANGES
89
91
  - COPYING
90
92
  - Rakefile
@@ -92,12 +94,12 @@ files:
92
94
  - lib/gecoder/bindings.rb
93
95
  - lib/gecoder/interface/branch.rb
94
96
  - lib/gecoder/interface/enum_matrix.rb
95
- - lib/gecoder/interface/model_sugar.rb
96
97
  - lib/gecoder/interface/search.rb
97
98
  - lib/gecoder/interface/constraints.rb
99
+ - lib/gecoder/interface/convenience.rb
98
100
  - lib/gecoder/interface/variables.rb
101
+ - lib/gecoder/interface/mixin.rb
99
102
  - lib/gecoder/interface/enum_wrapper.rb
100
- - lib/gecoder/interface/model.rb
101
103
  - lib/gecoder/interface/constraints/set_var_constraints.rb
102
104
  - lib/gecoder/interface/constraints/extensional_regexp.rb
103
105
  - lib/gecoder/interface/constraints/selected_set_constraints.rb
@@ -140,8 +142,8 @@ files:
140
142
  - lib/gecoder/interface/constraints/int_var_constraints.rb
141
143
  - lib/gecoder/interface/constraints/reifiable_constraints.rb
142
144
  - lib/gecoder/interface/constraints/set_enum/channel.rb
143
- - lib/gecoder/interface/constraints/set_enum/select.rb
144
145
  - lib/gecoder/interface/constraints/set_enum/distinct.rb
146
+ - lib/gecoder/interface/constraints/set_enum/element.rb
145
147
  - lib/gecoder/interface/constraints/set_enum/operation.rb
146
148
  - lib/gecoder/interface/binding_changes.rb
147
149
  - lib/gecoder/version.rb
@@ -156,7 +158,6 @@ files:
156
158
  - example/sudoku.rb
157
159
  - example/square_tiling.rb
158
160
  - example/example_helper.rb
159
- - example/money.rb
160
161
  - vendor/rust/bin
161
162
  - vendor/rust/bin/cxxgenerator.rb
162
163
  - vendor/rust/README
@@ -236,6 +237,7 @@ files:
236
237
  - specs/distribution.rb
237
238
  - specs/spec_helper.rb
238
239
  - specs/int_var.rb
240
+ - specs/mixin.rb
239
241
  - specs/enum_wrapper.rb
240
242
  - specs/model.rb
241
243
  - specs/set_var.rb
@@ -290,8 +292,8 @@ files:
290
292
  - specs/constraints/operands.rb
291
293
  - specs/constraints/set_enum
292
294
  - specs/constraints/set_enum/channel.rb
293
- - specs/constraints/set_enum/select.rb
294
295
  - specs/constraints/set_enum/distinct.rb
296
+ - specs/constraints/set_enum/element.rb
295
297
  - specs/constraints/set_enum/operation.rb
296
298
  - specs/examples.rb
297
299
  - ext/gecoder.cpp
@@ -324,7 +326,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
324
326
  version: "0"
325
327
  version:
326
328
  requirements:
327
- - Gecode 2.1.1
329
+ - Gecode 2.2.0
328
330
  rubyforge_project: gecoder
329
331
  rubygems_version: 1.2.0
330
332
  signing_key:
@@ -341,6 +343,7 @@ test_files:
341
343
  - specs/distribution.rb
342
344
  - specs/spec_helper.rb
343
345
  - specs/int_var.rb
346
+ - specs/mixin.rb
344
347
  - specs/enum_wrapper.rb
345
348
  - specs/model.rb
346
349
  - specs/set_var.rb
@@ -385,7 +388,7 @@ test_files:
385
388
  - specs/constraints/bool_enum/extensional.rb
386
389
  - specs/constraints/operands.rb
387
390
  - specs/constraints/set_enum/channel.rb
388
- - specs/constraints/set_enum/select.rb
389
391
  - specs/constraints/set_enum/distinct.rb
392
+ - specs/constraints/set_enum/element.rb
390
393
  - specs/constraints/set_enum/operation.rb
391
394
  - specs/examples.rb
@@ -1,36 +0,0 @@
1
- require 'rubygems'
2
- require 'gecoder'
3
-
4
- solution = Gecode.solve do
5
- # A helper to make the linear equation a bit tidier. Takes a number of
6
- # variables and computes the linear combination as if the variable
7
- # were digits in a base 10 number. E.g. x,y,z becomes
8
- # 100*x + 10*y + z .
9
- def equation_row(*variables)
10
- variables.inject{ |result, variable| variable + result*10 }
11
- end
12
-
13
- # Set up the variables.
14
- # Let "letters" be an array of 8 integer variables with domain 0..9.
15
- # The elements represents the letters s, e, n, d, m, o, r and y.
16
- letters_is_an int_var_array(8, 0..9)
17
- s,e,n,d,m,o,r,y = letters
18
-
19
- # Set up the constraints.
20
- # The equation must hold.
21
- (equation_row(s, e, n, d) + equation_row(m, o, r, e)).must ==
22
- equation_row(m, o, n, e, y)
23
-
24
- # The initial letters may not be 0.
25
- s.must_not == 0
26
- m.must_not == 0
27
-
28
- # All letters must be assigned different digits.
29
- letters.must_be.distinct
30
-
31
- # Tell Gecode what variables we want to know the values of.
32
- branch_on letters, :variable => :smallest_size, :value => :min
33
- end
34
-
35
- puts 's e n d m o r y'
36
- puts solution.letters.values.join(' ')