Open cczhu opened 5 years ago
Now that we have OR-Tools and agent modelling in the other repo:
get_paths
should then return a list of path objects, not a list of values (it should still be trivial to return a list of lists, since that functionality is built into the ShiftTracker
class already).DriverShiftBase
subclass, so that we only need one ShiftTracker
class that the user needs to instantiate.Will be each of these off to individual small PRs. Updating as needed.
"Refactor linker..." and "Refactor batched linker" comments partly addressed by #7.
Transplanting comments by @candu on the other repo to here.
digraph_to_bipartite
always return a directed graph; calling methods can then use.to_undirected
to return an undirected graph.map()
to build the bipartite graph, e.g.nodesb_top = map(lambda item: str(item) + '_i', G.nodes())
.linker
so that each linker algorithm is a class, inheriting fromLinkerBase
which houses thedigraph_to_bipartite
andmatching_to_digraph
routines. After this, we can also split up thematching_to_digraph
class into subroutinesto_directed_matching
anddirected_matching_to_digraph
. This allows us to:return_matching=True
.check_degree
et al. into the unit tests.min_edge = c_edges[0]...
->return min(c_edges, key=lambda edge: Gw.edges[edge][mintype])
because Python has solved it for us.self._disable_tqdm = True if not progress_bar else False
->self._disable_tqdm = not progress_bar
get_paths
toget_paths
.