修改GA bug
This commit is contained in:
parent
c9db9244b3
commit
17acfa5409
@ -82,7 +82,8 @@ with tqdm(total=total_iterations, desc="Processing") as pbar:
|
|||||||
car_path = []
|
car_path = []
|
||||||
for k in range(from_index, end_index + 1):
|
for k in range(from_index, end_index + 1):
|
||||||
rectrangle_idx = best_solution[k]
|
rectrangle_idx = best_solution[k]
|
||||||
car_path.append(rectrangles[rectrangle_idx]['center'])
|
if rectrangle_idx not in to_process_idx:
|
||||||
|
car_path.append(rectrangles[rectrangle_idx - 1]['center'])
|
||||||
car_paths.append(car_path)
|
car_paths.append(car_path)
|
||||||
pbar.update(1)
|
pbar.update(1)
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ if __name__ == "__main__": # 重要:在 Windows 上必须加这一行
|
|||||||
for k in range(from_index, end_index + 1):
|
for k in range(from_index, end_index + 1):
|
||||||
rectrangle_idx = best_solution[k]
|
rectrangle_idx = best_solution[k]
|
||||||
if rectrangle_idx not in to_process_idx:
|
if rectrangle_idx not in to_process_idx:
|
||||||
car_path.append(rectrangles[rectrangle_idx]['center'])
|
car_path.append(rectrangles[rectrangle_idx - 1]['center'])
|
||||||
car_paths.append(car_path)
|
car_paths.append(car_path)
|
||||||
|
|
||||||
# 输出最佳方案
|
# 输出最佳方案
|
||||||
|
Loading…
Reference in New Issue
Block a user