Class: ArtDecomp::Decomposer
- Inherits:
-
Object
- Object
- ArtDecomp::Decomposer
- Defined in:
- lib/art-decomp/decomposer.rb
Instance Method Summary collapse
- #decompositions(opts = {}) ⇒ Object
-
#initialize(params) ⇒ Decomposer
constructor
A new instance of Decomposer.
Constructor Details
#initialize(params) ⇒ Decomposer
Returns a new instance of Decomposer.
3 4 5 6 7 8 9 |
# File 'lib/art-decomp/decomposer.rb', line 3 def initialize params @archs = params[:archs] @fsm = params[:fsm] @uv_gens = params[:uv_gens].map &:new @qu_gens = params[:qu_gens].map &:new @qv_gens = params[:qv_gens].map &:new end |
Instance Method Details
#decompositions(opts = {}) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/art-decomp/decomposer.rb', line 11 def decompositions opts = {} @seen = Set[] Enumerator.new do |yielder| @uv_gens.each do |uv_gen| uv_gen.uv_pairs(@fsm, @archs).each do |fsm, u, v| unless @seen.include? [fsm, u, v] @qu_gens.each do |qu_gen| qu_gen.blankets(fsm, u, v).each do |qu| unless @seen.include? [fsm, u, v, qu] @qv_gens.each do |qv_gen| qv_gen.blankets(fsm, u, v, qu).each do |qv, g| unless @seen.include? [fsm, u, v, qu, qv, g] dec = Decomposition.new fsm, u, v, qu, qv, g if dec.sensible? @archs if opts[:non_disjoint] non_disjoint(fsm, u, v, qu, qv, g, opts).each do |ndj| yielder.yield ndj end end yielder.yield dec end @seen << [fsm, u, v, qu, qv, g] unless opts[:keep_seen] end end end @seen << [fsm, u, v, qu] unless opts[:keep_seen] end end end @seen << [fsm, u, v] unless opts[:keep_seen] end end end end end |