cudd-rb 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +6 -1
- data/Gemfile +1 -1
- data/Manifest.txt +1 -0
- data/cudd-rb.noespec +1 -1
- data/ext/libcudd.dylib +0 -0
- data/lib/cudd-rb/cube.rb +4 -3
- data/lib/cudd-rb/interfaces/bdd.rb +3 -3
- data/lib/cudd-rb/version.rb +1 -1
- data/spec/cube/test_to_dnf.rb +3 -3
- data/spec/interfaces/bdd/test_bdd2dnf.rb +1 -1
- metadata +39 -16
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/Manifest.txt
CHANGED
data/cudd-rb.noespec
CHANGED
data/ext/libcudd.dylib
ADDED
Binary file
|
data/lib/cudd-rb/cube.rb
CHANGED
@@ -58,15 +58,16 @@ module Cudd
|
|
58
58
|
h
|
59
59
|
end
|
60
60
|
|
61
|
-
def to_dnf
|
61
|
+
def to_dnf(operators = {:not => :'!', :or => :'|', :and => :'&'})
|
62
62
|
buf = ""
|
63
63
|
to_a012.each_with_index do |val, index|
|
64
64
|
next if val == 2
|
65
65
|
name = interface.ith_var(index).var_name
|
66
66
|
name = name.respond_to?(:to_dnf) ? name.to_dnf : name.to_s
|
67
|
-
buf << "
|
68
|
-
buf << "
|
67
|
+
buf << " #{operators[:and]} " unless buf.empty?
|
68
|
+
buf << "#{operators[:not]}(" if val==0
|
69
69
|
buf << name
|
70
|
+
buf << ")" if val==0
|
70
71
|
end
|
71
72
|
buf
|
72
73
|
end
|
@@ -254,14 +254,14 @@ module Cudd
|
|
254
254
|
end
|
255
255
|
|
256
256
|
# Converts a bdd to a disjunctive normal form
|
257
|
-
def bdd2dnf(bdd)
|
257
|
+
def bdd2dnf(bdd, operators = {:not => :'!', :or => :'|', :and => :'&'})
|
258
258
|
return "true" if bdd==one
|
259
259
|
return "false" if bdd==zero
|
260
260
|
buf, size = "", 0
|
261
261
|
each_cube(bdd) do |cube|
|
262
262
|
size += 1
|
263
|
-
buf << "
|
264
|
-
buf << "(" << cube.to_dnf << ")"
|
263
|
+
buf << " #{operators[:or]} " unless buf.empty?
|
264
|
+
buf << "(" << cube.to_dnf(operators) << ")"
|
265
265
|
end
|
266
266
|
size == 1 ? buf[1...-1] : buf
|
267
267
|
end
|
data/lib/cudd-rb/version.rb
CHANGED
data/spec/cube/test_to_dnf.rb
CHANGED
@@ -18,7 +18,7 @@ module Cudd
|
|
18
18
|
let(:c){ cube(x => false) }
|
19
19
|
|
20
20
|
it 'uses default names' do
|
21
|
-
subject.should eq("!v0")
|
21
|
+
subject.should eq("!(v0)")
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
@@ -26,7 +26,7 @@ module Cudd
|
|
26
26
|
let(:c){ cube(x => true, y => false) }
|
27
27
|
|
28
28
|
it 'uses default names' do
|
29
|
-
subject.should eq("v0 & !v1")
|
29
|
+
subject.should eq("v0 & !(v1)")
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
@@ -36,7 +36,7 @@ module Cudd
|
|
36
36
|
let(:c){ cube(u => true, v => false) }
|
37
37
|
|
38
38
|
it 'uses provided names' do
|
39
|
-
subject.should eq("u & !v")
|
39
|
+
subject.should eq("u & !(v)")
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cudd-rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-10-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,15 @@ dependencies:
|
|
21
21
|
version: 0.9.2
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.9.2
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: rspec
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ~>
|
@@ -32,10 +37,15 @@ dependencies:
|
|
32
37
|
version: '2.11'
|
33
38
|
type: :development
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '2.11'
|
36
46
|
- !ruby/object:Gem::Dependency
|
37
47
|
name: yard
|
38
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
39
49
|
none: false
|
40
50
|
requirements:
|
41
51
|
- - ~>
|
@@ -43,10 +53,15 @@ dependencies:
|
|
43
53
|
version: 0.7.2
|
44
54
|
type: :development
|
45
55
|
prerelease: false
|
46
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.7.2
|
47
62
|
- !ruby/object:Gem::Dependency
|
48
63
|
name: bluecloth
|
49
|
-
requirement:
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
50
65
|
none: false
|
51
66
|
requirements:
|
52
67
|
- - ~>
|
@@ -54,10 +69,15 @@ dependencies:
|
|
54
69
|
version: '2.2'
|
55
70
|
type: :development
|
56
71
|
prerelease: false
|
57
|
-
version_requirements:
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '2.2'
|
58
78
|
- !ruby/object:Gem::Dependency
|
59
79
|
name: ffi
|
60
|
-
requirement:
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
61
81
|
none: false
|
62
82
|
requirements:
|
63
83
|
- - ~>
|
@@ -65,7 +85,12 @@ dependencies:
|
|
65
85
|
version: '1.0'
|
66
86
|
type: :runtime
|
67
87
|
prerelease: false
|
68
|
-
version_requirements:
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ~>
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '1.0'
|
69
94
|
description: ! "cudd-rb is a ruby bridge to the CU Decision Diagram (CUDD), an implementation
|
70
95
|
of \nBinary Decision Diagrams."
|
71
96
|
email:
|
@@ -144,6 +169,7 @@ files:
|
|
144
169
|
- tasks/spec_test.rake
|
145
170
|
- tasks/unit_test.rake
|
146
171
|
- tasks/yard.rake
|
172
|
+
- ext/libcudd.dylib
|
147
173
|
homepage: https://github.com/blambeau/cudd-rb
|
148
174
|
licenses: []
|
149
175
|
post_install_message:
|
@@ -156,9 +182,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
156
182
|
- - ! '>='
|
157
183
|
- !ruby/object:Gem::Version
|
158
184
|
version: '0'
|
159
|
-
segments:
|
160
|
-
- 0
|
161
|
-
hash: 2697852571902403534
|
162
185
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
163
186
|
none: false
|
164
187
|
requirements:
|
@@ -167,7 +190,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
167
190
|
version: '0'
|
168
191
|
requirements: []
|
169
192
|
rubyforge_project:
|
170
|
-
rubygems_version: 1.8.
|
193
|
+
rubygems_version: 1.8.24
|
171
194
|
signing_key:
|
172
195
|
specification_version: 3
|
173
196
|
summary: A ruby bridge to the CU Decision Diagram package (CUDD).
|