ravensat 0.3.1 → 1.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 (51) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +44 -21
  3. data/docs/Arcteryx/CNF.html +827 -0
  4. data/docs/Arcteryx.html +309 -0
  5. data/docs/Ravensat/AndNode.html +159 -0
  6. data/docs/Ravensat/Claw.html +338 -0
  7. data/docs/Ravensat/DimacsDecoder.html +224 -0
  8. data/docs/Ravensat/DimacsEncoder.html +425 -0
  9. data/docs/Ravensat/Extension/BooleanVariable.html +229 -0
  10. data/docs/Ravensat/Extension/Domain.html +319 -0
  11. data/docs/Ravensat/Extension/IntegerVariable.html +589 -0
  12. data/docs/Ravensat/Extension/UndefinedVariable.html +236 -0
  13. data/docs/Ravensat/Extension/Variable.html +443 -0
  14. data/docs/Ravensat/Extension.html +141 -0
  15. data/docs/Ravensat/InitialNode.html +267 -0
  16. data/docs/Ravensat/Node.html +780 -0
  17. data/docs/Ravensat/NotNode.html +159 -0
  18. data/docs/Ravensat/OprNode.html +226 -0
  19. data/docs/Ravensat/OrNode.html +252 -0
  20. data/docs/Ravensat/Solver.html +373 -0
  21. data/docs/Ravensat/VarNode.html +488 -0
  22. data/docs/Ravensat.html +135 -0
  23. data/docs/_index.html +329 -0
  24. data/docs/class_list.html +51 -0
  25. data/docs/css/common.css +1 -0
  26. data/docs/css/full_list.css +58 -0
  27. data/docs/css/style.css +497 -0
  28. data/docs/file.README.html +233 -0
  29. data/docs/file_list.html +56 -0
  30. data/docs/frames.html +17 -0
  31. data/docs/index.html +233 -0
  32. data/docs/js/app.js +314 -0
  33. data/docs/js/full_list.js +216 -0
  34. data/docs/js/jquery.js +4 -0
  35. data/docs/method_list.html +523 -0
  36. data/docs/top-level-namespace.html +110 -0
  37. data/lib/ravensat/ast/and_node.rb +8 -0
  38. data/lib/ravensat/ast/node.rb +50 -15
  39. data/lib/ravensat/ast/not_node.rb +7 -0
  40. data/lib/ravensat/ast/or_node.rb +9 -0
  41. data/lib/ravensat/ast/var_node.rb +6 -1
  42. data/lib/ravensat/claw.rb +45 -0
  43. data/lib/ravensat/dimacs/dimacs_decoder.rb +6 -12
  44. data/lib/ravensat/dimacs/dimacs_encoder.rb +10 -13
  45. data/lib/ravensat/extension/variable/integer_variable.rb +3 -3
  46. data/lib/ravensat/solver.rb +1 -1
  47. data/lib/ravensat/version.rb +1 -1
  48. data/lib/ravensat.rb +1 -1
  49. metadata +37 -4
  50. data/Gemfile.lock +0 -45
  51. data/lib/ravensat/ravenclaw.rb +0 -19
