ravensat 0.3.1 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
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,827 @@
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: Arcteryx::CNF
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::CNF";
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 (C)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../Arcteryx.html" title="Arcteryx (module)">Arcteryx</a></span></span>
41
+ &raquo;
42
+ <span class="title">CNF</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: Arcteryx::CNF
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+ <dl>
70
+ <dt>Inherits:</dt>
71
+ <dd>
72
+ <span class="inheritName">Object</span>
73
+
74
+ <ul class="fullTree">
75
+ <li>Object</li>
76
+
77
+ <li class="next">Arcteryx::CNF</li>
78
+
79
+ </ul>
80
+ <a href="#" class="inheritanceTree">show all</a>
81
+
82
+ </dd>
83
+ </dl>
84
+
85
+
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+ <dl>
96
+ <dt>Defined in:</dt>
97
+ <dd>lib/arcteryx/cnf.rb</dd>
98
+ </dl>
99
+
100
+ </div>
101
+
102
+
103
+
104
+
105
+
106
+
107
+
108
+
109
+
110
+ <h2>
111
+ Instance Method Summary
112
+ <small><a href="#" class="summary_toggle">collapse</a></small>
113
+ </h2>
114
+
115
+ <ul class="summary">
116
+
117
+ <li class="public ">
118
+ <span class="summary_signature">
119
+
120
+ <a href="#append-instance_method" title="#append (instance method)">#<strong>append</strong>(l) &#x21d2; Object </a>
121
+
122
+
123
+
124
+ </span>
125
+
126
+
127
+
128
+
129
+
130
+
131
+
132
+
133
+
134
+ <span class="summary_desc"><div class='inline'></div></span>
135
+
136
+ </li>
137
+
138
+
139
+ <li class="public ">
140
+ <span class="summary_signature">
141
+
142
+ <a href="#choose_variable-instance_method" title="#choose_variable (instance method)">#<strong>choose_variable</strong> &#x21d2; Object </a>
143
+
144
+
145
+
146
+ </span>
147
+
148
+
149
+
150
+
151
+
152
+
153
+
154
+
155
+
156
+ <span class="summary_desc"><div class='inline'></div></span>
157
+
158
+ </li>
159
+
160
+
161
+ <li class="public ">
162
+ <span class="summary_signature">
163
+
164
+ <a href="#deep_dup-instance_method" title="#deep_dup (instance method)">#<strong>deep_dup</strong> &#x21d2; Object </a>
165
+
166
+
167
+
168
+ </span>
169
+
170
+
171
+
172
+
173
+
174
+
175
+
176
+
177
+
178
+ <span class="summary_desc"><div class='inline'></div></span>
179
+
180
+ </li>
181
+
182
+
183
+ <li class="public ">
184
+ <span class="summary_signature">
185
+
186
+ <a href="#empty%3F-instance_method" title="#empty? (instance method)">#<strong>empty?</strong> &#x21d2; Boolean </a>
187
+
188
+
189
+
190
+ </span>
191
+
192
+
193
+
194
+
195
+
196
+
197
+
198
+
199
+
200
+ <span class="summary_desc"><div class='inline'></div></span>
201
+
202
+ </li>
203
+
204
+
205
+ <li class="public ">
206
+ <span class="summary_signature">
207
+
208
+ <a href="#exist_empty_clause%3F-instance_method" title="#exist_empty_clause? (instance method)">#<strong>exist_empty_clause?</strong> &#x21d2; Boolean </a>
209
+
210
+
211
+
212
+ </span>
213
+
214
+
215
+
216
+
217
+
218
+
219
+
220
+
221
+
222
+ <span class="summary_desc"><div class='inline'></div></span>
223
+
224
+ </li>
225
+
226
+
227
+ <li class="public ">
228
+ <span class="summary_signature">
229
+
230
+ <a href="#find_unit_clause-instance_method" title="#find_unit_clause (instance method)">#<strong>find_unit_clause</strong> &#x21d2; Object </a>
231
+
232
+
233
+
234
+ </span>
235
+
236
+
237
+
238
+
239
+
240
+
241
+
242
+
243
+
244
+ <span class="summary_desc"><div class='inline'></div></span>
245
+
246
+ </li>
247
+
248
+
249
+ <li class="public ">
250
+ <span class="summary_signature">
251
+
252
+ <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(formula = [], truth = {}) &#x21d2; CNF </a>
253
+
254
+
255
+
256
+ </span>
257
+
258
+
259
+ <span class="note title constructor">constructor</span>
260
+
261
+
262
+
263
+
264
+
265
+
266
+
267
+
268
+ <span class="summary_desc"><div class='inline'>
269
+ <p>A new instance of CNF.</p>
270
+ </div></span>
271
+
272
+ </li>
273
+
274
+
275
+ <li class="public ">
276
+ <span class="summary_signature">
277
+
278
+ <a href="#parse-instance_method" title="#parse (instance method)">#<strong>parse</strong>(file_path) &#x21d2; Object </a>
279
+
280
+
281
+
282
+ </span>
283
+
284
+
285
+
286
+
287
+
288
+
289
+
290
+
291
+
292
+ <span class="summary_desc"><div class='inline'></div></span>
293
+
294
+ </li>
295
+
296
+
297
+ <li class="public ">
298
+ <span class="summary_signature">
299
+
300
+ <a href="#result-instance_method" title="#result (instance method)">#<strong>result</strong> &#x21d2; Object </a>
301
+
302
+
303
+
304
+ </span>
305
+
306
+
307
+
308
+
309
+
310
+
311
+
312
+
313
+
314
+ <span class="summary_desc"><div class='inline'></div></span>
315
+
316
+ </li>
317
+
318
+
319
+ <li class="public ">
320
+ <span class="summary_signature">
321
+
322
+ <a href="#simplify-instance_method" title="#simplify (instance method)">#<strong>simplify</strong>(l) &#x21d2; Object </a>
323
+
324
+
325
+
326
+ </span>
327
+
328
+
329
+
330
+
331
+
332
+
333
+
334
+
335
+
336
+ <span class="summary_desc"><div class='inline'></div></span>
337
+
338
+ </li>
339
+
340
+
341
+ <li class="public ">
342
+ <span class="summary_signature">
343
+
344
+ <a href="#unit_propagation-instance_method" title="#unit_propagation (instance method)">#<strong>unit_propagation</strong> &#x21d2; Object </a>
345
+
346
+
347
+
348
+ </span>
349
+
350
+
351
+
352
+
353
+
354
+
355
+
356
+
357
+
358
+ <span class="summary_desc"><div class='inline'></div></span>
359
+
360
+ </li>
361
+
362
+
363
+ </ul>
364
+
365
+
366
+ <div id="constructor_details" class="method_details_list">
367
+ <h2>Constructor Details</h2>
368
+
369
+ <div class="method_details first">
370
+ <h3 class="signature first" id="initialize-instance_method">
371
+
372
+ #<strong>initialize</strong>(formula = [], truth = {}) &#x21d2; <tt><span class='object_link'><a href="" title="Arcteryx::CNF (class)">CNF</a></span></tt>
373
+
374
+
375
+
376
+
377
+
378
+ </h3><div class="docstring">
379
+ <div class="discussion">
380
+
381
+ <p>Returns a new instance of CNF.</p>
382
+
383
+
384
+ </div>
385
+ </div>
386
+ <div class="tags">
387
+
388
+
389
+ </div><table class="source_code">
390
+ <tr>
391
+ <td>
392
+ <pre class="lines">
393
+
394
+
395
+ 3
396
+ 4
397
+ 5
398
+ 6</pre>
399
+ </td>
400
+ <td>
401
+ <pre class="code"><span class="info file"># File 'lib/arcteryx/cnf.rb', line 3</span>
402
+
403
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_formula'>formula</span><span class='op'>=</span><span class='lbracket'>[</span><span class='rbracket'>]</span><span class='comma'>,</span><span class='id identifier rubyid_truth'>truth</span><span class='op'>=</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
404
+ <span class='ivar'>@formula</span> <span class='op'>=</span> <span class='id identifier rubyid_formula'>formula</span>
405
+ <span class='ivar'>@truth_assignment</span> <span class='op'>=</span> <span class='id identifier rubyid_truth'>truth</span>
406
+ <span class='kw'>end</span></pre>
407
+ </td>
408
+ </tr>
409
+ </table>
410
+ </div>
411
+
412
+ </div>
413
+
414
+
415
+ <div id="instance_method_details" class="method_details_list">
416
+ <h2>Instance Method Details</h2>
417
+
418
+
419
+ <div class="method_details first">
420
+ <h3 class="signature first" id="append-instance_method">
421
+
422
+ #<strong>append</strong>(l) &#x21d2; <tt>Object</tt>
423
+
424
+
425
+
426
+
427
+
428
+ </h3><table class="source_code">
429
+ <tr>
430
+ <td>
431
+ <pre class="lines">
432
+
433
+
434
+ 57
435
+ 58
436
+ 59
437
+ 60</pre>
438
+ </td>
439
+ <td>
440
+ <pre class="code"><span class="info file"># File 'lib/arcteryx/cnf.rb', line 57</span>
441
+
442
+ <span class='kw'>def</span> <span class='id identifier rubyid_append'>append</span> <span class='id identifier rubyid_l'>l</span>
443
+ <span class='ivar'>@formula</span><span class='period'>.</span><span class='id identifier rubyid_append'>append</span> <span class='lbracket'>[</span><span class='id identifier rubyid_l'>l</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id identifier rubyid_l'>l</span>
444
+ <span class='kw'>return</span> <span class='kw'>self</span>
445
+ <span class='kw'>end</span></pre>
446
+ </td>
447
+ </tr>
448
+ </table>
449
+ </div>
450
+
451
+ <div class="method_details ">
452
+ <h3 class="signature " id="choose_variable-instance_method">
453
+
454
+ #<strong>choose_variable</strong> &#x21d2; <tt>Object</tt>
455
+
456
+
457
+
458
+
459
+
460
+ </h3><table class="source_code">
461
+ <tr>
462
+ <td>
463
+ <pre class="lines">
464
+
465
+
466
+ 52
467
+ 53
468
+ 54
469
+ 55</pre>
470
+ </td>
471
+ <td>
472
+ <pre class="code"><span class="info file"># File 'lib/arcteryx/cnf.rb', line 52</span>
473
+
474
+ <span class='kw'>def</span> <span class='id identifier rubyid_choose_variable'>choose_variable</span>
475
+ <span class='ivar'>@truth_assignment</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span><span class='id identifier rubyid_value'>value</span><span class='op'>|</span> <span class='kw'>if</span> <span class='id identifier rubyid_value'>value</span> <span class='op'>==</span> <span class='kw'>nil</span> <span class='kw'>then</span> <span class='kw'>return</span> <span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span> <span class='kw'>end</span><span class='rbrace'>}</span>
476
+ <span class='kw'>return</span> <span class='kw'>false</span>
477
+ <span class='kw'>end</span></pre>
478
+ </td>
479
+ </tr>
480
+ </table>
481
+ </div>
482
+
483
+ <div class="method_details ">
484
+ <h3 class="signature " id="deep_dup-instance_method">
485
+
486
+ #<strong>deep_dup</strong> &#x21d2; <tt>Object</tt>
487
+
488
+
489
+
490
+
491
+
492
+ </h3><table class="source_code">
493
+ <tr>
494
+ <td>
495
+ <pre class="lines">
496
+
497
+
498
+ 62
499
+ 63
500
+ 64
501
+ 65
502
+ 66</pre>
503
+ </td>
504
+ <td>
505
+ <pre class="code"><span class="info file"># File 'lib/arcteryx/cnf.rb', line 62</span>
506
+
507
+ <span class='kw'>def</span> <span class='id identifier rubyid_deep_dup'>deep_dup</span>
508
+ <span class='id identifier rubyid_tmp_formula'>tmp_formula</span> <span class='op'>=</span> <span class='const'>Marshal</span><span class='period'>.</span><span class='id identifier rubyid_load'>load</span><span class='lparen'>(</span><span class='const'>Marshal</span><span class='period'>.</span><span class='id identifier rubyid_dump'>dump</span><span class='lparen'>(</span><span class='ivar'>@formula</span><span class='rparen'>)</span><span class='rparen'>)</span>
509
+ <span class='id identifier rubyid_tmp_truth'>tmp_truth</span> <span class='op'>=</span> <span class='const'>Marshal</span><span class='period'>.</span><span class='id identifier rubyid_load'>load</span><span class='lparen'>(</span><span class='const'>Marshal</span><span class='period'>.</span><span class='id identifier rubyid_dump'>dump</span><span class='lparen'>(</span><span class='ivar'>@truth_assignment</span><span class='rparen'>)</span><span class='rparen'>)</span>
510
+ <span class='const'><span class='object_link'><a href="" title="Arcteryx::CNF (class)">CNF</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="#initialize-instance_method" title="Arcteryx::CNF#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_tmp_formula'>tmp_formula</span><span class='comma'>,</span><span class='id identifier rubyid_tmp_truth'>tmp_truth</span><span class='rparen'>)</span>
511
+ <span class='kw'>end</span></pre>
512
+ </td>
513
+ </tr>
514
+ </table>
515
+ </div>
516
+
517
+ <div class="method_details ">
518
+ <h3 class="signature " id="empty?-instance_method">
519
+
520
+ #<strong>empty?</strong> &#x21d2; <tt>Boolean</tt>
521
+
522
+
523
+
524
+
525
+
526
+ </h3><div class="docstring">
527
+ <div class="discussion">
528
+
529
+
530
+ </div>
531
+ </div>
532
+ <div class="tags">
533
+
534
+ <p class="tag_title">Returns:</p>
535
+ <ul class="return">
536
+
537
+ <li>
538
+
539
+
540
+ <span class='type'>(<tt>Boolean</tt>)</span>
541
+
542
+
543
+
544
+ </li>
545
+
546
+ </ul>
547
+
548
+ </div><table class="source_code">
549
+ <tr>
550
+ <td>
551
+ <pre class="lines">
552
+
553
+
554
+ 38
555
+ 39
556
+ 40</pre>
557
+ </td>
558
+ <td>
559
+ <pre class="code"><span class="info file"># File 'lib/arcteryx/cnf.rb', line 38</span>
560
+
561
+ <span class='kw'>def</span> <span class='id identifier rubyid_empty?'>empty?</span>
562
+ <span class='ivar'>@formula</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
563
+ <span class='kw'>end</span></pre>
564
+ </td>
565
+ </tr>
566
+ </table>
567
+ </div>
568
+
569
+ <div class="method_details ">
570
+ <h3 class="signature " id="exist_empty_clause?-instance_method">
571
+
572
+ #<strong>exist_empty_clause?</strong> &#x21d2; <tt>Boolean</tt>
573
+
574
+
575
+
576
+
577
+
578
+ </h3><div class="docstring">
579
+ <div class="discussion">
580
+
581
+
582
+ </div>
583
+ </div>
584
+ <div class="tags">
585
+
586
+ <p class="tag_title">Returns:</p>
587
+ <ul class="return">
588
+
589
+ <li>
590
+
591
+
592
+ <span class='type'>(<tt>Boolean</tt>)</span>
593
+
594
+
595
+
596
+ </li>
597
+
598
+ </ul>
599
+
600
+ </div><table class="source_code">
601
+ <tr>
602
+ <td>
603
+ <pre class="lines">
604
+
605
+
606
+ 47
607
+ 48
608
+ 49
609
+ 50</pre>
610
+ </td>
611
+ <td>
612
+ <pre class="code"><span class="info file"># File 'lib/arcteryx/cnf.rb', line 47</span>
613
+
614
+ <span class='kw'>def</span> <span class='id identifier rubyid_exist_empty_clause?'>exist_empty_clause?</span>
615
+ <span class='ivar'>@formula</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_cls'>cls</span><span class='op'>|</span> <span class='kw'>if</span> <span class='id identifier rubyid_cls'>cls</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='kw'>true</span> <span class='kw'>end</span><span class='rbrace'>}</span>
616
+ <span class='kw'>return</span> <span class='kw'>false</span>
617
+ <span class='kw'>end</span></pre>
618
+ </td>
619
+ </tr>
620
+ </table>
621
+ </div>
622
+
623
+ <div class="method_details ">
624
+ <h3 class="signature " id="find_unit_clause-instance_method">
625
+
626
+ #<strong>find_unit_clause</strong> &#x21d2; <tt>Object</tt>
627
+
628
+
629
+
630
+
631
+
632
+ </h3><table class="source_code">
633
+ <tr>
634
+ <td>
635
+ <pre class="lines">
636
+
637
+
638
+ 42
639
+ 43
640
+ 44
641
+ 45</pre>
642
+ </td>
643
+ <td>
644
+ <pre class="code"><span class="info file"># File 'lib/arcteryx/cnf.rb', line 42</span>
645
+
646
+ <span class='kw'>def</span> <span class='id identifier rubyid_find_unit_clause'>find_unit_clause</span>
647
+ <span class='ivar'>@formula</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_cls'>cls</span><span class='op'>|</span> <span class='kw'>if</span> <span class='id identifier rubyid_cls'>cls</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span> <span class='op'>==</span> <span class='int'>1</span> <span class='kw'>then</span> <span class='kw'>return</span> <span class='id identifier rubyid_cls'>cls</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span> <span class='kw'>end</span><span class='rbrace'>}</span>
648
+ <span class='kw'>return</span> <span class='kw'>false</span>
649
+ <span class='kw'>end</span></pre>
650
+ </td>
651
+ </tr>
652
+ </table>
653
+ </div>
654
+
655
+ <div class="method_details ">
656
+ <h3 class="signature " id="parse-instance_method">
657
+
658
+ #<strong>parse</strong>(file_path) &#x21d2; <tt>Object</tt>
659
+
660
+
661
+
662
+
663
+
664
+ </h3><table class="source_code">
665
+ <tr>
666
+ <td>
667
+ <pre class="lines">
668
+
669
+
670
+ 8
671
+ 9
672
+ 10
673
+ 11
674
+ 12
675
+ 13
676
+ 14
677
+ 15
678
+ 16
679
+ 17
680
+ 18
681
+ 19
682
+ 20
683
+ 21
684
+ 22</pre>
685
+ </td>
686
+ <td>
687
+ <pre class="code"><span class="info file"># File 'lib/arcteryx/cnf.rb', line 8</span>
688
+
689
+ <span class='kw'>def</span> <span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_file_path'>file_path</span><span class='rparen'>)</span>
690
+ <span class='id identifier rubyid_header'>header</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_end'>&quot;</span></span><span class='semicolon'>;</span> <span class='id identifier rubyid_clauses'>clauses</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='semicolon'>;</span>
691
+ <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_file_path'>file_path</span><span class='comma'>,</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>r</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>
692
+ <span class='id identifier rubyid_header'>header</span> <span class='op'>=</span> <span class='id identifier rubyid_f'>f</span><span class='period'>.</span><span class='id identifier rubyid_readline'>readline</span>
693
+ <span class='id identifier rubyid_clauses'>clauses</span> <span class='op'>=</span> <span class='id identifier rubyid_f'>f</span><span class='period'>.</span><span class='id identifier rubyid_readlines'>readlines</span>
694
+ <span class='kw'>end</span>
695
+ <span class='id identifier rubyid_header'>header</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lbracket'>[</span><span class='int'>2</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span><span class='period'>.</span><span class='id identifier rubyid_times'>times</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_i'>i</span><span class='op'>|</span>
696
+ <span class='ivar'>@truth_assignment</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_i'>i</span><span class='op'>+</span><span class='int'>1</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>nil</span>
697
+ <span class='kw'>end</span>
698
+ <span class='id identifier rubyid_clauses'>clauses</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_e'>e</span><span class='op'>|</span>
699
+ <span class='id identifier rubyid_clause'>clause</span> <span class='op'>=</span> <span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_i'>i</span><span class='op'>|</span> <span class='id identifier rubyid_i'>i</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span><span class='rbrace'>}</span>
700
+ <span class='id identifier rubyid_clause'>clause</span><span class='period'>.</span><span class='id identifier rubyid_pop'>pop</span>
701
+ <span class='ivar'>@formula</span><span class='period'>.</span><span class='id identifier rubyid_append'>append</span> <span class='id identifier rubyid_clause'>clause</span>
702
+ <span class='kw'>end</span>
703
+ <span class='kw'>end</span></pre>
704
+ </td>
705
+ </tr>
706
+ </table>
707
+ </div>
708
+
709
+ <div class="method_details ">
710
+ <h3 class="signature " id="result-instance_method">
711
+
712
+ #<strong>result</strong> &#x21d2; <tt>Object</tt>
713
+
714
+
715
+
716
+
717
+
718
+ </h3><table class="source_code">
719
+ <tr>
720
+ <td>
721
+ <pre class="lines">
722
+
723
+
724
+ 68
725
+ 69
726
+ 70
727
+ 71
728
+ 72</pre>
729
+ </td>
730
+ <td>
731
+ <pre class="code"><span class="info file"># File 'lib/arcteryx/cnf.rb', line 68</span>
732
+
733
+ <span class='kw'>def</span> <span class='id identifier rubyid_result'>result</span>
734
+ <span class='id identifier rubyid_str'>str</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_end'>&quot;</span></span>
735
+ <span class='ivar'>@truth_assignment</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span><span class='id identifier rubyid_value'>value</span><span class='op'>|</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span> <span class='kw'>then</span> <span class='id identifier rubyid_str'>str</span><span class='op'>&lt;&lt;</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>-</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>end</span><span class='semicolon'>;</span> <span class='id identifier rubyid_str'>str</span><span class='op'>&lt;&lt;</span><span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='op'>+</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'> </span><span class='tstring_end'>&quot;</span></span><span class='rbrace'>}</span>
736
+ <span class='kw'>return</span> <span class='id identifier rubyid_str'>str</span> <span class='op'>&lt;&lt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>0</span><span class='tstring_end'>&quot;</span></span>
737
+ <span class='kw'>end</span></pre>
738
+ </td>
739
+ </tr>
740
+ </table>
741
+ </div>
742
+
743
+ <div class="method_details ">
744
+ <h3 class="signature " id="simplify-instance_method">
745
+
746
+ #<strong>simplify</strong>(l) &#x21d2; <tt>Object</tt>
747
+
748
+
749
+
750
+
751
+
752
+ </h3><table class="source_code">
753
+ <tr>
754
+ <td>
755
+ <pre class="lines">
756
+
757
+
758
+ 31
759
+ 32
760
+ 33
761
+ 34
762
+ 35
763
+ 36</pre>
764
+ </td>
765
+ <td>
766
+ <pre class="code"><span class="info file"># File 'lib/arcteryx/cnf.rb', line 31</span>
767
+
768
+ <span class='kw'>def</span> <span class='id identifier rubyid_simplify'>simplify</span><span class='lparen'>(</span><span class='id identifier rubyid_l'>l</span><span class='rparen'>)</span>
769
+ <span class='ivar'>@formula</span><span class='period'>.</span><span class='id identifier rubyid_delete_if'>delete_if</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_cls'>cls</span><span class='op'>|</span>
770
+ <span class='id identifier rubyid_cls'>cls</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_l'>l</span><span class='rparen'>)</span>
771
+ <span class='kw'>end</span>
772
+ <span class='ivar'>@formula</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_cls'>cls</span><span class='op'>|</span> <span class='kw'>if</span> <span class='id identifier rubyid_cls'>cls</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='op'>-</span><span class='int'>1</span><span class='op'>*</span><span class='id identifier rubyid_l'>l</span><span class='rparen'>)</span> <span class='kw'>then</span> <span class='id identifier rubyid_cls'>cls</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='op'>-</span><span class='int'>1</span><span class='op'>*</span><span class='id identifier rubyid_l'>l</span><span class='rparen'>)</span> <span class='kw'>end</span><span class='rbrace'>}</span>
773
+ <span class='kw'>end</span></pre>
774
+ </td>
775
+ </tr>
776
+ </table>
777
+ </div>
778
+
779
+ <div class="method_details ">
780
+ <h3 class="signature " id="unit_propagation-instance_method">
781
+
782
+ #<strong>unit_propagation</strong> &#x21d2; <tt>Object</tt>
783
+
784
+
785
+
786
+
787
+
788
+ </h3><table class="source_code">
789
+ <tr>
790
+ <td>
791
+ <pre class="lines">
792
+
793
+
794
+ 24
795
+ 25
796
+ 26
797
+ 27
798
+ 28
799
+ 29</pre>
800
+ </td>
801
+ <td>
802
+ <pre class="code"><span class="info file"># File 'lib/arcteryx/cnf.rb', line 24</span>
803
+
804
+ <span class='kw'>def</span> <span class='id identifier rubyid_unit_propagation'>unit_propagation</span>
805
+ <span class='kw'>while</span> <span class='op'>!</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_exist_empty_clause?'>exist_empty_clause?</span> <span class='kw'>and</span> <span class='id identifier rubyid_l'>l</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_find_unit_clause'>find_unit_clause</span>
806
+ <span class='ivar'>@truth_assignment</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_l'>l</span><span class='period'>.</span><span class='id identifier rubyid_abs'>abs</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_l'>l</span> <span class='op'>&gt;</span> <span class='int'>0</span>
807
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_simplify'>simplify</span><span class='lparen'>(</span><span class='id identifier rubyid_l'>l</span><span class='rparen'>)</span>
808
+ <span class='kw'>end</span>
809
+ <span class='kw'>end</span></pre>
810
+ </td>
811
+ </tr>
812
+ </table>
813
+ </div>
814
+
815
+ </div>
816
+
817
+ </div>
818
+
819
+ <div id="footer">
820
+ Generated on Wed May 25 14:42:45 2022 by
821
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
822
+ 0.9.27 (ruby-3.0.0).
823
+ </div>
824
+
825
+ </div>
826
+ </body>
827
+ </html>