diff --git a/src/greedy.py b/src/greedy.py index 2c74a82..e686426 100644 --- a/src/greedy.py +++ b/src/greedy.py @@ -39,7 +39,8 @@ def explore_solutions(solutions, data, index): def remove_duplicates(current, previous, data): duplicate_free_df = data.query( - f"(source != {current} or destination not in @previous) and (source not in @previous or destination != {current})" + "(source != @current or destination not in @previous) and \ + (source not in @previous or destination != @current)" ) return duplicate_free_df diff --git a/src/local_search.py b/src/local_search.py index 3567ba6..8237dee 100644 --- a/src/local_search.py +++ b/src/local_search.py @@ -9,7 +9,8 @@ def get_first_random_solution(m, data): def element_in_dataframe(solution, element): duplicates = solution.query( - f"(source == {element.source} and destination == {element.destination}) or (source == {element.destination} and destination == {element.source})" + f"(source == {element.source} and destination == {element.destination}) or \ + (source == {element.destination} and destination == {element.source})" ) return not duplicates.empty