ricosat 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3f0e9513e7debb7bf00beb9a3ec4901839d1b247
4
- data.tar.gz: ba02d51143248877129218577dec3de7b9edfbba
3
+ metadata.gz: 18466f49c48ecd6df13bcb70bad7d70f7f50bbef
4
+ data.tar.gz: 6905a43219223e91de5f13fd1ad594671ebdfcbd
5
5
  SHA512:
6
- metadata.gz: f8b0b1b9208c454a44214ce06fee37457642efb51d1900511bfe68159039375990a21a638ce4a79f722cdc8744af4dc1ae238659c92fea441983e7a4c3f4df8d
7
- data.tar.gz: eb30927239fbcb1444f781dfe34bda13a5f2277acdc596b034190855e2fcd4467468ff9b075f1b83ce43de5fd60cfacc778cf12c538e1f4484490aade70a854b
6
+ metadata.gz: b92044058db7ac4788d8e009b24c01db42378ef149edcf03b2c8453f9aaf0493e86a88619613cec9e59f9a3c47681e3864361279b8576f45e0f1cc2f4b4db4a7
7
+ data.tar.gz: f473dc63d684deb3c79477ea9fe66d8fc8af66f7116ae4f8136d0edd29e926aeac773ce7ae38bd22af7574835bed30465346809baee71f247a9e065f2173b77f
data/README.md CHANGED
@@ -11,6 +11,18 @@ you use the PicoSAT solver from Ruby!
11
11
 
12
12
  * It's a SAT solver! Not SAT like the tests, but the [Boolean satisfiability problem](https://en.wikipedia.org/wiki/Boolean_satisfiability_problem)
13
13
 
14
+ ## INSTALLATION:
15
+
16
+ PicoSAT depends on [gmp](https://gmplib.org) and
17
+ [gperftools](https://github.com/gperftools/gperftools). On a Mac, these can be
18
+ installed in one shot with homebrew via `brew install gmp gperftools`.
19
+
20
+ Once you have those:
21
+
22
+ ``` ruby
23
+ $ gem install ricosat
24
+ ```
25
+
14
26
  ## SYNOPSIS:
15
27
 
16
28
  Solve the problem (A and NOT B):
@@ -166,6 +166,22 @@ static VALUE set_global_default_phase(VALUE self, VALUE val)
166
166
  return self;
167
167
  }
168
168
 
169
+ static VALUE reset_phases(VALUE self)
170
+ {
171
+ PicoSAT * sat;
172
+ TypedData_Get_Struct(self, PicoSAT, &RicoSatType, sat);
173
+ picosat_reset_phases(sat);
174
+ return self;
175
+ }
176
+
177
+ static VALUE reset_scores(VALUE self)
178
+ {
179
+ PicoSAT * sat;
180
+ TypedData_Get_Struct(self, PicoSAT, &RicoSatType, sat);
181
+ picosat_reset_scores(sat);
182
+ return self;
183
+ }
184
+
169
185
  void error_cb(const char *m) {
170
186
  rb_raise(rb_eRuntimeError, "%s", m);
171
187
  }
@@ -197,6 +213,8 @@ void Init_ricosat() {
197
213
  rb_define_method(cRicoSat, "coreclause", coreclause, 1);
198
214
  rb_define_method(cRicoSat, "added_original_clauses", added_original_clauses, 0);
199
215
  rb_define_method(cRicoSat, "global_default_phase=", set_global_default_phase, 1);
216
+ rb_define_method(cRicoSat, "reset_phases", reset_phases, 0);
217
+ rb_define_method(cRicoSat, "reset_scores", reset_scores, 0);
200
218
  }
201
219
 
202
220
  /* vim: set sws=4 noet: */
data/lib/ricosat.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  require 'ricosat.so'
2
2
 
3
3
  class RicoSAT
4
- VERSION = '1.0.1'
4
+ VERSION = '1.0.2'
5
5
  end
data/test/test_ricosat.rb CHANGED
@@ -143,4 +143,16 @@ class TestRicosat < MiniTest::Test
143
143
  sat.add(1); sat.add(0)
144
144
  assert sat.set_default_phase 1, 1
145
145
  end
146
+
147
+ def test_reset_phases
148
+ sat = RicoSAT.new
149
+ sat.add(1); sat.add(0)
150
+ assert sat.reset_phases
151
+ end
152
+
153
+ def test_reset_scores
154
+ sat = RicoSAT.new
155
+ sat.add(1); sat.add(0)
156
+ assert sat.reset_scores
157
+ end
146
158
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ricosat
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Patterson