def _propose_graph(self, graph): """ we choose ONE core in the graph and return a valid grpah with a changed core note that when we chose the core, we made sure that there would be possible replacements.. """ # finding a legit candidate.. original_cip = self.select_original_cip(graph) # see which substitution to make candidate_cips = self._select_cips(original_cip) for candidate_cip in candidate_cips: # substitute and return graph_new = core_substitution(graph, original_cip.graph, candidate_cip.graph) if self.feasibility_checker.check(graph_new): graph_clean(graph_new) return self.postprocessor.postprocess(graph_new)
def _propose_graph(self, graph): """Override to store cip pairs to database if online_learning is true.""" original_cip = self.select_original_cip(graph) candidate_cips = self._candidate_cips(original_cip) for candidate_cip in candidate_cips: if candidate_cip.core_hash == original_cip.core_hash: continue graph_new = core_substitution(graph, original_cip.graph, candidate_cip.graph) if self.feasibility_checker.check(graph_new): graph_clean(graph_new) if self.online_learning: self._score(graph) self._score(graph_new) self._new_pair(original_cip, candidate_cip, graph._score, graph_new._score) return self.postprocessor.postprocess(graph_new) else: logger.debug('feasibility checker failed')