File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 77
88from mesa .spaces import CellAgent , Network
99
10+
1011@dataclass
1112class NodeCoordinates :
1213 city : int
@@ -108,10 +109,11 @@ def calculate_pheromone_delta(self, q: float = 100):
108109 def move_to (self , cell ) -> None :
109110 self ._cities_visited .append (cell )
110111 if self .cell :
111- self ._traveled_distance += self .graph [self .cell .coordinate ][cell .coordinate ]["distance" ]
112+ self ._traveled_distance += self .graph [self .cell .coordinate ][
113+ cell .coordinate
114+ ]["distance" ]
112115 super ().move_to (cell )
113116
114-
115117 def decide_next_city (self ):
116118 # Random
117119 # new_city = self.random.choice(list(self.model.all_cities - set(self.cities_visited)))
@@ -125,8 +127,10 @@ def decide_next_city(self):
125127 results = []
126128 for city in candidates :
127129 val = (
128- (self .graph [self .cell .coordinate ][city .coordinate ]["pheromone" ]) ** self .alpha
129- * (self .graph [self .cell .coordinate ][city .coordinate ]["visibility" ]) ** self .beta
130+ (self .graph [self .cell .coordinate ][city .coordinate ]["pheromone" ])
131+ ** self .alpha
132+ * (self .graph [self .cell .coordinate ][city .coordinate ]["visibility" ])
133+ ** self .beta
130134 )
131135 results .append (val )
132136
You can’t perform that action at this time.
0 commit comments