-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_diag_evolve.py
67 lines (51 loc) · 1.38 KB
/
run_diag_evolve.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# !/usr/bin/python3
# -*- coding: utf-8 -*-
# Created by kyoRan on 2021/7/19 21:36
import os
import glob
import shutil
import importlib
import matplotlib.pyplot as plt
from algs.is_end import *
if __name__ == '__main__':
# 初始化
plt.rc('font', family='Times New Roman')
plt.switch_backend('agg')
fig = plt.figure(figsize=(8, 8))
ax = plt.subplot(111)
# plt.ion()
points = np.array([
[-1.8, 0.35],
[-2.0, -0.8],
[0.7, 0.666],
[0.86, -0.58],
[1.2, -0.05],
# GW
[-0.333, 0],
# DW
[-0.8, 0.5],
[-0.85, -0.6],
# CH
[-1.4, 0],
[0.4, 0],
])
end_threshold = 1e-2
algorithm_type = "HSBMAS"
results_path = rf"./results/diagram/{algorithm_type}"
if not os.path.exists(results_path):
os.makedirs(results_path)
else:
shutil.rmtree(results_path)
os.mkdir(results_path)
print("\tlog save path:", results_path)
alg = importlib.import_module(rf'algs.{algorithm_type}')
k = 0
while True:
k += 1
ax.cla()
next_points, last_A = alg.evolve(points, 1.2, 0.04, results_path, k, ax)
if is_end(last_A, k, points, end_threshold):
break
else:
points = next_points
# plt.pause(0.01)