ConstraintSolver 0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. data/bin/ConstraintSolver +24 -0
  2. data/doc/classes/Array.html +209 -0
  3. data/doc/classes/ConstraintSolver.html +242 -0
  4. data/doc/classes/ConstraintSolver/AbstractConstraint.html +317 -0
  5. data/doc/classes/ConstraintSolver/AllDifferentConstraint.html +451 -0
  6. data/doc/classes/ConstraintSolver/AllDifferentConstraintTest.html +397 -0
  7. data/doc/classes/ConstraintSolver/BinaryConstraint.html +483 -0
  8. data/doc/classes/ConstraintSolver/BinaryConstraintTest.html +367 -0
  9. data/doc/classes/ConstraintSolver/BinaryRelation.html +276 -0
  10. data/doc/classes/ConstraintSolver/BinaryRelationTest.html +194 -0
  11. data/doc/classes/ConstraintSolver/ConstraintList.html +208 -0
  12. data/doc/classes/ConstraintSolver/ConstraintListTest.html +252 -0
  13. data/doc/classes/ConstraintSolver/ConstraintSolver.html +353 -0
  14. data/doc/classes/ConstraintSolver/ConstraintSolverTest.html +403 -0
  15. data/doc/classes/ConstraintSolver/Domain.html +522 -0
  16. data/doc/classes/ConstraintSolver/DomainTest.html +356 -0
  17. data/doc/classes/ConstraintSolver/DomainWipeoutException.html +158 -0
  18. data/doc/classes/ConstraintSolver/Problem.html +239 -0
  19. data/doc/classes/ConstraintSolver/ProblemTest.html +227 -0
  20. data/doc/classes/ConstraintSolver/Solution.html +342 -0
  21. data/doc/classes/ConstraintSolver/SolutionTest.html +250 -0
  22. data/doc/classes/ConstraintSolver/UndoStackEmptyException.html +158 -0
  23. data/doc/classes/ConstraintSolver/Variable.html +418 -0
  24. data/doc/classes/ConstraintSolver/VariableTest.html +284 -0
  25. data/doc/classes/ExtensionsTest.html +233 -0
  26. data/doc/classes/Fixnum.html +153 -0
  27. data/doc/created.rid +1 -0
  28. data/doc/dot/f_0.dot +38 -0
  29. data/doc/dot/f_0.png +0 -0
  30. data/doc/dot/f_1.dot +392 -0
  31. data/doc/dot/f_1.png +0 -0
  32. data/doc/dot/f_10.dot +392 -0
  33. data/doc/dot/f_10.png +0 -0
  34. data/doc/dot/f_11.dot +38 -0
  35. data/doc/dot/f_11.png +0 -0
  36. data/doc/dot/f_12.dot +392 -0
  37. data/doc/dot/f_12.png +0 -0
  38. data/doc/dot/f_13.dot +392 -0
  39. data/doc/dot/f_13.png +0 -0
  40. data/doc/dot/f_14.dot +392 -0
  41. data/doc/dot/f_14.png +0 -0
  42. data/doc/dot/f_15.dot +392 -0
  43. data/doc/dot/f_15.png +0 -0
  44. data/doc/dot/f_16.dot +392 -0
  45. data/doc/dot/f_16.png +0 -0
  46. data/doc/dot/f_17.dot +392 -0
  47. data/doc/dot/f_17.png +0 -0
  48. data/doc/dot/f_18.dot +392 -0
  49. data/doc/dot/f_18.png +0 -0
  50. data/doc/dot/f_19.dot +392 -0
  51. data/doc/dot/f_19.png +0 -0
  52. data/doc/dot/f_2.dot +392 -0
  53. data/doc/dot/f_2.png +0 -0
  54. data/doc/dot/f_3.dot +392 -0
  55. data/doc/dot/f_3.png +0 -0
  56. data/doc/dot/f_4.dot +392 -0
  57. data/doc/dot/f_4.png +0 -0
  58. data/doc/dot/f_5.dot +392 -0
  59. data/doc/dot/f_5.png +0 -0
  60. data/doc/dot/f_6.dot +14 -0
  61. data/doc/dot/f_6.png +0 -0
  62. data/doc/dot/f_7.dot +392 -0
  63. data/doc/dot/f_7.png +0 -0
  64. data/doc/dot/f_8.dot +392 -0
  65. data/doc/dot/f_8.png +0 -0
  66. data/doc/dot/f_9.dot +392 -0
  67. data/doc/dot/f_9.png +0 -0
  68. data/doc/dot/m_10_0.dot +392 -0
  69. data/doc/dot/m_10_0.png +0 -0
  70. data/doc/dot/m_12_0.dot +392 -0
  71. data/doc/dot/m_12_0.png +0 -0
  72. data/doc/dot/m_13_0.dot +392 -0
  73. data/doc/dot/m_13_0.png +0 -0
  74. data/doc/dot/m_14_0.dot +392 -0
  75. data/doc/dot/m_14_0.png +0 -0
  76. data/doc/dot/m_15_0.dot +392 -0
  77. data/doc/dot/m_15_0.png +0 -0
  78. data/doc/dot/m_16_0.dot +392 -0
  79. data/doc/dot/m_16_0.png +0 -0
  80. data/doc/dot/m_17_0.dot +392 -0
  81. data/doc/dot/m_17_0.png +0 -0
  82. data/doc/dot/m_18_0.dot +392 -0
  83. data/doc/dot/m_18_0.png +0 -0
  84. data/doc/dot/m_19_0.dot +392 -0
  85. data/doc/dot/m_19_0.png +0 -0
  86. data/doc/dot/m_1_0.dot +392 -0
  87. data/doc/dot/m_1_0.png +0 -0
  88. data/doc/dot/m_2_0.dot +392 -0
  89. data/doc/dot/m_2_0.png +0 -0
  90. data/doc/dot/m_3_0.dot +392 -0
  91. data/doc/dot/m_3_0.png +0 -0
  92. data/doc/dot/m_4_0.dot +392 -0
  93. data/doc/dot/m_4_0.png +0 -0
  94. data/doc/dot/m_5_0.dot +392 -0
  95. data/doc/dot/m_5_0.png +0 -0
  96. data/doc/dot/m_7_0.dot +392 -0
  97. data/doc/dot/m_7_0.png +0 -0
  98. data/doc/dot/m_8_0.dot +392 -0
  99. data/doc/dot/m_8_0.png +0 -0
  100. data/doc/dot/m_9_0.dot +392 -0
  101. data/doc/dot/m_9_0.png +0 -0
  102. data/doc/files/lib/AbstractConstraint_rb.html +148 -0
  103. data/doc/files/lib/AllDifferentConstraint_rb.html +156 -0
  104. data/doc/files/lib/BinaryConstraint_rb.html +155 -0
  105. data/doc/files/lib/ConstraintList_rb.html +148 -0
  106. data/doc/files/lib/ConstraintSolver_rb.html +162 -0
  107. data/doc/files/lib/Domain_rb.html +155 -0
  108. data/doc/files/lib/Problem_rb.html +148 -0
  109. data/doc/files/lib/Solution_rb.html +148 -0
  110. data/doc/files/lib/Variable_rb.html +148 -0
  111. data/doc/files/lib/extensions_rb.html +108 -0
  112. data/doc/files/test/AllDifferentConstraintTest_rb.html +158 -0
  113. data/doc/files/test/BinaryConstraintTest_rb.html +158 -0
  114. data/doc/files/test/ConstraintListTest_rb.html +160 -0
  115. data/doc/files/test/ConstraintSolverTest_rb.html +164 -0
  116. data/doc/files/test/DomainTest_rb.html +156 -0
  117. data/doc/files/test/ProblemTest_rb.html +160 -0
  118. data/doc/files/test/SolutionTest_rb.html +159 -0
  119. data/doc/files/test/TestSuite_rb.html +113 -0
  120. data/doc/files/test/VariableTest_rb.html +157 -0
  121. data/doc/files/test/extensionsTest_rb.html +118 -0
  122. data/doc/fr_class_index.html +51 -0
  123. data/doc/fr_file_index.html +46 -0
  124. data/doc/fr_method_index.html +133 -0
  125. data/doc/index.html +24 -0
  126. data/examples/example.rb +7 -0
  127. data/examples/queens.rb +13 -0
  128. data/examples/soft.rb +14 -0
  129. data/lib/AbstractConstraint.rb +45 -0
  130. data/lib/AllDifferentConstraint.rb +160 -0
  131. data/lib/BinaryConstraint.rb +187 -0
  132. data/lib/ConstraintList.rb +31 -0
  133. data/lib/ConstraintSolver.rb +213 -0
  134. data/lib/Domain.rb +100 -0
  135. data/lib/GraphUtils.rb +293 -0
  136. data/lib/OneOfEqualsConstraint.rb +81 -0
  137. data/lib/Problem.rb +30 -0
  138. data/lib/Solution.rb +56 -0
  139. data/lib/TupleConstraint.rb +111 -0
  140. data/lib/Variable.rb +74 -0
  141. data/lib/extensions.rb +55 -0
  142. data/test/AllDifferentConstraintTest.rb +140 -0
  143. data/test/BinaryConstraintTest.rb +108 -0
  144. data/test/ConstraintListTest.rb +41 -0
  145. data/test/ConstraintSolverTest.rb +274 -0
  146. data/test/DomainTest.rb +83 -0
  147. data/test/GraphUtilsTest.rb +83 -0
  148. data/test/OneOfEqualsConstraintTest.rb +82 -0
  149. data/test/ProblemTest.rb +35 -0
  150. data/test/SolutionTest.rb +35 -0
  151. data/test/TestSuite.rb +10 -0
  152. data/test/TupleConstraintTest.rb +151 -0
  153. data/test/VariableTest.rb +47 -0
  154. data/test/extensionsTest.rb +57 -0
  155. metadata +212 -0
