From 8228e668acddaeb1829618fdceeb48e867576e85 Mon Sep 17 00:00:00 2001
From: imcovangent <I.vanGent@tudelft.nl>
Date: Tue, 3 Apr 2018 09:32:47 +0200
Subject: [PATCH] Fixed missing equation_labels on new edges created in the
 connect_converger() method.

Former-commit-id: 677244ae2090d1a5d30e221063c4eb9e25f74cf3
---
 kadmos/graph/graph_data.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/kadmos/graph/graph_data.py b/kadmos/graph/graph_data.py
index 3bb040368..7a4fba70f 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])
-- 
GitLab