diff --git a/kadmos/graph/graph_data.py b/kadmos/graph/graph_data.py index 3bb040368793f96d4f4789911b55dec51b84605f..7a4fba70fbf1f0035d195b81b66e81b92018e276 100644 --- a/kadmos/graph/graph_data.py +++ b/kadmos/graph/graph_data.py @@ -5305,8 +5305,6 @@ class MdaoDataGraph(DataGraph, MdaoMixin): skip_coupling = True if skip_coupling: continue - # Remove coupling edge between coupling variable -> function - self.remove_edge(coupling[2], coupling[1]) # Create initial guess coupling variable node ini_guess_node = self.copy_node_as(coupling[2], self.ARCHITECTURE_ROLES_VARS[0]) # If there is no converger node, then just add an initial guess of the coupled node @@ -5321,7 +5319,7 @@ class MdaoDataGraph(DataGraph, MdaoMixin): coupling_copy_node = self.copy_node_as(coupling[2], self.ARCHITECTURE_ROLES_VARS[2]) if not self.has_edge(converger, coupling_copy_node): self.add_edge(converger, coupling_copy_node) - self.add_edge(coupling_copy_node, coupling[1]) + self.copy_edge((coupling[2], coupling[1]) ,(coupling_copy_node, coupling[1])) # Connect original coupling node to the converger self.add_edge(coupling[2], converger) # If the converger node is an optimizer (IDF), then connect it accordingly @@ -5333,7 +5331,7 @@ class MdaoDataGraph(DataGraph, MdaoMixin): coupling_copy_node = self.copy_node_as(coupling[2], self.ARCHITECTURE_ROLES_VARS[2]) if not self.has_edge(converger, coupling_copy_node): self.add_edge(converger, coupling_copy_node) - self.add_edge(coupling_copy_node, coupling[1]) + self.copy_edge((coupling[2], coupling[1]), (coupling_copy_node, coupling[1])) # Connect original and copied coupling node to the consistency constraint function self.add_edge(coupling[2], self.CONSCONS_STRING, equation_label='y{}'.format(idx)) self.add_edge(coupling_copy_node, self.CONSCONS_STRING, equation_label='y{}c'.format(idx)) @@ -5348,6 +5346,8 @@ class MdaoDataGraph(DataGraph, MdaoMixin): self.node[self.CONSCONS_STRING]['consistency_nodes'].append(consistency_node) else: self.node[self.CONSCONS_STRING]['consistency_nodes'] = [consistency_node] + # Remove coupling edge between coupling variable -> function + self.remove_edge(coupling[2], coupling[1]) # If required, create final coupling variable node and let it come from the coupled function if converger and ('problem_role' in self.node[coupling[2]] or include_couplings_as_final_output): final_node = self.copy_node_as(coupling[2], self.ARCHITECTURE_ROLES_VARS[1])