@@ -0,0 +1,239 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Class: ConstraintSolver::Problem</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Class</strong></td>
53
+ <td class="class-name-in-header">ConstraintSolver::Problem</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/lib/Problem_rb.html">
59
+ lib/Problem.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ <tr class="top-aligned-row">
66
+ <td><strong>Parent:</strong></td>
67
+ <td>
68
+ Object
69
+ </td>
70
+ </tr>
71
+ </table>
72
+ </div>
73
+ <!-- banner header -->
74
+
75
+ <div id="bodyContent">
76
+
77
+
78
+
79
+ <div id="contextContent">
80
+ <div id="diagram">
81
+ <map id="map" name="map">
82
+ <area shape="rect" coords="1537,5,1665,53" href="../Test/Unit/TestCase.html" alt="Test::Unit::TestCase" />
83
+ <area shape="rect" coords="937,133,1089,181" href="AllDifferentConstraintTest.html" alt="AllDifferentConstraintTest" />
84
+ <area shape="rect" coords="2305,133,2396,181" href="SolutionTest.html" alt="SolutionTest" />
85
+ <area shape="rect" coords="204,133,335,181" href="ConstraintSolverTest.html" alt="ConstraintSolverTest" />
86
+ <area shape="rect" coords="1923,133,2040,181" href="ConstraintListTest.html" alt="ConstraintListTest" />
87
+ <area shape="rect" coords="1123,133,1213,181" href="VariableTest.html" alt="VariableTest" />
88
+ <area shape="rect" coords="2429,133,2517,181" href="DomainTest.html" alt="DomainTest" />
89
+ <area shape="rect" coords="1387,133,1517,181" href="BinaryConstraintTest.html" alt="BinaryConstraintTest" />
90
+ <area shape="rect" coords="1797,133,1888,181" href="ProblemTest.html" alt="ProblemTest" />
91
+ <area shape="rect" coords="1541,133,1661,181" href="BinaryRelationTest.html" alt="BinaryRelationTest" />
92
+ <area shape="rect" coords="589,5,667,53" href="../Exception.html" alt="Exception" />
93
+ <area shape="rect" coords="463,133,615,181" href="DomainWipeoutException.html" alt="DomainWipeoutException" />
94
+ <area shape="rect" coords="639,133,799,181" href="UndoStackEmptyException.html" alt="UndoStackEmptyException" />
95
+ <area shape="rect" coords="53,133,171,181" href="AbstractConstraint.html" alt="AbstractConstraint" />
96
+ <area shape="rect" coords="160,237,269,285" href="BinaryConstraint.html" alt="BinaryConstraint" />
97
+ <area shape="rect" coords="301,237,432,285" href="AllDifferentConstraint.html" alt="AllDifferentConstraint" />
98
+ <area shape="rect" coords="2085,5,2157,53" href="../Array.html" alt="Array" />
99
+ <area shape="rect" coords="2073,133,2169,181" href="ConstraintList.html" alt="ConstraintList" />
100
+ <area shape="rect" coords="37,237,136,285" href="BinaryRelation.html" alt="BinaryRelation" />
101
+ <area shape="rect" coords="2201,133,2273,181" href="Variable.html" alt="Variable" />
102
+ <area shape="rect" coords="1693,133,1765,181" href="Solution.html" alt="Solution" />
103
+ <area shape="rect" coords="1245,133,1355,181" href="ConstraintSolver.html" alt="ConstraintSolver" />
104
+ <area shape="rect" coords="831,133,903,181" href="Problem.html" alt="Problem" />
105
+ <area shape="rect" coords="367,133,439,181" href="Domain.html" alt="Domain" />
106
+ <area shape="rect" coords="2419,99,2531,192" href="../ConstraintSolver.html" alt="test/DomainTest.rb" />
107
+ <area shape="rect" coords="2295,99,2408,192" href="../ConstraintSolver.html" alt="test/SolutionTest.rb" />
108
+ <area shape="rect" coords="27,203,280,296" href="../ConstraintSolver.html" alt="lib/BinaryConstraint.rb" />
109
+ <area shape="rect" coords="2191,99,2284,192" href="../ConstraintSolver.html" alt="lib/Variable.rb" />
110
+ <area shape="rect" coords="1912,99,2052,192" href="../ConstraintSolver.html" alt="test/ConstraintListTest.rb" />
111
+ <area shape="rect" coords="2063,99,2180,192" href="../ConstraintSolver.html" alt="lib/ConstraintList.rb" />
112
+ <area shape="rect" coords="1787,99,1901,192" href="../ConstraintSolver.html" alt="test/ProblemTest.rb" />
113
+ <area shape="rect" coords="1683,99,1776,192" href="../ConstraintSolver.html" alt="lib/Solution.rb" />
114
+ <area shape="rect" coords="1376,99,1672,192" href="../ConstraintSolver.html" alt="test/BinaryConstraintTest.rb" />
115
+ <area shape="rect" coords="1235,99,1365,192" href="../ConstraintSolver.html" alt="lib/ConstraintSolver.rb" />
116
+ <area shape="rect" coords="1111,99,1224,192" href="../ConstraintSolver.html" alt="test/VariableTest.rb" />
117
+ <area shape="rect" coords="924,99,1100,192" href="../ConstraintSolver.html" alt="test/AllDifferentConstraintTest.rb" />
118
+ <area shape="rect" coords="291,203,443,296" href="../ConstraintSolver.html" alt="lib/AllDifferentConstraint.rb" />
119
+ <area shape="rect" coords="820,99,913,192" href="../ConstraintSolver.html" alt="lib/Problem.rb" />
120
+ <area shape="rect" coords="192,99,345,192" href="../ConstraintSolver.html" alt="test/ConstraintSolverTest.rb" />
121
+ <area shape="rect" coords="356,99,809,192" href="../ConstraintSolver.html" alt="lib/Domain.rb" />
122
+ <area shape="rect" coords="43,99,181,192" href="../ConstraintSolver.html" alt="lib/AbstractConstraint.rb" />
123
+ <area shape="rect" coords="16,64,2541,307" href="../ConstraintSolver.html" alt="ConstraintSolver" />
124
+ </map>
125
+ <img src="../../dot/m_19_0.png" usemap="#map" border="0" alt="dot/m_19_0.png">
126
+ </div>
127
+
128
+ <div id="description">
129
+ <p>
130
+ Representation of a constraint satisfaction problem.
131
+ </p>
132
+
133
+ </div>
134
+
135
+
136
+ </div>
137
+
138
+ <div id="method-list">
139
+ <h3 class="section-bar">Methods</h3>
140
+
141
+ <div class="name-list">
142
+ <a href="#M000098">new</a>&nbsp;&nbsp;
143
+ </div>
144
+ </div>
145
+
146
+ </div>
147
+
148
+
149
+ <!-- if includes -->
150
+
151
+ <div id="section">
152
+
153
+
154
+
155
+
156
+
157
+ <div id="attribute-list">
158
+ <h3 class="section-bar">Attributes</h3>
159
+
160
+ <div class="name-list">
161
+ <table>
162
+ <tr class="top-aligned-row context-row">
163
+ <td class="context-item-name">constraints</td>
164
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
165
+ <td class="context-item-desc"></td>
166
+ </tr>
167
+ <tr class="top-aligned-row context-row">
168
+ <td class="context-item-name">meritMap</td>
169
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
170
+ <td class="context-item-desc"></td>
171
+ </tr>
172
+ <tr class="top-aligned-row context-row">
173
+ <td class="context-item-name">variables</td>
174
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
175
+ <td class="context-item-desc"></td>
176
+ </tr>
177
+ </table>
178
+ </div>
179
+ </div>
180
+
181
+
182
+
183
+ <!-- if method_list -->
184
+ <div id="methods">
185
+ <h3 class="section-bar">Public Class methods</h3>
186
+
187
+ <div id="method-M000098" class="method-detail">
188
+ <a name="M000098"></a>
189
+
190
+ <div class="method-heading">
191
+ <a href="#M000098" class="method-signature">
192
+ <span class="method-name">new</span><span class="method-args">(variables, constraints, meritMap={})</span>
193
+ </a>
194
+ </div>
195
+
196
+ <div class="method-description">
197
+ <p>
198
+ Creates a <a href="Problem.html#M000098">new</a> instances of a constraint
199
+ satisfaction problem. The constructor takes the lists of variables and
200
+ constraints as parameters. Optionally, a map that maps domain elements to
201
+ their merit can be specified.
202
+ </p>
203
+ <p><a class="source-toggle" href="#"
204
+ onclick="toggleCode('M000098-source');return false;">[Source]</a></p>
205
+ <div class="method-source-code" id="M000098-source">
206
+ <pre>
207
+ <span class="ruby-comment cmt"># File lib/Problem.rb, line 11</span>
208
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">variables</span>, <span class="ruby-identifier">constraints</span>, <span class="ruby-identifier">meritMap</span>={})
209
+ <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">variables</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">Array</span>)
210
+ <span class="ruby-identifier">variables</span> = [ <span class="ruby-identifier">variables</span> ]
211
+ <span class="ruby-keyword kw">end</span>
212
+ <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">constraints</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">ConstraintList</span>)
213
+ <span class="ruby-identifier">constraints</span> = <span class="ruby-constant">ConstraintList</span>.<span class="ruby-identifier">new</span>([ <span class="ruby-identifier">constraints</span> ])
214
+ <span class="ruby-keyword kw">end</span>
215
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">variables</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">constraints</span>.<span class="ruby-identifier">empty?</span>
216
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">&quot;Variables and constraints must not be empty!&quot;</span>
217
+ <span class="ruby-keyword kw">end</span>
218
+ <span class="ruby-ivar">@variables</span> = <span class="ruby-identifier">variables</span>
219
+ <span class="ruby-ivar">@constraints</span> = <span class="ruby-identifier">constraints</span>
220
+ <span class="ruby-ivar">@meritMap</span> = <span class="ruby-identifier">meritMap</span>
221
+ <span class="ruby-keyword kw">end</span>
222
+ </pre>
223
+ </div>
224
+ </div>
225
+ </div>
226
+
227
+
228
+ </div>
229
+
230
+
231
+ </div>
232
+
233
+
234
+ <div id="validator-badges">
235
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
236
+ </div>
237
+
238
+ </body>
239
+ </html>
@@ -0,0 +1,227 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Class: ConstraintSolver::ProblemTest</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Class</strong></td>
53
+ <td class="class-name-in-header">ConstraintSolver::ProblemTest</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/test/ProblemTest_rb.html">
59
+ test/ProblemTest.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ <tr class="top-aligned-row">
66
+ <td><strong>Parent:</strong></td>
67
+ <td>
68
+ Test::Unit::TestCase
69
+ </td>
70
+ </tr>
71
+ </table>
72
+ </div>
73
+ <!-- banner header -->
74
+
75
+ <div id="bodyContent">
76
+
77
+
78
+
79
+ <div id="contextContent">
80
+ <div id="diagram">
81
+ <map id="map" name="map">
82
+ <area shape="rect" coords="1537,5,1665,53" href="../Test/Unit/TestCase.html" alt="Test::Unit::TestCase" />
83
+ <area shape="rect" coords="937,133,1089,181" href="AllDifferentConstraintTest.html" alt="AllDifferentConstraintTest" />
84
+ <area shape="rect" coords="2305,133,2396,181" href="SolutionTest.html" alt="SolutionTest" />
85
+ <area shape="rect" coords="204,133,335,181" href="ConstraintSolverTest.html" alt="ConstraintSolverTest" />
86
+ <area shape="rect" coords="1923,133,2040,181" href="ConstraintListTest.html" alt="ConstraintListTest" />
87
+ <area shape="rect" coords="1123,133,1213,181" href="VariableTest.html" alt="VariableTest" />
88
+ <area shape="rect" coords="2429,133,2517,181" href="DomainTest.html" alt="DomainTest" />
89
+ <area shape="rect" coords="1387,133,1517,181" href="BinaryConstraintTest.html" alt="BinaryConstraintTest" />
90
+ <area shape="rect" coords="1797,133,1888,181" href="ProblemTest.html" alt="ProblemTest" />
91
+ <area shape="rect" coords="1541,133,1661,181" href="BinaryRelationTest.html" alt="BinaryRelationTest" />
92
+ <area shape="rect" coords="589,5,667,53" href="../Exception.html" alt="Exception" />
93
+ <area shape="rect" coords="463,133,615,181" href="DomainWipeoutException.html" alt="DomainWipeoutException" />
94
+ <area shape="rect" coords="639,133,799,181" href="UndoStackEmptyException.html" alt="UndoStackEmptyException" />
95
+ <area shape="rect" coords="53,133,171,181" href="AbstractConstraint.html" alt="AbstractConstraint" />
96
+ <area shape="rect" coords="160,237,269,285" href="BinaryConstraint.html" alt="BinaryConstraint" />
97
+ <area shape="rect" coords="301,237,432,285" href="AllDifferentConstraint.html" alt="AllDifferentConstraint" />
98
+ <area shape="rect" coords="2085,5,2157,53" href="../Array.html" alt="Array" />
99
+ <area shape="rect" coords="2073,133,2169,181" href="ConstraintList.html" alt="ConstraintList" />
100
+ <area shape="rect" coords="37,237,136,285" href="BinaryRelation.html" alt="BinaryRelation" />
101
+ <area shape="rect" coords="2201,133,2273,181" href="Variable.html" alt="Variable" />
102
+ <area shape="rect" coords="1693,133,1765,181" href="Solution.html" alt="Solution" />
103
+ <area shape="rect" coords="1245,133,1355,181" href="ConstraintSolver.html" alt="ConstraintSolver" />
104
+ <area shape="rect" coords="831,133,903,181" href="Problem.html" alt="Problem" />
105
+ <area shape="rect" coords="367,133,439,181" href="Domain.html" alt="Domain" />
106
+ <area shape="rect" coords="2419,99,2531,192" href="../ConstraintSolver.html" alt="test/DomainTest.rb" />
107
+ <area shape="rect" coords="2295,99,2408,192" href="../ConstraintSolver.html" alt="test/SolutionTest.rb" />
108
+ <area shape="rect" coords="27,203,280,296" href="../ConstraintSolver.html" alt="lib/BinaryConstraint.rb" />
109
+ <area shape="rect" coords="2191,99,2284,192" href="../ConstraintSolver.html" alt="lib/Variable.rb" />
110
+ <area shape="rect" coords="1912,99,2052,192" href="../ConstraintSolver.html" alt="test/ConstraintListTest.rb" />
111
+ <area shape="rect" coords="2063,99,2180,192" href="../ConstraintSolver.html" alt="lib/ConstraintList.rb" />
112
+ <area shape="rect" coords="1787,99,1901,192" href="../ConstraintSolver.html" alt="test/ProblemTest.rb" />
113
+ <area shape="rect" coords="1683,99,1776,192" href="../ConstraintSolver.html" alt="lib/Solution.rb" />
114
+ <area shape="rect" coords="1376,99,1672,192" href="../ConstraintSolver.html" alt="test/BinaryConstraintTest.rb" />
115
+ <area shape="rect" coords="1235,99,1365,192" href="../ConstraintSolver.html" alt="lib/ConstraintSolver.rb" />
116
+ <area shape="rect" coords="1111,99,1224,192" href="../ConstraintSolver.html" alt="test/VariableTest.rb" />
117
+ <area shape="rect" coords="924,99,1100,192" href="../ConstraintSolver.html" alt="test/AllDifferentConstraintTest.rb" />
118
+ <area shape="rect" coords="291,203,443,296" href="../ConstraintSolver.html" alt="lib/AllDifferentConstraint.rb" />
119
+ <area shape="rect" coords="820,99,913,192" href="../ConstraintSolver.html" alt="lib/Problem.rb" />
120
+ <area shape="rect" coords="192,99,345,192" href="../ConstraintSolver.html" alt="test/ConstraintSolverTest.rb" />
121
+ <area shape="rect" coords="356,99,809,192" href="../ConstraintSolver.html" alt="lib/Domain.rb" />
122
+ <area shape="rect" coords="43,99,181,192" href="../ConstraintSolver.html" alt="lib/AbstractConstraint.rb" />
123
+ <area shape="rect" coords="16,64,2541,307" href="../ConstraintSolver.html" alt="ConstraintSolver" />
124
+ </map>
125
+ <img src="../../dot/m_19_0.png" usemap="#map" border="0" alt="dot/m_19_0.png">
126
+ </div>
127
+
128
+
129
+
130
+ </div>
131
+
132
+ <div id="method-list">
133
+ <h3 class="section-bar">Methods</h3>
134
+
135
+ <div class="name-list">
136
+ <a href="#M000085">setup</a>&nbsp;&nbsp;
137
+ <a href="#M000086">testConstructor</a>&nbsp;&nbsp;
138
+ </div>
139
+ </div>
140
+
141
+ </div>
142
+
143
+
144
+ <!-- if includes -->
145
+
146
+ <div id="section">
147
+
148
+
149
+
150
+
151
+
152
+
153
+
154
+
155
+ <!-- if method_list -->
156
+ <div id="methods">
157
+ <h3 class="section-bar">Public Instance methods</h3>
158
+
159
+ <div id="method-M000085" class="method-detail">
160
+ <a name="M000085"></a>
161
+
162
+ <div class="method-heading">
163
+ <a href="#M000085" class="method-signature">
164
+ <span class="method-name">setup</span><span class="method-args">()</span>
165
+ </a>
166
+ </div>
167
+
168
+ <div class="method-description">
169
+ <p><a class="source-toggle" href="#"
170
+ onclick="toggleCode('M000085-source');return false;">[Source]</a></p>
171
+ <div class="method-source-code" id="M000085-source">
172
+ <pre>
173
+ <span class="ruby-comment cmt"># File test/ProblemTest.rb, line 14</span>
174
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">setup</span>
175
+ <span class="ruby-ivar">@var1</span> = <span class="ruby-constant">Variable</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">&quot;var1&quot;</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-value">1</span>)
176
+ <span class="ruby-identifier">var2</span> = <span class="ruby-constant">Variable</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">&quot;var2&quot;</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-value">2</span>)
177
+ <span class="ruby-identifier">var3</span> = <span class="ruby-constant">Variable</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">&quot;var3&quot;</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-value">3</span>)
178
+
179
+ <span class="ruby-ivar">@c1</span> = <span class="ruby-constant">BinaryConstraint</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@var1</span>, <span class="ruby-identifier">var2</span>, <span class="ruby-constant">Proc</span>.<span class="ruby-identifier">new</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">a</span>, <span class="ruby-identifier">b</span><span class="ruby-operator">|</span> <span class="ruby-identifier">a</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">b</span> })
180
+ <span class="ruby-identifier">c2</span> = <span class="ruby-constant">BinaryConstraint</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">var2</span>, <span class="ruby-identifier">var3</span>, <span class="ruby-constant">Proc</span>.<span class="ruby-identifier">new</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">a</span>, <span class="ruby-identifier">b</span><span class="ruby-operator">|</span> <span class="ruby-identifier">a</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">b</span> })
181
+
182
+ <span class="ruby-ivar">@problem</span> = <span class="ruby-constant">Problem</span>.<span class="ruby-identifier">new</span>([ <span class="ruby-ivar">@var1</span>, <span class="ruby-identifier">var2</span>, <span class="ruby-identifier">var3</span> ], <span class="ruby-constant">ConstraintList</span>.<span class="ruby-identifier">new</span>([ <span class="ruby-ivar">@c1</span>, <span class="ruby-identifier">c2</span> ]))
183
+ <span class="ruby-keyword kw">end</span>
184
+ </pre>
185
+ </div>
186
+ </div>
187
+ </div>
188
+
189
+ <div id="method-M000086" class="method-detail">
190
+ <a name="M000086"></a>
191
+
192
+ <div class="method-heading">
193
+ <a href="#M000086" class="method-signature">
194
+ <span class="method-name">testConstructor</span><span class="method-args">()</span>
195
+ </a>
196
+ </div>
197
+
198
+ <div class="method-description">
199
+ <p><a class="source-toggle" href="#"
200
+ onclick="toggleCode('M000086-source');return false;">[Source]</a></p>
201
+ <div class="method-source-code" id="M000086-source">
202
+ <pre>
203
+ <span class="ruby-comment cmt"># File test/ProblemTest.rb, line 25</span>
204
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">testConstructor</span>
205
+ <span class="ruby-identifier">assert_raise</span>(<span class="ruby-constant">ArgumentError</span>) { <span class="ruby-constant">Problem</span>.<span class="ruby-identifier">new</span> }
206
+ <span class="ruby-identifier">assert_raise</span>(<span class="ruby-constant">ArgumentError</span>) { <span class="ruby-constant">Problem</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>, <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>) }
207
+ <span class="ruby-identifier">assert_nothing_raised</span> { <span class="ruby-constant">Problem</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@var1</span>, <span class="ruby-ivar">@c1</span>) }
208
+ <span class="ruby-identifier">assert_nothing_raised</span> { <span class="ruby-constant">Problem</span>.<span class="ruby-identifier">new</span>([ <span class="ruby-ivar">@var1</span> ], [ <span class="ruby-ivar">@c1</span> ]) }
209
+ <span class="ruby-keyword kw">end</span>
210
+ </pre>
211
+ </div>
212
+ </div>
213
+ </div>
214
+
215
+
216
+ </div>
217
+
218
+
219
+ </div>
220
+
221
+
222
+ <div id="validator-badges">
223
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
224
+ </div>
225
+
226
+ </body>
227
+ </html>