File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -109,9 +109,14 @@ def __init__(
109109
110110 def __encode_path_cover (self ):
111111
112+ subpath_constraint_edges = set ()
113+ for subpath_constraint in self .subpath_constraints :
114+ for edge in zip (subpath_constraint [:- 1 ], subpath_constraint [1 :]):
115+ subpath_constraint_edges .add (edge )
116+
112117 # We encode that for each edge (u,v), the sum of the weights of the paths going through the edge is equal to the flow value of the edge.
113- for u , v , data in self .G .edges (data = True ):
114- if (u , v ) in self .edges_to_ignore :
118+ for u , v in self .G .edges ():
119+ if (u , v ) in self .edges_to_ignore or ( u , v ) in subpath_constraint_edges :
115120 continue
116121
117122 # We require that self.edge_vars[(u, v, i)] is 1 for at least one i
You can’t perform that action at this time.
0 commit comments