-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprototype.py
More file actions
59 lines (45 loc) · 1.23 KB
/
prototype.py
File metadata and controls
59 lines (45 loc) · 1.23 KB
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
import _sa
import random
import numpy as np
import sys
class CustomClass():
def __init__(self):
pass
def jumpState(self,scale,cur_t, iter):
pass
def reverse(self):
pass
def storeBest(self):
pass
def getEnergy(self)->float:
pass
def output(self):
pass
def stopCondition(self,final_t,energy,cur_t,iter,ag_r,ab_r,rb_r)->bool:
pass
def main():
#parameter setting--------------------------
descen_rate = 0.7
initial_t = 1000.0
final_t = 1.0
scale = 0.5
markov_iter = 10000
scale_descent_rate = 0
show = True
logger_iter = 1
history_file = "output.csv"
#-------------------------------------------
#custom part--------------------------------
#---------write what you need here----------
#-------------------------------------------
#demonstrate how to use SAAF----------------
sa = _sa.SA(CustomClass())
sa.setParam(descen_rate,initial_t,final_t,scale,markov_iter,scale_descent_rate)
sa.run(show,logger_iter)
sa.showReport()
sa.output()
sa.writeHistory(history_file)
sa.plot()
#-------------------------------------------
if __name__ == "__main__":
main()