Skip to content

Commit 17d324e

Browse files
Bumped up the versions of all pre-commit hooks (#6)
* Bumped pre-commit hooks versions * Linting
1 parent fd49065 commit 17d324e

File tree

6 files changed

+12
-14
lines changed

6 files changed

+12
-14
lines changed

.pre-commit-config.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
repos:
22
- repo: https://github.com/ambv/black
3-
rev: 19.3b0
3+
rev: 22.6.0
44
hooks:
5-
- id: black
5+
- id: black
66
- repo: https://github.com/pre-commit/pre-commit-hooks
7-
rev: v4.0.1
7+
rev: v4.3.0
88
hooks:
99
- id: check-yaml
10+
- id: check-toml
1011
- id: check-ast
1112
- id: end-of-file-fixer
1213
- id: trailing-whitespace
@@ -15,7 +16,7 @@ repos:
1516
args:
1617
- --maxkb=1000
1718
- repo: https://github.com/Lucas-C/pre-commit-hooks
18-
rev: v1.1.10
19+
rev: v1.3.0
1920
hooks:
2021
- id: remove-crlf
2122
- id: remove-tabs

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ Simulator(graph).simulate(source, destination, num_episodes=100, plot=True)
121121

122122
<hr>
123123

124-
## Contributing
125124

125+
## Contributing
126126

127127
- Post any issues and suggestions on the GitHub [issues](https://github.com/hasnainroopawalla/Ant-Colony-Optimization/issues) page.
128128
- To contribute, fork the project and then create a pull request back to master.

aco_routing/utils/ant.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def _calculate_edges_total(
7575
"""
7676
total = 0.0
7777
for neighbor, edge in unvisited_neighbors.items():
78-
total += (edge.pheromones ** alpha) * ((1 / edge.travel_time) ** beta)
78+
total += (edge.pheromones**alpha) * ((1 / edge.travel_time) ** beta)
7979
return total
8080

8181
@staticmethod
@@ -96,7 +96,7 @@ def _calculate_edge_probabilites(
9696
probabilities = {}
9797
for neighbor, edge in unvisited_neighbors.items():
9898
probabilities[neighbor] = (
99-
(edge.pheromones ** alpha) * ((1 / edge.travel_time) ** beta)
99+
(edge.pheromones**alpha) * ((1 / edge.travel_time) ** beta)
100100
) / total
101101
return probabilities
102102

@@ -157,8 +157,7 @@ def _pick_next_node(
157157
return self._choose_neighbor_using_roulette_wheel(sorted_probabilities)
158158

159159
def take_step(self) -> None:
160-
"""This method allows the ant to travel to a neighbor of the current node in the graph.
161-
"""
160+
"""This method allows the ant to travel to a neighbor of the current node in the graph."""
162161
# Mark the node as visited.
163162
self.visited_nodes.add(self.current_node)
164163

aco_routing/utils/graph.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,7 @@ def compute_path_travel_time(self, path: List[str]) -> float:
212212
return cost
213213

214214
def evaporate(self) -> None:
215-
"""Evaporates the pheromone values of all the edges given the evaporation parameter (rho).
216-
"""
215+
"""Evaporates the pheromone values of all the edges given the evaporation parameter (rho)."""
217216
for node_id, node in self.graph.items():
218217
for neighbor, edge in self.graph[node_id].edges.items():
219218
edge.pheromones = (1 - self.evaporation_rate) * edge.pheromones

aco_routing/utils/simulator.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ class Simulator:
3333
episodes: List[Episode] = field(default_factory=list)
3434

3535
def show_simulation_plot(self) -> None:
36-
"""Displays a plot to compare the path costs of the candidate algorithm with the baseline Dijkstra's algorithm across all episodes.
37-
"""
36+
"""Displays a plot to compare the path costs of the candidate algorithm with the baseline Dijkstra's algorithm across all episodes."""
3837
dijkstra_costs, aco_costs = [], []
3938
for episode in self.episodes:
4039
dijkstra_costs.append(episode.dijkstra_cost)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
setup(
1010
name="aco_routing",
11-
version="1.0.3",
11+
version="1.0.4",
1212
packages=find_packages(exclude="tests"),
1313
description="A Python package to find the shortest path in a graph using Ant Colony Optimization (ACO).",
1414
long_description=long_description,

0 commit comments

Comments
 (0)