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 CHANGED
@@ -1,4 +1,9 @@
1
- # 0.0.1 / FIX ME
1
+ # 0.0.2 / 2012-10-16
2
+
3
+ * Add optional parameter to BDD#to_dnf that specifies operator literals.
4
+ * Distribute dynamic library for MacOSx under ext/
5
+
6
+ # 0.0.1 / 2012-09-12
2
7
 
3
8
  * Enhancements
4
9
 
data/Gemfile CHANGED
@@ -1,7 +1,7 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
3
  group :runtime do
4
- gem "ffi", "~> 1.1"
4
+ gem "ffi", "~> 1.0"
5
5
  end
6
6
 
7
7
  group :development do
data/Manifest.txt CHANGED
@@ -13,3 +13,4 @@ README.md
13
13
  spec/**/*
14
14
  tasks/**/*
15
15
  test/**/*
16
+ ext/*
data/cudd-rb.noespec CHANGED
@@ -12,7 +12,7 @@ variables:
12
12
  upper:
13
13
  Cudd
14
14
  version:
15
- 0.0.1
15
+ 0.0.2
16
16
  summary: |-
17
17
  A ruby bridge to the CU Decision Diagram package (CUDD).
18
18
  description: |-
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 << " & " unless buf.empty?
68
- buf << "!" if val==0
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 << " | " unless buf.empty?
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
@@ -3,7 +3,7 @@ module Cudd
3
3
 
4
4
  MAJOR = 0
5
5
  MINOR = 0
6
- TINY = 1
6
+ TINY = 2
7
7
 
8
8
  def self.to_s
9
9
  [ MAJOR, MINOR, TINY ].join('.')
@@ -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
 
@@ -31,7 +31,7 @@ module Cudd
31
31
 
32
32
  context 'on an complex formula' do
33
33
  let(:bdd){ (x | y) & z }
34
- it{ should eq("(!v0 & v1 & v2) | (v0 & v2)") }
34
+ it{ should eq("(!(v0) & v1 & v2) | (v0 & v2)") }
35
35
  end
36
36
 
37
37
  end
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.1
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-09-12 00:00:00.000000000 Z
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: &70210468650120 !ruby/object:Gem::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: *70210468650120
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: &70210468665740 !ruby/object:Gem::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: *70210468665740
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: &70210468660380 !ruby/object:Gem::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: *70210468660380
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: &70210468679380 !ruby/object:Gem::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: *70210468679380
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: &70210468673680 !ruby/object:Gem::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: *70210468673680
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.15
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).