ConstraintSolver 0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/ConstraintSolver +24 -0
- data/doc/classes/Array.html +209 -0
- data/doc/classes/ConstraintSolver.html +242 -0
- data/doc/classes/ConstraintSolver/AbstractConstraint.html +317 -0
- data/doc/classes/ConstraintSolver/AllDifferentConstraint.html +451 -0
- data/doc/classes/ConstraintSolver/AllDifferentConstraintTest.html +397 -0
- data/doc/classes/ConstraintSolver/BinaryConstraint.html +483 -0
- data/doc/classes/ConstraintSolver/BinaryConstraintTest.html +367 -0
- data/doc/classes/ConstraintSolver/BinaryRelation.html +276 -0
- data/doc/classes/ConstraintSolver/BinaryRelationTest.html +194 -0
- data/doc/classes/ConstraintSolver/ConstraintList.html +208 -0
- data/doc/classes/ConstraintSolver/ConstraintListTest.html +252 -0
- data/doc/classes/ConstraintSolver/ConstraintSolver.html +353 -0
- data/doc/classes/ConstraintSolver/ConstraintSolverTest.html +403 -0
- data/doc/classes/ConstraintSolver/Domain.html +522 -0
- data/doc/classes/ConstraintSolver/DomainTest.html +356 -0
- data/doc/classes/ConstraintSolver/DomainWipeoutException.html +158 -0
- data/doc/classes/ConstraintSolver/Problem.html +239 -0
- data/doc/classes/ConstraintSolver/ProblemTest.html +227 -0
- data/doc/classes/ConstraintSolver/Solution.html +342 -0
- data/doc/classes/ConstraintSolver/SolutionTest.html +250 -0
- data/doc/classes/ConstraintSolver/UndoStackEmptyException.html +158 -0
- data/doc/classes/ConstraintSolver/Variable.html +418 -0
- data/doc/classes/ConstraintSolver/VariableTest.html +284 -0
- data/doc/classes/ExtensionsTest.html +233 -0
- data/doc/classes/Fixnum.html +153 -0
- data/doc/created.rid +1 -0
- data/doc/dot/f_0.dot +38 -0
- data/doc/dot/f_0.png +0 -0
- data/doc/dot/f_1.dot +392 -0
- data/doc/dot/f_1.png +0 -0
- data/doc/dot/f_10.dot +392 -0
- data/doc/dot/f_10.png +0 -0
- data/doc/dot/f_11.dot +38 -0
- data/doc/dot/f_11.png +0 -0
- data/doc/dot/f_12.dot +392 -0
- data/doc/dot/f_12.png +0 -0
- data/doc/dot/f_13.dot +392 -0
- data/doc/dot/f_13.png +0 -0
- data/doc/dot/f_14.dot +392 -0
- data/doc/dot/f_14.png +0 -0
- data/doc/dot/f_15.dot +392 -0
- data/doc/dot/f_15.png +0 -0
- data/doc/dot/f_16.dot +392 -0
- data/doc/dot/f_16.png +0 -0
- data/doc/dot/f_17.dot +392 -0
- data/doc/dot/f_17.png +0 -0
- data/doc/dot/f_18.dot +392 -0
- data/doc/dot/f_18.png +0 -0
- data/doc/dot/f_19.dot +392 -0
- data/doc/dot/f_19.png +0 -0
- data/doc/dot/f_2.dot +392 -0
- data/doc/dot/f_2.png +0 -0
- data/doc/dot/f_3.dot +392 -0
- data/doc/dot/f_3.png +0 -0
- data/doc/dot/f_4.dot +392 -0
- data/doc/dot/f_4.png +0 -0
- data/doc/dot/f_5.dot +392 -0
- data/doc/dot/f_5.png +0 -0
- data/doc/dot/f_6.dot +14 -0
- data/doc/dot/f_6.png +0 -0
- data/doc/dot/f_7.dot +392 -0
- data/doc/dot/f_7.png +0 -0
- data/doc/dot/f_8.dot +392 -0
- data/doc/dot/f_8.png +0 -0
- data/doc/dot/f_9.dot +392 -0
- data/doc/dot/f_9.png +0 -0
- data/doc/dot/m_10_0.dot +392 -0
- data/doc/dot/m_10_0.png +0 -0
- data/doc/dot/m_12_0.dot +392 -0
- data/doc/dot/m_12_0.png +0 -0
- data/doc/dot/m_13_0.dot +392 -0
- data/doc/dot/m_13_0.png +0 -0
- data/doc/dot/m_14_0.dot +392 -0
- data/doc/dot/m_14_0.png +0 -0
- data/doc/dot/m_15_0.dot +392 -0
- data/doc/dot/m_15_0.png +0 -0
- data/doc/dot/m_16_0.dot +392 -0
- data/doc/dot/m_16_0.png +0 -0
- data/doc/dot/m_17_0.dot +392 -0
- data/doc/dot/m_17_0.png +0 -0
- data/doc/dot/m_18_0.dot +392 -0
- data/doc/dot/m_18_0.png +0 -0
- data/doc/dot/m_19_0.dot +392 -0
- data/doc/dot/m_19_0.png +0 -0
- data/doc/dot/m_1_0.dot +392 -0
- data/doc/dot/m_1_0.png +0 -0
- data/doc/dot/m_2_0.dot +392 -0
- data/doc/dot/m_2_0.png +0 -0
- data/doc/dot/m_3_0.dot +392 -0
- data/doc/dot/m_3_0.png +0 -0
- data/doc/dot/m_4_0.dot +392 -0
- data/doc/dot/m_4_0.png +0 -0
- data/doc/dot/m_5_0.dot +392 -0
- data/doc/dot/m_5_0.png +0 -0
- data/doc/dot/m_7_0.dot +392 -0
- data/doc/dot/m_7_0.png +0 -0
- data/doc/dot/m_8_0.dot +392 -0
- data/doc/dot/m_8_0.png +0 -0
- data/doc/dot/m_9_0.dot +392 -0
- data/doc/dot/m_9_0.png +0 -0
- data/doc/files/lib/AbstractConstraint_rb.html +148 -0
- data/doc/files/lib/AllDifferentConstraint_rb.html +156 -0
- data/doc/files/lib/BinaryConstraint_rb.html +155 -0
- data/doc/files/lib/ConstraintList_rb.html +148 -0
- data/doc/files/lib/ConstraintSolver_rb.html +162 -0
- data/doc/files/lib/Domain_rb.html +155 -0
- data/doc/files/lib/Problem_rb.html +148 -0
- data/doc/files/lib/Solution_rb.html +148 -0
- data/doc/files/lib/Variable_rb.html +148 -0
- data/doc/files/lib/extensions_rb.html +108 -0
- data/doc/files/test/AllDifferentConstraintTest_rb.html +158 -0
- data/doc/files/test/BinaryConstraintTest_rb.html +158 -0
- data/doc/files/test/ConstraintListTest_rb.html +160 -0
- data/doc/files/test/ConstraintSolverTest_rb.html +164 -0
- data/doc/files/test/DomainTest_rb.html +156 -0
- data/doc/files/test/ProblemTest_rb.html +160 -0
- data/doc/files/test/SolutionTest_rb.html +159 -0
- data/doc/files/test/TestSuite_rb.html +113 -0
- data/doc/files/test/VariableTest_rb.html +157 -0
- data/doc/files/test/extensionsTest_rb.html +118 -0
- data/doc/fr_class_index.html +51 -0
- data/doc/fr_file_index.html +46 -0
- data/doc/fr_method_index.html +133 -0
- data/doc/index.html +24 -0
- data/examples/example.rb +7 -0
- data/examples/queens.rb +13 -0
- data/examples/soft.rb +14 -0
- data/lib/AbstractConstraint.rb +45 -0
- data/lib/AllDifferentConstraint.rb +160 -0
- data/lib/BinaryConstraint.rb +187 -0
- data/lib/ConstraintList.rb +31 -0
- data/lib/ConstraintSolver.rb +213 -0
- data/lib/Domain.rb +100 -0
- data/lib/GraphUtils.rb +293 -0
- data/lib/OneOfEqualsConstraint.rb +81 -0
- data/lib/Problem.rb +30 -0
- data/lib/Solution.rb +56 -0
- data/lib/TupleConstraint.rb +111 -0
- data/lib/Variable.rb +74 -0
- data/lib/extensions.rb +55 -0
- data/test/AllDifferentConstraintTest.rb +140 -0
- data/test/BinaryConstraintTest.rb +108 -0
- data/test/ConstraintListTest.rb +41 -0
- data/test/ConstraintSolverTest.rb +274 -0
- data/test/DomainTest.rb +83 -0
- data/test/GraphUtilsTest.rb +83 -0
- data/test/OneOfEqualsConstraintTest.rb +82 -0
- data/test/ProblemTest.rb +35 -0
- data/test/SolutionTest.rb +35 -0
- data/test/TestSuite.rb +10 -0
- data/test/TupleConstraintTest.rb +151 -0
- data/test/VariableTest.rb +47 -0
- data/test/extensionsTest.rb +57 -0
- metadata +212 -0
@@ -0,0 +1,57 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
$:.unshift File.join(File.dirname(__FILE__), "..", "lib")
|
4
|
+
|
5
|
+
require 'test/unit'
|
6
|
+
require 'extensions'
|
7
|
+
require 'Variable'
|
8
|
+
require 'Domain'
|
9
|
+
|
10
|
+
class ExtensionsTest < Test::Unit::TestCase
|
11
|
+
def setup
|
12
|
+
@array = Array.new([ 1, 2, 3, 4 ])
|
13
|
+
end
|
14
|
+
|
15
|
+
def testRest
|
16
|
+
assert_equal([ 2, 3, 4 ], @array.rest)
|
17
|
+
assert_equal([ true, true ], [ true, true, true ].rest)
|
18
|
+
end
|
19
|
+
|
20
|
+
def testFoldLeft
|
21
|
+
assert_equal(6, [ 1, 2, 3 ].foldLeft(Proc.new { |a,b| a + b }))
|
22
|
+
assert_equal(false, [ false, false, false ].foldLeft(Proc.new { |a,b| a & b }))
|
23
|
+
assert_equal(true, [ false, true, false ].foldLeft(Proc.new { |a,b| a | b }))
|
24
|
+
end
|
25
|
+
|
26
|
+
def testEachAfter
|
27
|
+
res = Array.new
|
28
|
+
@array.eachAfter(2) { |x| res << x }
|
29
|
+
assert_equal([ 3, 4 ], res)
|
30
|
+
res = Array.new
|
31
|
+
@array.eachAfter(4) { |x| res << x }
|
32
|
+
assert_equal(true, res.empty?)
|
33
|
+
res = Array.new
|
34
|
+
@array.eachAfter(5) { |x| res << x }
|
35
|
+
assert_equal([ 1, 2, 3, 4 ], res)
|
36
|
+
end
|
37
|
+
|
38
|
+
def testEachStartWith
|
39
|
+
res = Array.new
|
40
|
+
@array.eachStartWith(2) { |x| res << x }
|
41
|
+
assert_equal([ 2, 3, 4 ], res)
|
42
|
+
end
|
43
|
+
|
44
|
+
def testIncludeAny
|
45
|
+
set = [ 1, 2, 3 ].to_set
|
46
|
+
assert_equal(true, set.include_any?([ 1 ]))
|
47
|
+
assert_equal(false, set.include_any?([ 4, 5, 6 ]))
|
48
|
+
end
|
49
|
+
|
50
|
+
def testIncludeHash
|
51
|
+
hash = { 1 => 2, 3 => 4, 4 => 5 }
|
52
|
+
assert_equal(false, hash.include_hash?({ 2 => 3 }))
|
53
|
+
assert_equal(false, hash.include_hash?({ 1 => 2, 2 => 3, 3 => 4, 4 => 5 }))
|
54
|
+
assert_equal(true, hash.include_hash?({ 1 => 2 }))
|
55
|
+
assert_equal(true, hash.include_hash?({ 4 => 5, 3 => 4, 1 => 2 }))
|
56
|
+
end
|
57
|
+
end
|
metadata
ADDED
@@ -0,0 +1,212 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
rubygems_version: 0.8.11
|
3
|
+
specification_version: 1
|
4
|
+
name: ConstraintSolver
|
5
|
+
version: !ruby/object:Gem::Version
|
6
|
+
version: "0.1"
|
7
|
+
date: 2007-07-08 00:00:00 +02:00
|
8
|
+
summary: A solver for constraint satisfaction and constrained optimisation problems.
|
9
|
+
require_paths:
|
10
|
+
- lib
|
11
|
+
email: mai02dcs@studserv.uni-leipzig.de
|
12
|
+
homepage: http://larsko.dyndns.org/
|
13
|
+
rubyforge_project:
|
14
|
+
description:
|
15
|
+
autorequire:
|
16
|
+
default_executable:
|
17
|
+
bindir: bin
|
18
|
+
has_rdoc: true
|
19
|
+
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">"
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.0.0
|
24
|
+
version:
|
25
|
+
platform: ruby
|
26
|
+
signing_key:
|
27
|
+
cert_chain:
|
28
|
+
authors:
|
29
|
+
- Lars Kotthoff
|
30
|
+
files:
|
31
|
+
- lib/BinaryConstraint.rb
|
32
|
+
- lib/extensions.rb
|
33
|
+
- lib/Problem.rb
|
34
|
+
- lib/Variable.rb
|
35
|
+
- lib/Domain.rb
|
36
|
+
- lib/AllDifferentConstraint.rb
|
37
|
+
- lib/Solution.rb
|
38
|
+
- lib/AbstractConstraint.rb
|
39
|
+
- lib/ConstraintList.rb
|
40
|
+
- lib/GraphUtils.rb
|
41
|
+
- lib/ConstraintSolver.rb
|
42
|
+
- lib/OneOfEqualsConstraint.rb
|
43
|
+
- lib/TupleConstraint.rb
|
44
|
+
- test/extensionsTest.rb
|
45
|
+
- test/ProblemTest.rb
|
46
|
+
- test/DomainTest.rb
|
47
|
+
- test/VariableTest.rb
|
48
|
+
- test/SolutionTest.rb
|
49
|
+
- test/TestSuite.rb
|
50
|
+
- test/BinaryConstraintTest.rb
|
51
|
+
- test/AllDifferentConstraintTest.rb
|
52
|
+
- test/ConstraintListTest.rb
|
53
|
+
- test/ConstraintSolverTest.rb
|
54
|
+
- test/GraphUtilsTest.rb
|
55
|
+
- test/TupleConstraintTest.rb
|
56
|
+
- test/OneOfEqualsConstraintTest.rb
|
57
|
+
- doc/created.rid
|
58
|
+
- doc/dot
|
59
|
+
- doc/files
|
60
|
+
- doc/classes
|
61
|
+
- doc/fr_file_index.html
|
62
|
+
- doc/fr_class_index.html
|
63
|
+
- doc/fr_method_index.html
|
64
|
+
- doc/index.html
|
65
|
+
- doc/dot/f_0.dot
|
66
|
+
- doc/dot/f_0.png
|
67
|
+
- doc/dot/f_1.dot
|
68
|
+
- doc/dot/f_1.png
|
69
|
+
- doc/dot/m_1_0.dot
|
70
|
+
- doc/dot/m_1_0.png
|
71
|
+
- doc/dot/f_2.dot
|
72
|
+
- doc/dot/f_2.png
|
73
|
+
- doc/dot/m_2_0.dot
|
74
|
+
- doc/dot/m_2_0.png
|
75
|
+
- doc/dot/f_3.dot
|
76
|
+
- doc/dot/f_3.png
|
77
|
+
- doc/dot/m_3_0.dot
|
78
|
+
- doc/dot/m_3_0.png
|
79
|
+
- doc/dot/f_4.dot
|
80
|
+
- doc/dot/f_4.png
|
81
|
+
- doc/dot/m_4_0.dot
|
82
|
+
- doc/dot/m_4_0.png
|
83
|
+
- doc/dot/f_5.dot
|
84
|
+
- doc/dot/f_5.png
|
85
|
+
- doc/dot/m_5_0.dot
|
86
|
+
- doc/dot/m_5_0.png
|
87
|
+
- doc/dot/f_6.dot
|
88
|
+
- doc/dot/f_6.png
|
89
|
+
- doc/dot/f_7.dot
|
90
|
+
- doc/dot/f_7.png
|
91
|
+
- doc/dot/m_7_0.dot
|
92
|
+
- doc/dot/m_7_0.png
|
93
|
+
- doc/dot/f_8.dot
|
94
|
+
- doc/dot/f_8.png
|
95
|
+
- doc/dot/m_8_0.dot
|
96
|
+
- doc/dot/m_8_0.png
|
97
|
+
- doc/dot/f_9.dot
|
98
|
+
- doc/dot/f_9.png
|
99
|
+
- doc/dot/m_9_0.dot
|
100
|
+
- doc/dot/m_9_0.png
|
101
|
+
- doc/dot/f_10.dot
|
102
|
+
- doc/dot/f_10.png
|
103
|
+
- doc/dot/m_10_0.dot
|
104
|
+
- doc/dot/m_10_0.png
|
105
|
+
- doc/dot/f_11.dot
|
106
|
+
- doc/dot/f_11.png
|
107
|
+
- doc/dot/f_12.dot
|
108
|
+
- doc/dot/f_12.png
|
109
|
+
- doc/dot/m_12_0.dot
|
110
|
+
- doc/dot/m_12_0.png
|
111
|
+
- doc/dot/f_13.dot
|
112
|
+
- doc/dot/f_13.png
|
113
|
+
- doc/dot/m_13_0.dot
|
114
|
+
- doc/dot/m_13_0.png
|
115
|
+
- doc/dot/f_14.dot
|
116
|
+
- doc/dot/f_14.png
|
117
|
+
- doc/dot/m_14_0.dot
|
118
|
+
- doc/dot/m_14_0.png
|
119
|
+
- doc/dot/f_15.dot
|
120
|
+
- doc/dot/f_15.png
|
121
|
+
- doc/dot/m_15_0.dot
|
122
|
+
- doc/dot/m_15_0.png
|
123
|
+
- doc/dot/f_16.dot
|
124
|
+
- doc/dot/f_16.png
|
125
|
+
- doc/dot/m_16_0.dot
|
126
|
+
- doc/dot/m_16_0.png
|
127
|
+
- doc/dot/f_17.dot
|
128
|
+
- doc/dot/f_17.png
|
129
|
+
- doc/dot/m_17_0.dot
|
130
|
+
- doc/dot/m_17_0.png
|
131
|
+
- doc/dot/f_18.dot
|
132
|
+
- doc/dot/f_18.png
|
133
|
+
- doc/dot/m_18_0.dot
|
134
|
+
- doc/dot/m_18_0.png
|
135
|
+
- doc/dot/f_19.dot
|
136
|
+
- doc/dot/f_19.png
|
137
|
+
- doc/dot/m_19_0.dot
|
138
|
+
- doc/dot/m_19_0.png
|
139
|
+
- doc/files/test
|
140
|
+
- doc/files/lib
|
141
|
+
- doc/files/test/extensionsTest_rb.html
|
142
|
+
- doc/files/test/ProblemTest_rb.html
|
143
|
+
- doc/files/test/DomainTest_rb.html
|
144
|
+
- doc/files/test/VariableTest_rb.html
|
145
|
+
- doc/files/test/SolutionTest_rb.html
|
146
|
+
- doc/files/test/BinaryConstraintTest_rb.html
|
147
|
+
- doc/files/test/TestSuite_rb.html
|
148
|
+
- doc/files/test/AllDifferentConstraintTest_rb.html
|
149
|
+
- doc/files/test/ConstraintListTest_rb.html
|
150
|
+
- doc/files/test/ConstraintSolverTest_rb.html
|
151
|
+
- doc/files/lib/BinaryConstraint_rb.html
|
152
|
+
- doc/files/lib/extensions_rb.html
|
153
|
+
- doc/files/lib/Problem_rb.html
|
154
|
+
- doc/files/lib/Variable_rb.html
|
155
|
+
- doc/files/lib/Domain_rb.html
|
156
|
+
- doc/files/lib/Solution_rb.html
|
157
|
+
- doc/files/lib/AbstractConstraint_rb.html
|
158
|
+
- doc/files/lib/ConstraintList_rb.html
|
159
|
+
- doc/files/lib/AllDifferentConstraint_rb.html
|
160
|
+
- doc/files/lib/ConstraintSolver_rb.html
|
161
|
+
- doc/classes/Array.html
|
162
|
+
- doc/classes/ExtensionsTest.html
|
163
|
+
- doc/classes/Fixnum.html
|
164
|
+
- doc/classes/ConstraintSolver.html
|
165
|
+
- doc/classes/ConstraintSolver
|
166
|
+
- doc/classes/ConstraintSolver/BinaryRelation.html
|
167
|
+
- doc/classes/ConstraintSolver/AllDifferentConstraintTest.html
|
168
|
+
- doc/classes/ConstraintSolver/SolutionTest.html
|
169
|
+
- doc/classes/ConstraintSolver/DomainWipeoutException.html
|
170
|
+
- doc/classes/ConstraintSolver/AbstractConstraint.html
|
171
|
+
- doc/classes/ConstraintSolver/ConstraintSolverTest.html
|
172
|
+
- doc/classes/ConstraintSolver/ConstraintListTest.html
|
173
|
+
- doc/classes/ConstraintSolver/Solution.html
|
174
|
+
- doc/classes/ConstraintSolver/VariableTest.html
|
175
|
+
- doc/classes/ConstraintSolver/Domain.html
|
176
|
+
- doc/classes/ConstraintSolver/DomainTest.html
|
177
|
+
- doc/classes/ConstraintSolver/ConstraintSolver.html
|
178
|
+
- doc/classes/ConstraintSolver/BinaryConstraintTest.html
|
179
|
+
- doc/classes/ConstraintSolver/Variable.html
|
180
|
+
- doc/classes/ConstraintSolver/ProblemTest.html
|
181
|
+
- doc/classes/ConstraintSolver/BinaryConstraint.html
|
182
|
+
- doc/classes/ConstraintSolver/BinaryRelationTest.html
|
183
|
+
- doc/classes/ConstraintSolver/ConstraintList.html
|
184
|
+
- doc/classes/ConstraintSolver/Problem.html
|
185
|
+
- doc/classes/ConstraintSolver/AllDifferentConstraint.html
|
186
|
+
- doc/classes/ConstraintSolver/UndoStackEmptyException.html
|
187
|
+
- bin/ConstraintSolver
|
188
|
+
- examples/example.rb
|
189
|
+
- examples/queens.rb
|
190
|
+
- examples/soft.rb
|
191
|
+
test_files:
|
192
|
+
- test/TestSuite.rb
|
193
|
+
rdoc_options: []
|
194
|
+
|
195
|
+
extra_rdoc_files: []
|
196
|
+
|
197
|
+
executables:
|
198
|
+
- ConstraintSolver
|
199
|
+
extensions: []
|
200
|
+
|
201
|
+
requirements: []
|
202
|
+
|
203
|
+
dependencies:
|
204
|
+
- !ruby/object:Gem::Dependency
|
205
|
+
name: log4r
|
206
|
+
version_requirement:
|
207
|
+
version_requirements: !ruby/object:Gem::Version::Requirement
|
208
|
+
requirements:
|
209
|
+
- - ">"
|
210
|
+
- !ruby/object:Gem::Version
|
211
|
+
version: 0.0.0
|
212
|
+
version:
|