Skip to content

Commit

Permalink
we could reuse the simple cycles ...
Browse files Browse the repository at this point in the history
  • Loading branch information
thvitt committed Mar 7, 2019
1 parent 725bd80 commit d08ef8c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/macrogen/fes.py
Expand Up @@ -276,6 +276,7 @@ def __init__(self, graph: nx.DiGraph, force_forward_edges: Optional[List[Tuple[V
self.solution = None
self.objective = None
self.iterations = None
self.simple_cycles = []
self._load_solver_args()

def _load_solver_args(self):
Expand Down Expand Up @@ -404,4 +405,5 @@ def solve(self):
self.solution = self.edges_for_vector(current_solution)
self.objective = objective.value
self.iterations = iteration
self.simple_cycles = simple_cycles
return self.solution
6 changes: 3 additions & 3 deletions src/macrogen/graph.py
Expand Up @@ -141,19 +141,19 @@ def expand_edges(graph: nx.MultiDiGraph, edges: Iterable[Tuple[Any, Any]]) -> Ge
yield u, v, key, atlas[key]


def prepare_timeline_for_keeping(graph: nx.MultiDiGraph, weight=0.1) -> List[Tuple[V,V]]:
def prepare_timeline_for_keeping(graph: nx.MultiDiGraph, weight=0.1) -> List[Tuple[V, V]]:
result = []
for u, v, k, attr in graph.edges(keys=True, data=True):
if attr['kind'] == 'timeline':
result.append((u, v))
if weight is 'auto':
attr['weight'] = (v-u).days / 365.25
attr['weight'] = (v - u).days / 365.25
else:
attr['weight'] = weight
return result


def feedback_arcs(graph: nx.MultiDiGraph, method=None, lightweight_timeline: Optional[bool] = None):
def feedback_arcs(graph: nx.MultiDiGraph, method=None, light_timeline: Optional[bool] = None):
"""
Calculates the feedback arc set using the given method and returns a
list of edges in the form (u, v, key, data)
Expand Down

0 comments on commit d08ef8c

Please sign in to comment.