@@ -61,7 +61,7 @@ def tune_hyper_params(target_strategy: str, hyper_params: dict, *args, **kwargs)
61
61
# pass a temporary cache file to avoid duplicate execution
62
62
if 'cache' not in kwargs :
63
63
cachefile = get_random_unique_filename ('temp_' , '.json' )
64
- cachefile = Path ("hyperparamtuning_milo_bruteforce_dual_annealing .json" )
64
+ cachefile = Path (f"hyperparamtuning_paper_bruteforce_ { target_strategy } .json" )
65
65
kwargs ['cache' ] = str (cachefile )
66
66
67
67
def put_if_not_present (target_dict , key , value ):
@@ -88,14 +88,14 @@ def put_if_not_present(target_dict, key, value):
88
88
return list (result_unique .values ()), env
89
89
90
90
if __name__ == "__main__" : # TODO remove in production
91
- # hyperparams = {
92
- # 'popsize': [10, 20, 30],
93
- # 'maxiter': [50, 100, 150],
94
- # 'w': [0.25, 0.5, 0.75],
95
- # 'c1': [1.0, 2.0, 3.0],
96
- # 'c2': [0.5, 1.0, 1.5]
97
- # }
98
- # result, env = tune_hyper_params('pso', hyperparams)
91
+ hyperparams = {
92
+ 'popsize' : [10 , 20 , 30 ],
93
+ 'maxiter' : [50 , 100 , 150 ],
94
+ 'w' : [0.25 , 0.5 , 0.75 ],
95
+ 'c1' : [1.0 , 2.0 , 3.0 ],
96
+ 'c2' : [0.5 , 1.0 , 1.5 ]
97
+ }
98
+ result , env = tune_hyper_params ('pso' , hyperparams )
99
99
100
100
# hyperparams = {
101
101
# 'neighbor': ['Hamming', 'adjacent'],
@@ -105,10 +105,10 @@ def put_if_not_present(target_dict, key, value):
105
105
# }
106
106
# result, env = tune_hyper_params('greedy_ils', hyperparams)
107
107
108
- hyperparams = {
109
- 'method' : ['COBYLA' , 'L-BFGS-B' , 'SLSQP' , 'CG' , 'Powell' , 'Nelder-Mead' , 'BFGS' , 'trust-constr' ],
110
- }
111
- result , env = tune_hyper_params ('dual_annealing' , hyperparams )
108
+ # hyperparams = {
109
+ # 'method': ['COBYLA', 'L-BFGS-B', 'SLSQP', 'CG', 'Powell', 'Nelder-Mead', 'BFGS', 'trust-constr'],
110
+ # }
111
+ # result, env = tune_hyper_params('dual_annealing', hyperparams)
112
112
113
113
print (result )
114
114
print (env ['best_config' ])
0 commit comments