ravensat 0.3.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/main.yml +18 -0
  3. data/README.md +90 -13
  4. data/docs/Arcteryx/CNF.html +827 -0
  5. data/docs/Arcteryx.html +309 -0
  6. data/docs/Ravensat/AndNode.html +159 -0
  7. data/docs/Ravensat/Claw.html +338 -0
  8. data/docs/Ravensat/DimacsDecoder.html +224 -0
  9. data/docs/Ravensat/DimacsEncoder.html +425 -0
  10. data/docs/Ravensat/Extension/BooleanVariable.html +229 -0
  11. data/docs/Ravensat/Extension/Domain.html +319 -0
  12. data/docs/Ravensat/Extension/IntegerVariable.html +589 -0
  13. data/docs/Ravensat/Extension/UndefinedVariable.html +236 -0
  14. data/docs/Ravensat/Extension/Variable.html +443 -0
  15. data/docs/Ravensat/Extension.html +141 -0
  16. data/docs/Ravensat/InitialNode.html +267 -0
  17. data/docs/Ravensat/Node.html +780 -0
  18. data/docs/Ravensat/NotNode.html +159 -0
  19. data/docs/Ravensat/OprNode.html +226 -0
  20. data/docs/Ravensat/OrNode.html +252 -0
  21. data/docs/Ravensat/Solver.html +373 -0
  22. data/docs/Ravensat/VarNode.html +488 -0
  23. data/docs/Ravensat.html +135 -0
  24. data/docs/_index.html +329 -0
  25. data/docs/class_list.html +51 -0
  26. data/docs/css/common.css +1 -0
  27. data/docs/css/full_list.css +58 -0
  28. data/docs/css/style.css +497 -0
  29. data/docs/file.README.html +233 -0
  30. data/docs/file_list.html +56 -0
  31. data/docs/frames.html +17 -0
  32. data/docs/index.html +233 -0
  33. data/docs/js/app.js +314 -0
  34. data/docs/js/full_list.js +216 -0
  35. data/docs/js/jquery.js +4 -0
  36. data/docs/method_list.html +523 -0
  37. data/docs/top-level-namespace.html +110 -0
  38. data/exe/ravensat +1 -5
  39. data/lib/ravensat/ast/and_node.rb +8 -0
  40. data/lib/ravensat/ast/node.rb +84 -20
  41. data/lib/ravensat/ast/not_node.rb +7 -0
  42. data/lib/ravensat/ast/or_node.rb +9 -0
  43. data/lib/ravensat/ast/var_node.rb +10 -1
  44. data/lib/ravensat/claw.rb +44 -0
  45. data/lib/ravensat/dimacs/dimacs_decoder.rb +9 -6
  46. data/lib/ravensat/dimacs/dimacs_encoder.rb +10 -13
  47. data/lib/ravensat/extension/domain.rb +0 -1
  48. data/lib/ravensat/extension/variable/integer_variable.rb +3 -3
  49. data/lib/ravensat/solver.rb +1 -8
  50. data/lib/ravensat/version.rb +1 -1
  51. data/lib/ravensat.rb +1 -1
  52. metadata +38 -3
  53. data/lib/ravensat/ravenclaw.rb +0 -19