@@ -0,0 +1,309 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ Module: Arcteryx
8
+
9
+ &mdash; Documentation by YARD 0.9.27
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" />
14
+
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" />
16
+
17
+ <script type="text/javascript">
18
+ pathId = "Arcteryx";
19
+ relpath = '';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div class="nav_wrap">
31
+ <iframe id="nav" src="class_list.html?1"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="_index.html">Index (A)</a> &raquo;
40
+
41
+
42
+ <span class="title">Arcteryx</span>
43
+
44
+ </div>
45
+
46
+ <div id="search">
47
+
48
+ <a class="full_list_link" id="class_list_link"
49
+ href="class_list.html">
50
+
51
+ <svg width="24" height="24">
52
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
+ </svg>
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <div id="content"><h1>Module: Arcteryx
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+ <dl>
80
+ <dt>Defined in:</dt>
81
+ <dd>lib/arcteryx/cnf.rb<span class="defines">,<br />
82
+ lib/arcteryx/arcteryx.rb</span>
83
+ </dd>
84
+ </dl>
85
+
86
+ </div>
87
+
88
+ <h2>Defined Under Namespace</h2>
89
+ <p class="children">
90
+
91
+
92
+
93
+
94
+ <strong class="classes">Classes:</strong> <span class='object_link'><a href="Arcteryx/CNF.html" title="Arcteryx::CNF (class)">CNF</a></span>
95
+
96
+
97
+ </p>
98
+
99
+
100
+ <h2>
101
+ Constant Summary
102
+ <small><a href="#" class="constants_summary_toggle">collapse</a></small>
103
+ </h2>
104
+
105
+ <dl class="constants">
106
+
107
+ <dt id="SAT-constant" class="">SAT =
108
+
109
+ </dt>
110
+ <dd><pre class="code"><span class='kw'>true</span></pre></dd>
111
+
112
+ <dt id="UNSAT-constant" class="">UNSAT =
113
+
114
+ </dt>
115
+ <dd><pre class="code"><span class='kw'>false</span></pre></dd>
116
+
117
+ </dl>
118
+
119
+
120
+
121
+
122
+
123
+
124
+
125
+
126
+
127
+ <h2>
128
+ Class Method Summary
129
+ <small><a href="#" class="summary_toggle">collapse</a></small>
130
+ </h2>
131
+
132
+ <ul class="summary">
133
+
134
+ <li class="public ">
135
+ <span class="summary_signature">
136
+
137
+ <a href="#DPLL-class_method" title="DPLL (class method)">.<strong>DPLL</strong>(cnf) &#x21d2; Object </a>
138
+
139
+
140
+
141
+ </span>
142
+
143
+
144
+
145
+
146
+
147
+
148
+
149
+
150
+
151
+ <span class="summary_desc"><div class='inline'></div></span>
152
+
153
+ </li>
154
+
155
+
156
+ <li class="public ">
157
+ <span class="summary_signature">
158
+
159
+ <a href="#solve-class_method" title="solve (class method)">.<strong>solve</strong>(input_file, output_file = nil) &#x21d2; Object </a>
160
+
161
+
162
+
163
+ </span>
164
+
165
+
166
+
167
+
168
+
169
+
170
+
171
+
172
+
173
+ <span class="summary_desc"><div class='inline'></div></span>
174
+
175
+ </li>
176
+
177
+
178
+ </ul>
179
+
180
+
181
+
182
+
183
+ <div id="class_method_details" class="method_details_list">
184
+ <h2>Class Method Details</h2>
185
+
186
+
187
+ <div class="method_details first">
188
+ <h3 class="signature first" id="DPLL-class_method">
189
+
190
+ .<strong>DPLL</strong>(cnf) &#x21d2; <tt>Object</tt>
191
+
192
+
193
+
194
+
195
+
196
+ </h3><table class="source_code">
197
+ <tr>
198
+ <td>
199
+ <pre class="lines">
200
+
201
+
202
+ 6
203
+ 7
204
+ 8
205
+ 9
206
+ 10
207
+ 11
208
+ 12
209
+ 13</pre>
210
+ </td>
211
+ <td>
212
+ <pre class="code"><span class="info file"># File 'lib/arcteryx/arcteryx.rb', line 6</span>
213
+
214
+ <span class='kw'>def</span> <span class='const'>DPLL</span><span class='lparen'>(</span><span class='id identifier rubyid_cnf'>cnf</span><span class='rparen'>)</span>
215
+ <span class='kw'>if</span> <span class='id identifier rubyid_cnf'>cnf</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span> <span class='kw'>then</span> <span class='kw'>return</span> <span class='const'><span class='object_link'><a href="#SAT-constant" title="Arcteryx::SAT (constant)">SAT</a></span></span> <span class='kw'>end</span>
216
+ <span class='id identifier rubyid_cnf'>cnf</span><span class='period'>.</span><span class='id identifier rubyid_unit_propagation'>unit_propagation</span>
217
+ <span class='kw'>if</span> <span class='id identifier rubyid_cnf'>cnf</span><span class='period'>.</span><span class='id identifier rubyid_exist_empty_clause?'>exist_empty_clause?</span> <span class='kw'>then</span> <span class='kw'>return</span> <span class='const'><span class='object_link'><a href="#UNSAT-constant" title="Arcteryx::UNSAT (constant)">UNSAT</a></span></span> <span class='kw'>end</span>
218
+ <span class='id identifier rubyid_x'>x</span> <span class='op'>=</span> <span class='id identifier rubyid_cnf'>cnf</span><span class='period'>.</span><span class='id identifier rubyid_choose_variable'>choose_variable</span>
219
+ <span class='id identifier rubyid_dup_cnf'>dup_cnf</span> <span class='op'>=</span> <span class='id identifier rubyid_cnf'>cnf</span><span class='period'>.</span><span class='id identifier rubyid_deep_dup'>deep_dup</span>
220
+ <span class='kw'>return</span> <span class='const'>DPLL</span><span class='lparen'>(</span><span class='id identifier rubyid_cnf'>cnf</span><span class='period'>.</span><span class='id identifier rubyid_append'>append</span> <span class='id identifier rubyid_x'>x</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='const'>DPLL</span><span class='lparen'>(</span><span class='id identifier rubyid_dup_cnf'>dup_cnf</span><span class='period'>.</span><span class='id identifier rubyid_append'>append</span> <span class='op'>-</span><span class='int'>1</span><span class='op'>*</span><span class='id identifier rubyid_x'>x</span><span class='rparen'>)</span>
221
+ <span class='kw'>end</span></pre>
222
+ </td>
223
+ </tr>
224
+ </table>
225
+ </div>
226
+
227
+ <div class="method_details ">
228
+ <h3 class="signature " id="solve-class_method">
229
+
230
+ .<strong>solve</strong>(input_file, output_file = nil) &#x21d2; <tt>Object</tt>
231
+
232
+
233
+
234
+
235
+
236
+ </h3><table class="source_code">
237
+ <tr>
238
+ <td>
239
+ <pre class="lines">
240
+
241
+
242
+ 15
243
+ 16
244
+ 17
245
+ 18
246
+ 19
247
+ 20
248
+ 21
249
+ 22
250
+ 23
251
+ 24
252
+ 25
253
+ 26
254
+ 27
255
+ 28
256
+ 29
257
+ 30
258
+ 31
259
+ 32
260
+ 33
261
+ 34
262
+ 35
263
+ 36
264
+ 37</pre>
265
+ </td>
266
+ <td>
267
+ <pre class="code"><span class="info file"># File 'lib/arcteryx/arcteryx.rb', line 15</span>
268
+
269
+ <span class='kw'>def</span> <span class='id identifier rubyid_solve'>solve</span><span class='lparen'>(</span> <span class='id identifier rubyid_input_file'>input_file</span><span class='comma'>,</span> <span class='id identifier rubyid_output_file'>output_file</span> <span class='op'>=</span> <span class='kw'>nil</span> <span class='rparen'>)</span>
270
+ <span class='id identifier rubyid_cnf'>cnf</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="" title="Arcteryx (module)">Arcteryx</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Arcteryx/CNF.html" title="Arcteryx::CNF (class)">CNF</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Arcteryx/CNF.html#initialize-instance_method" title="Arcteryx::CNF#initialize (method)">new</a></span></span>
271
+ <span class='id identifier rubyid_cnf'>cnf</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_input_file'>input_file</span><span class='rparen'>)</span>
272
+ <span class='kw'>case</span> <span class='const'><span class='object_link'><a href="#DPLL-class_method" title="Arcteryx.DPLL (method)">DPLL</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_cnf'>cnf</span><span class='rparen'>)</span>
273
+ <span class='kw'>when</span> <span class='const'><span class='object_link'><a href="#SAT-constant" title="Arcteryx::SAT (constant)">SAT</a></span></span>
274
+ <span class='kw'>if</span> <span class='id identifier rubyid_output_file'>output_file</span>
275
+ <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_open'>open</span><span class='lparen'>(</span><span class='id identifier rubyid_output_file'>output_file</span><span class='comma'>,</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>w</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_f'>f</span><span class='op'>|</span>
276
+ <span class='id identifier rubyid_f'>f</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>SAT\n</span><span class='tstring_end'>&quot;</span></span><span class='op'>+</span><span class='id identifier rubyid_cnf'>cnf</span><span class='period'>.</span><span class='id identifier rubyid_result'>result</span><span class='rparen'>)</span>
277
+ <span class='kw'>end</span>
278
+ <span class='kw'>else</span>
279
+ <span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>SAT</span><span class='tstring_end'>&quot;</span></span>
280
+ <span class='id identifier rubyid_puts'>puts</span> <span class='id identifier rubyid_cnf'>cnf</span><span class='period'>.</span><span class='id identifier rubyid_result'>result</span>
281
+ <span class='kw'>end</span>
282
+ <span class='kw'>when</span> <span class='const'><span class='object_link'><a href="#UNSAT-constant" title="Arcteryx::UNSAT (constant)">UNSAT</a></span></span>
283
+ <span class='kw'>if</span> <span class='id identifier rubyid_output_file'>output_file</span>
284
+ <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_open'>open</span><span class='lparen'>(</span><span class='id identifier rubyid_output_file'>output_file</span><span class='comma'>,</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>w</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_f'>f</span><span class='op'>|</span>
285
+ <span class='id identifier rubyid_f'>f</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>UNSAT</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
286
+ <span class='kw'>end</span>
287
+ <span class='kw'>else</span>
288
+ <span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>UNSAT</span><span class='tstring_end'>&quot;</span></span>
289
+ <span class='kw'>end</span>
290
+ <span class='kw'>end</span>
291
+ <span class='kw'>end</span></pre>
292
+ </td>
293
+ </tr>
294
+ </table>
295
+ </div>
296
+
297
+ </div>
298
+
299
+ </div>
300
+
301
+ <div id="footer">
302
+ Generated on Wed May 25 14:42:45 2022 by
303
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
304
+ 0.9.27 (ruby-3.0.0).
305
+ </div>
306
+
307
+ </div>
308
+ </body>
309
+ </html>
@@ -0,0 +1,159 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ Class: Ravensat::AndNode
8
+
9
+ &mdash; Documentation by YARD 0.9.27
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../css/style.css" type="text/css" />
14
+
15
+ <link rel="stylesheet" href="../css/common.css" type="text/css" />
16
+
17
+ <script type="text/javascript">
18
+ pathId = "Ravensat::AndNode";
19
+ relpath = '../';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div class="nav_wrap">
31
+ <iframe id="nav" src="../class_list.html?1"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="../_index.html">Index (A)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../Ravensat.html" title="Ravensat (module)">Ravensat</a></span></span>
41
+ &raquo;
42
+ <span class="title">AndNode</span>
43
+
44
+ </div>
45
+
46
+ <div id="search">
47
+
48
+ <a class="full_list_link" id="class_list_link"
49
+ href="../class_list.html">
50
+
51
+ <svg width="24" height="24">
52
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
+ </svg>
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <div id="content"><h1>Class: Ravensat::AndNode
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+ <dl>
70
+ <dt>Inherits:</dt>
71
+ <dd>
72
+ <span class="inheritName"><span class='object_link'><a href="OprNode.html" title="Ravensat::OprNode (class)">OprNode</a></span></span>
73
+
74
+ <ul class="fullTree">
75
+ <li>Object</li>
76
+
77
+ <li class="next"><span class='object_link'><a href="Node.html" title="Ravensat::Node (class)">Node</a></span></li>
78
+
79
+ <li class="next"><span class='object_link'><a href="OprNode.html" title="Ravensat::OprNode (class)">OprNode</a></span></li>
80
+
81
+ <li class="next">Ravensat::AndNode</li>
82
+
83
+ </ul>
84
+ <a href="#" class="inheritanceTree">show all</a>
85
+
86
+ </dd>
87
+ </dl>
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+
98
+
99
+ <dl>
100
+ <dt>Defined in:</dt>
101
+ <dd>lib/ravensat/ast/and_node.rb</dd>
102
+ </dl>
103
+
104
+ </div>
105
+
106
+
107
+
108
+
109
+
110
+
111
+
112
+ <h2>Instance Attribute Summary</h2>
113
+
114
+ <h3 class="inherited">Attributes inherited from <span class='object_link'><a href="Node.html" title="Ravensat::Node (class)">Node</a></span></h3>
115
+ <p class="inherited"><span class='object_link'><a href="Node.html#children-instance_method" title="Ravensat::Node#children (method)">#children</a></span></p>
116
+
117
+
118
+
119
+
120
+
121
+
122
+
123
+
124
+
125
+ <h2>Method Summary</h2>
126
+
127
+ <h3 class="inherited">Methods inherited from <span class='object_link'><a href="OprNode.html" title="Ravensat::OprNode (class)">OprNode</a></span></h3>
128
+ <p class="inherited"><span class='object_link'><a href="OprNode.html#initialize-instance_method" title="Ravensat::OprNode#initialize (method)">#initialize</a></span></p>
129
+
130
+
131
+
132
+
133
+
134
+
135
+
136
+
137
+
138
+ <h3 class="inherited">Methods inherited from <span class='object_link'><a href="Node.html" title="Ravensat::Node (class)">Node</a></span></h3>
139
+ <p class="inherited"><span class='object_link'><a href="Node.html#&-instance_method" title="Ravensat::Node#&amp; (method)">#&</a></span>, <span class='object_link'><a href="Node.html#clauses_size-instance_method" title="Ravensat::Node#clauses_size (method)">#clauses_size</a></span>, <span class='object_link'><a href="Node.html#cnf%3F-instance_method" title="Ravensat::Node#cnf? (method)">#cnf?</a></span>, <span class='object_link'><a href="Node.html#each-instance_method" title="Ravensat::Node#each (method)">#each</a></span>, <span class='object_link'><a href="Node.html#initialize-instance_method" title="Ravensat::Node#initialize (method)">#initialize</a></span>, <span class='object_link'><a href="Node.html#to_s-instance_method" title="Ravensat::Node#to_s (method)">#to_s</a></span>, <span class='object_link'><a href="Node.html#vars-instance_method" title="Ravensat::Node#vars (method)">#vars</a></span>, <span class='object_link'><a href="Node.html#vars_size-instance_method" title="Ravensat::Node#vars_size (method)">#vars_size</a></span>, <span class='object_link'><a href="Node.html#%7C-instance_method" title="Ravensat::Node#| (method)">#|</a></span></p>
140
+
141
+ <div id="constructor_details" class="method_details_list">
142
+ <h2>Constructor Details</h2>
143
+
144
+ <p class="notice">This class inherits a constructor from <span class='object_link'><a href="OprNode.html#initialize-instance_method" title="Ravensat::OprNode#initialize (method)">Ravensat::OprNode</a></span></p>
145
+
146
+ </div>
147
+
148
+
149
+ </div>
150
+
151
+ <div id="footer">
152
+ Generated on Wed May 25 14:42:45 2022 by
153
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
154
+ 0.9.27 (ruby-3.0.0).
155
+ </div>
156
+
157
+ </div>
158
+ </body>
159
+ </html>