Exemplo n.º 1
0
 def _final_states(self):
   self._checked_final_states()
   final_states = nx.attracting.attracting_components(self._flow_graph)
   result = set()
   for final_subgroup in final_states:
     for node in final_subgroup:
         outputs = [w.dst_port for w in node.wave_front_rich]
         result.add(WorkVariant(iset(self._source_ports), iset(outputs), str(node.block_state)))
   return result
Exemplo n.º 2
0
 def connected_outputs(self, block):
   G = self._connection_graph
   result = []
   out_edges = G.out_edges(block, data=True)
   for e in out_edges:
     result.append(ports_set(e[2])[0])
   return iset(result)
Exemplo n.º 3
0
 def connected_inputs(self, block):
   G = self._connection_graph
   result = []
   in_edges = G.in_edges(block, data=True)
   for e in in_edges:
     result.append(ports_set(e[2])[1])
   return iset(result)
Exemplo n.º 4
0
 def generate_states(self):
   self._dst_map = self._wavefront_dst_map()
   print self._dst_map, "\n#####\n"
   print self.block_state
   self._src_map = self._wavefront_src_map()
   blocks_to_launch = set()
   for dst_block in self._dst_map:
     block_work_variants = self._block_work(dst_block, self.block_state[dst_block], set(self._dst_map[dst_block].keys()))
     if block_work_variants:
       blocks_to_launch.add((dst_block, iset(block_work_variants)))
   for state in self._evolve_state(blocks_to_launch):
     yield state
Exemplo n.º 5
0
def split_ports(s):
    if not s:
        return iset()
    return iset(split_by_comma(s))
Exemplo n.º 6
0
 def _key(self):
   return type(self), iset(self._wave_front), iset(self._block_states.items())