diff --git a/experiments/genetic_landscape.py b/experiments/genetic_landscape.py index 1c314a6c..03e1ea77 100644 --- a/experiments/genetic_landscape.py +++ b/experiments/genetic_landscape.py @@ -52,9 +52,9 @@ def run_test(args): # Number of iterations for each graph size total_iters = 1 # Number of graph sizes -graphs = 10 +graphs = 1 # Graph sizes -sizes = [30 * i for i in range(1, graphs + 1)] +sizes = [100 * i for i in range(1, graphs + 1)] total_results = [] # Seed for random number generator can be specified here # seed = 1 diff --git a/sampo/generator/base.py b/sampo/generator/base.py index 1c9eefe2..9fa7c00c 100644 --- a/sampo/generator/base.py +++ b/sampo/generator/base.py @@ -93,7 +93,7 @@ def set_materials_for_wg(self, wg: WorkGraph, materials_name: list[str] = None, if top_border is None: top_border = len(materials_name) - if bottom_border >= len(materials_name) or top_border >= len(materials_name): + if bottom_border > len(materials_name) or top_border > len(materials_name): raise ValueError('The borders are out of the range of materials_name') for node in wg.nodes: diff --git a/sampo/schemas/landscape.py b/sampo/schemas/landscape.py index 8880830f..6b3d992c 100644 --- a/sampo/schemas/landscape.py +++ b/sampo/schemas/landscape.py @@ -162,7 +162,7 @@ def dijkstra(node_ind: int): continue d = dist + road.weight finish_ind = self._node2ind[road.finish] - if d < distances[finish_ind] and road.id in roads_available_set: + if d < distances[finish_ind]: distances[finish_ind] = d path_mx[node_ind][finish_ind] = v heapq.heappush(prior_queue, (d, finish_ind)) @@ -184,13 +184,11 @@ def dijkstra(node_ind: int): if path_mx[to_ind][from_ind] == -1: return [] - path_tmp = [] fr = from_ind + path = [from_ind] while path_mx[to_ind][fr] != to_ind: - path_tmp.append(path_mx[to_ind][fr]) + path.append(path_mx[to_ind][fr]) fr = path_mx[to_ind][fr] - path = [from_ind] - path.extend(path_tmp) path.append(to_ind) return [self.road_mx[path[v]][path[v + 1]] for v in range(len(path) - 1)]