@@ -0,0 +1,233 @@
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
+ File: README
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 = "README";
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="file_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> &raquo;
40
+ <span class="title">File: README</span>
41
+
42
+ </div>
43
+
44
+ <div id="search">
45
+
46
+ <a class="full_list_link" id="class_list_link"
47
+ href="class_list.html">
48
+
49
+ <svg width="24" height="24">
50
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
51
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
52
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
53
+ </svg>
54
+ </a>
55
+
56
+ </div>
57
+ <div class="clear"></div>
58
+ </div>
59
+
60
+ <div id="content"><div id='filecontents'><h1 id="ravensat">Ravensat</h1>
61
+
62
+ <p><a href="https://github.com/matsuda0528/ravensat/actions/workflows/main.yml"><img src="https://github.com/matsuda0528/ravensat/actions/workflows/main.yml/badge.svg" alt="Ruby" /></a>
63
+ <a href="https://badge.fury.io/rb/ravensat"><img src="https://badge.fury.io/rb/ravensat.svg" alt="Gem Version" /></a>
64
+ <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/github/license/matsuda0528/ravensat" alt="LICENSE" /></a></p>
65
+
66
+ <p>Ravensat is an interface to SAT solver in Ruby.</p>
67
+
68
+ <p>In order to use Ravensat, you need to install SAT solver.
69
+ If you do not install SAT solver, it will use the one bundled in the gem.</p>
70
+
71
+ <p>About <a href="https://en.wikipedia.org/wiki/Boolean_satisfiability_problem">SAT</a>, <a href="https://en.wikipedia.org/wiki/SAT_solver">SAT solver</a></p>
72
+
73
+ <h2 id="description">Description</h2>
74
+ <p>To solve SAT, we usually use SAT solver.
75
+ Now, let’s solve the following SAT with SAT solver.</p>
76
+
77
+ \[(p_1 \lor \lnot p_5 \lor p_4) \land (\lnot p_1 \lor p_5 \lor p_3 \lor p_4) \land (\lnot p_3 \lor \lnot p_4)\]
78
+
79
+ <p>Most SAT solvers are input in <a href="https://www.cs.utexas.edu/users/moore/acl2/manuals/current/manual/index-seo.php/SATLINK____DIMACS">DIMACS Format</a>.
80
+ Converting the example SAT to DIMACS Format yields the following.</p>
81
+
82
+ <p><code>DIMACS Format
83
+ p cnf 5 3
84
+ 1 -5 4 0
85
+ -1 5 3 4 0
86
+ -3 -4 0
87
+ </code></p>
88
+
89
+ <p>DIMACS Format is widely distributed as an I/O format for SAT solver.
90
+ However, when solving a large SAT, the following problems occur.
91
+ - Need to create a file with thousands of lines.
92
+ - Confusion arises because of the inability to name variables meaningfully.</p>
93
+
94
+ <p>To solve these problems, Ravensat can be used.
95
+ Using Ravensat, propositional variables can be defined as local variables in Ruby.</p>
96
+
97
+ <p><code>ruby
98
+ fuji_is_the_highest_mountain_in_japan = Ravensat::VarNode.new
99
+ </code></p>
100
+
101
+ <p>In addition, you can write logical expressions intuitively.</p>
102
+
103
+ <p>```ruby
104
+ x = Ravensat::VarNode.new
105
+ y = Ravensat::VarNode.new</p>
106
+
107
+ <p>(x | y) &amp; (~x | y) # (x or y) and (not x or y)
108
+ ```</p>
109
+
110
+ <h2 id="installation">Installation</h2>
111
+
112
+ <p>Add this line to your application’s Gemfile:</p>
113
+
114
+ <p><code>ruby
115
+ gem 'ravensat'
116
+ </code></p>
117
+
118
+ <p>And then execute:</p>
119
+
120
+ <pre class="code ruby"><code class="ruby">$ bundle install
121
+ </code></pre>
122
+
123
+ <p>Or install it yourself as:</p>
124
+
125
+ <pre class="code ruby"><code class="ruby">$ gem install ravensat
126
+ </code></pre>
127
+
128
+ <h2 id="usage">Usage</h2>
129
+ <p>### Basic Usage
130
+ This is a basic usage example of the library.</p>
131
+
132
+ <p>```ruby
133
+ require ‘ravensat’</p>
134
+
135
+ <p>a = Ravensat::VarNode.new
136
+ b = Ravensat::VarNode.new</p>
137
+
138
+ <p>a.result #=&gt; nil
139
+ b.result #=&gt; nil</p>
140
+
141
+ <table>
142
+ <tbody>
143
+ <tr>
144
+ <td>logic = (a</td>
145
+ <td>b) &amp; (~a</td>
146
+ <td>b) &amp; (a</td>
147
+ <td>~b)</td>
148
+ </tr>
149
+ </tbody>
150
+ </table>
151
+
152
+ <p>solver = Ravensat::Solver.new
153
+ solver.solve logic #=&gt; true(SAT)</p>
154
+
155
+ <p>a.result #=&gt; true
156
+ b.result #=&gt; true
157
+ ```</p>
158
+
159
+ <p>If you have SAT solver installed, you can write:</p>
160
+
161
+ <p><code>ruby
162
+ solver = Ravensat::Solver.new("&lt;solver_name&gt;")
163
+ solver.solve logic
164
+ </code></p>
165
+
166
+ <p>The available solvers are assumed to be those that can be I/O in the DIMACS Format.
167
+ At least, we have confirmed that it works properly with <a href="https://github.com/niklasso/minisat">MiniSat</a>.</p>
168
+
169
+ <p>If you do not use an external SAT solver, create a SAT solver object without any constructor arguments.
170
+ In that case, <strong>Arcteryx</strong>(the very simple SAT solver built into Ravensat) will launch.</p>
171
+
172
+ <h3 id="extension-usage">Extension Usage</h3>
173
+ <p>In Ravensat::Extension, C-like variable definitions are available.</p>
174
+
175
+ <p><em>Note: In Ravensat::Extension, all undefined variables and methods are caught by method_missing method.</em></p>
176
+
177
+ <p>```ruby
178
+ require ‘ravensat’</p>
179
+
180
+ <p>module Ravensat
181
+ module Extension
182
+ bool a, b
183
+ logic = (a | b) &amp; (~a | b) &amp; (a | ~b)</p>
184
+
185
+ <pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_solver'>solver</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="Ravensat.html" title="Ravensat (module)">Ravensat</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Ravensat/Solver.html" title="Ravensat::Solver (class)">Solver</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Ravensat/Solver.html#initialize-instance_method" title="Ravensat::Solver#initialize (method)">new</a></span></span>
186
+ <span class='id identifier rubyid_solver'>solver</span><span class='period'>.</span><span class='id identifier rubyid_solve'>solve</span> <span class='id identifier rubyid_logic'>logic</span> <span class='comment'>#=&gt; true
187
+ </span>
188
+ <span class='id identifier rubyid_a'>a</span><span class='period'>.</span><span class='id identifier rubyid_result'>result</span> <span class='comment'>#=&gt; true
189
+ </span><span class='id identifier rubyid_b'>b</span><span class='period'>.</span><span class='id identifier rubyid_result'>result</span> <span class='comment'>#=&gt; true end end ```
190
+ </span></code></pre>
191
+
192
+ <h3 id="extension-usagecsp-constraint-satisfaction-problem">Extension Usage(CSP; Constraint Satisfaction Problem)</h3>
193
+ <p>It is possible to define integer variables and to describe some integer constraints.</p>
194
+
195
+ <p>```ruby
196
+ require ‘ravensat’</p>
197
+
198
+ <p>module Ravensat
199
+ module Extension
200
+ int a(1..10), b(1..10)
201
+ constraint = (a.only_one &amp; b.only_one &amp; (a != b))</p>
202
+
203
+ <pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_solver'>solver</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="Ravensat.html" title="Ravensat (module)">Ravensat</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Ravensat/Solver.html" title="Ravensat::Solver (class)">Solver</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Ravensat/Solver.html#initialize-instance_method" title="Ravensat::Solver#initialize (method)">new</a></span></span>
204
+ <span class='id identifier rubyid_solver'>solver</span><span class='period'>.</span><span class='id identifier rubyid_solve'>solve</span> <span class='id identifier rubyid_constraint'>constraint</span> <span class='comment'>#=&gt; true
205
+ </span>
206
+ <span class='id identifier rubyid_a'>a</span><span class='period'>.</span><span class='id identifier rubyid_result'>result</span> <span class='comment'>#=&gt; 1
207
+ </span><span class='id identifier rubyid_b'>b</span><span class='period'>.</span><span class='id identifier rubyid_result'>result</span> <span class='comment'>#=&gt; 2 end end ```
208
+ </span></code></pre>
209
+
210
+ <h2 id="development">Development</h2>
211
+
212
+ <p>After checking out the repo, run <code>bin/setup</code> to install dependencies. Then, run <code>rake spec</code> to run the tests. You can also run <code>bin/console</code> for an interactive prompt that will allow you to experiment.</p>
213
+
214
+ <p>To install this gem onto your local machine, run <code>bundle exec rake install</code>. To release a new version, update the version number in <code>version.rb</code>, and then run <code>bundle exec rake release</code>, which will create a git tag for the version, push git commits and the created tag, and push the <code>.gem</code> file to <a href="https://rubygems.org">rubygems.org</a>.</p>
215
+
216
+ <h2 id="contributing">Contributing</h2>
217
+
218
+ <p>Bug reports and pull requests are welcome on GitHub at https://github.com/matsuda0528/ravensat.</p>
219
+
220
+ <h2 id="license">License</h2>
221
+
222
+ <p>The gem is available as open source under the terms of the <a href="https://opensource.org/licenses/MIT">MIT License</a>.</p>
223
+ </div></div>
224
+
225
+ <div id="footer">
226
+ Generated on Wed May 25 14:42:45 2022 by
227
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
228
+ 0.9.27 (ruby-3.0.0).
229
+ </div>
230
+
231
+ </div>
232
+ </body>
233
+ </html>
@@ -0,0 +1,56 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
5
+ <meta charset="utf-8" />
6
+
7
+ <link rel="stylesheet" href="css/full_list.css" type="text/css" media="screen" />
8
+
9
+ <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" />
10
+
11
+
12
+
13
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
14
+
15
+ <script type="text/javascript" charset="utf-8" src="js/full_list.js"></script>
16
+
17
+
18
+ <title>File List</title>
19
+ <base id="base_target" target="_parent" />
20
+ </head>
21
+ <body>
22
+ <div id="content">
23
+ <div class="fixed_header">
24
+ <h1 id="full_list_header">File List</h1>
25
+ <div id="full_list_nav">
26
+
27
+ <span><a target="_self" href="class_list.html">
28
+ Classes
29
+ </a></span>
30
+
31
+ <span><a target="_self" href="method_list.html">
32
+ Methods
33
+ </a></span>
34
+
35
+ <span><a target="_self" href="file_list.html">
36
+ Files
37
+ </a></span>
38
+
39
+ </div>
40
+
41
+ <div id="search">Search: <input type="text" /></div>
42
+ </div>
43
+
44
+ <ul id="full_list" class="file">
45
+
46
+
47
+ <li id="object_README" class="odd">
48
+ <div class="item"><span class="object_link"><a href="index.html" title="README">README</a></span></div>
49
+ </li>
50
+
51
+
52
+
53
+ </ul>
54
+ </div>
55
+ </body>
56
+ </html>
data/docs/frames.html ADDED
@@ -0,0 +1,17 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>Documentation by YARD 0.9.27</title>
6
+ </head>
7
+ <script type="text/javascript">
8
+ var match = unescape(window.location.hash).match(/^#!(.+)/);
9
+ var name = match ? match[1] : 'index.html';
10
+ name = name.replace(/^(\w+):\/\//, '').replace(/^\/\//, '');
11
+ window.top.location = name;
12
+ </script>
13
+ <noscript>
14
+ <h1>Oops!</h1>
15
+ <h2>YARD requires JavaScript!</h2>
16
+ </noscript>
17
+ </html>
data/docs/index.html ADDED
@@ -0,0 +1,233 @@
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
+ File: README
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 = "README";
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> &raquo;
40
+ <span class="title">File: README</span>
41
+
42
+ </div>
43
+
44
+ <div id="search">
45
+
46
+ <a class="full_list_link" id="class_list_link"
47
+ href="class_list.html">
48
+
49
+ <svg width="24" height="24">
50
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
51
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
52
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
53
+ </svg>
54
+ </a>
55
+
56
+ </div>
57
+ <div class="clear"></div>
58
+ </div>
59
+
60
+ <div id="content"><div id='filecontents'><h1 id="ravensat">Ravensat</h1>
61
+
62
+ <p><a href="https://github.com/matsuda0528/ravensat/actions/workflows/main.yml"><img src="https://github.com/matsuda0528/ravensat/actions/workflows/main.yml/badge.svg" alt="Ruby" /></a>
63
+ <a href="https://badge.fury.io/rb/ravensat"><img src="https://badge.fury.io/rb/ravensat.svg" alt="Gem Version" /></a>
64
+ <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/github/license/matsuda0528/ravensat" alt="LICENSE" /></a></p>
65
+
66
+ <p>Ravensat is an interface to SAT solver in Ruby.</p>
67
+
68
+ <p>In order to use Ravensat, you need to install SAT solver.
69
+ If you do not install SAT solver, it will use the one bundled in the gem.</p>
70
+
71
+ <p>About <a href="https://en.wikipedia.org/wiki/Boolean_satisfiability_problem">SAT</a>, <a href="https://en.wikipedia.org/wiki/SAT_solver">SAT solver</a></p>
72
+
73
+ <h2 id="description">Description</h2>
74
+ <p>To solve SAT, we usually use SAT solver.
75
+ Now, let’s solve the following SAT with SAT solver.</p>
76
+
77
+ \[(p_1 \lor \lnot p_5 \lor p_4) \land (\lnot p_1 \lor p_5 \lor p_3 \lor p_4) \land (\lnot p_3 \lor \lnot p_4)\]
78
+
79
+ <p>Most SAT solvers are input in <a href="https://www.cs.utexas.edu/users/moore/acl2/manuals/current/manual/index-seo.php/SATLINK____DIMACS">DIMACS Format</a>.
80
+ Converting the example SAT to DIMACS Format yields the following.</p>
81
+
82
+ <p><code>DIMACS Format
83
+ p cnf 5 3
84
+ 1 -5 4 0
85
+ -1 5 3 4 0
86
+ -3 -4 0
87
+ </code></p>
88
+
89
+ <p>DIMACS Format is widely distributed as an I/O format for SAT solver.
90
+ However, when solving a large SAT, the following problems occur.
91
+ - Need to create a file with thousands of lines.
92
+ - Confusion arises because of the inability to name variables meaningfully.</p>
93
+
94
+ <p>To solve these problems, Ravensat can be used.
95
+ Using Ravensat, propositional variables can be defined as local variables in Ruby.</p>
96
+
97
+ <p><code>ruby
98
+ fuji_is_the_highest_mountain_in_japan = Ravensat::VarNode.new
99
+ </code></p>
100
+
101
+ <p>In addition, you can write logical expressions intuitively.</p>
102
+
103
+ <p>```ruby
104
+ x = Ravensat::VarNode.new
105
+ y = Ravensat::VarNode.new</p>
106
+
107
+ <p>(x | y) &amp; (~x | y) # (x or y) and (not x or y)
108
+ ```</p>
109
+
110
+ <h2 id="installation">Installation</h2>
111
+
112
+ <p>Add this line to your application’s Gemfile:</p>
113
+
114
+ <p><code>ruby
115
+ gem 'ravensat'
116
+ </code></p>
117
+
118
+ <p>And then execute:</p>
119
+
120
+ <pre class="code ruby"><code class="ruby">$ bundle install
121
+ </code></pre>
122
+
123
+ <p>Or install it yourself as:</p>
124
+
125
+ <pre class="code ruby"><code class="ruby">$ gem install ravensat
126
+ </code></pre>
127
+
128
+ <h2 id="usage">Usage</h2>
129
+ <p>### Basic Usage
130
+ This is a basic usage example of the library.</p>
131
+
132
+ <p>```ruby
133
+ require ‘ravensat’</p>
134
+
135
+ <p>a = Ravensat::VarNode.new
136
+ b = Ravensat::VarNode.new</p>
137
+
138
+ <p>a.result #=&gt; nil
139
+ b.result #=&gt; nil</p>
140
+
141
+ <table>
142
+ <tbody>
143
+ <tr>
144
+ <td>logic = (a</td>
145
+ <td>b) &amp; (~a</td>
146
+ <td>b) &amp; (a</td>
147
+ <td>~b)</td>
148
+ </tr>
149
+ </tbody>
150
+ </table>
151
+
152
+ <p>solver = Ravensat::Solver.new
153
+ solver.solve logic #=&gt; true(SAT)</p>
154
+
155
+ <p>a.result #=&gt; true
156
+ b.result #=&gt; true
157
+ ```</p>
158
+
159
+ <p>If you have SAT solver installed, you can write:</p>
160
+
161
+ <p><code>ruby
162
+ solver = Ravensat::Solver.new("&lt;solver_name&gt;")
163
+ solver.solve logic
164
+ </code></p>
165
+
166
+ <p>The available solvers are assumed to be those that can be I/O in the DIMACS Format.
167
+ At least, we have confirmed that it works properly with <a href="https://github.com/niklasso/minisat">MiniSat</a>.</p>
168
+
169
+ <p>If you do not use an external SAT solver, create a SAT solver object without any constructor arguments.
170
+ In that case, <strong>Arcteryx</strong>(the very simple SAT solver built into Ravensat) will launch.</p>
171
+
172
+ <h3 id="extension-usage">Extension Usage</h3>
173
+ <p>In Ravensat::Extension, C-like variable definitions are available.</p>
174
+
175
+ <p><em>Note: In Ravensat::Extension, all undefined variables and methods are caught by method_missing method.</em></p>
176
+
177
+ <p>```ruby
178
+ require ‘ravensat’</p>
179
+
180
+ <p>module Ravensat
181
+ module Extension
182
+ bool a, b
183
+ logic = (a | b) &amp; (~a | b) &amp; (a | ~b)</p>
184
+
185
+ <pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_solver'>solver</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="Ravensat.html" title="Ravensat (module)">Ravensat</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Ravensat/Solver.html" title="Ravensat::Solver (class)">Solver</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Ravensat/Solver.html#initialize-instance_method" title="Ravensat::Solver#initialize (method)">new</a></span></span>
186
+ <span class='id identifier rubyid_solver'>solver</span><span class='period'>.</span><span class='id identifier rubyid_solve'>solve</span> <span class='id identifier rubyid_logic'>logic</span> <span class='comment'>#=&gt; true
187
+ </span>
188
+ <span class='id identifier rubyid_a'>a</span><span class='period'>.</span><span class='id identifier rubyid_result'>result</span> <span class='comment'>#=&gt; true
189
+ </span><span class='id identifier rubyid_b'>b</span><span class='period'>.</span><span class='id identifier rubyid_result'>result</span> <span class='comment'>#=&gt; true end end ```
190
+ </span></code></pre>
191
+
192
+ <h3 id="extension-usagecsp-constraint-satisfaction-problem">Extension Usage(CSP; Constraint Satisfaction Problem)</h3>
193
+ <p>It is possible to define integer variables and to describe some integer constraints.</p>
194
+
195
+ <p>```ruby
196
+ require ‘ravensat’</p>
197
+
198
+ <p>module Ravensat
199
+ module Extension
200
+ int a(1..10), b(1..10)
201
+ constraint = (a.only_one &amp; b.only_one &amp; (a != b))</p>
202
+
203
+ <pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_solver'>solver</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="Ravensat.html" title="Ravensat (module)">Ravensat</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Ravensat/Solver.html" title="Ravensat::Solver (class)">Solver</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Ravensat/Solver.html#initialize-instance_method" title="Ravensat::Solver#initialize (method)">new</a></span></span>
204
+ <span class='id identifier rubyid_solver'>solver</span><span class='period'>.</span><span class='id identifier rubyid_solve'>solve</span> <span class='id identifier rubyid_constraint'>constraint</span> <span class='comment'>#=&gt; true
205
+ </span>
206
+ <span class='id identifier rubyid_a'>a</span><span class='period'>.</span><span class='id identifier rubyid_result'>result</span> <span class='comment'>#=&gt; 1
207
+ </span><span class='id identifier rubyid_b'>b</span><span class='period'>.</span><span class='id identifier rubyid_result'>result</span> <span class='comment'>#=&gt; 2 end end ```
208
+ </span></code></pre>
209
+
210
+ <h2 id="development">Development</h2>
211
+
212
+ <p>After checking out the repo, run <code>bin/setup</code> to install dependencies. Then, run <code>rake spec</code> to run the tests. You can also run <code>bin/console</code> for an interactive prompt that will allow you to experiment.</p>
213
+
214
+ <p>To install this gem onto your local machine, run <code>bundle exec rake install</code>. To release a new version, update the version number in <code>version.rb</code>, and then run <code>bundle exec rake release</code>, which will create a git tag for the version, push git commits and the created tag, and push the <code>.gem</code> file to <a href="https://rubygems.org">rubygems.org</a>.</p>
215
+
216
+ <h2 id="contributing">Contributing</h2>
217
+
218
+ <p>Bug reports and pull requests are welcome on GitHub at https://github.com/matsuda0528/ravensat.</p>
219
+
220
+ <h2 id="license">License</h2>
221
+
222
+ <p>The gem is available as open source under the terms of the <a href="https://opensource.org/licenses/MIT">MIT License</a>.</p>
223
+ </div></div>
224
+
225
+ <div id="footer">
226
+ Generated on Wed May 25 14:42:45 2022 by
227
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
228
+ 0.9.27 (ruby-3.0.0).
229
+ </div>
230
+
231
+ </div>
232
+ </body>
233
+ </html>