code stringlengths 3 6.57k |
|---|
append(data[1]) |
format(key+1) |
core_list.append([pop[key][0], caseid]) |
Pool(self.ncores) |
p.map(self.gen_object, core_list) |
p.close() |
p.join() |
append(fitness[ind]) |
range(len(pop) |
format(key+1) |
self.fit(pop[key][0], caseid) |
append(fitness) |
fit(self, ind, caseid) |
ind (list) |
caseid (str) |
mean_reward (float) |
list(self.param_dict.keys() |
os.makedirs('./tunecases/case{}'.format(i) |
copy.deepcopy(self.template) |
range (len(self.param_names) |
self.new_template.replace(str(self.param_names[j]) |
str(ind[j]) |
format(i, i) |
open (filename, 'w') |
fout.writelines(self.new_template) |
self.tuneblock.keys() |
print('--debug: external files are identified, copying them into each case directory') |
os.system('cp -r {} ./tunecases/case{}/'.format(item, i) |
print('--------------------------------------------------') |
print('Running TUNE Case {}/{}: {}'.format(casenum, self.ncases, ind) |
subprocess.call([self.python_path, self.neorl_path, '-i', 'case{}.inp'.format(casenum) |
format(casenum) |
print('--------------------------------------------------') |
os.listdir('./tunecases/case{}/case{}_log/'.format(casenum, casenum) |
f.endswith('_out.csv') |
len(csvfile) |
Exception ('multiple *_out.csv files can be found in the logger of TUNE, only one is allowed') |
pd.read_csv('./tunecases/case{}/case{}_log/{}'.format(casenum,casenum, csvfile[0]) |
np.mean(reward_lst[-self.n_last_episodes:]) |
np.max(reward_lst) |
open (self.csvlogger, 'a') |
fout.write(str(casenum) |
fout.write(str(item) |
fout.write(str(mean_reward) |
str(max_reward) |
print('--error: case{}.inp failed during execution'.format(casenum) |
format(casenum) |
gen_object(self, inp) |
inp (list of lists) |
value (float) |
self.fit(inp[0], inp[1]) |
select(self, pop) |
pop (dict) |
k (int) |
best_dict (dict) |
list(pop.items() |
pop.sort(key=lambda e: e[1][2], reverse=True) |
dict(pop[:k]) |
defaultdict(list) |
append(sorted_dict[key][0]) |
append(sorted_dict[key][1]) |
append(sorted_dict[key][2]) |
sorted_dict.clear() |
cx(self, ind1, ind2, strat1, strat2) |
ind1 (list) |
ind2 (list) |
strat1 (list) |
strat2 (list) |
print('individual 1', type(item) |
print('individual 2', type(item) |
print('strategy 1', type(item) |
print('strategy 2', type(item) |
min(len(ind1) |
len(ind2) |
random.randint(1, size) |
random.randint(1, size-1) |
mutES(self, ind, strat) |
ind (list) |
strat (list) |
ind (list) |
strat (list) |
len(ind) |
np.sqrt(2*size) |
np.sqrt(2*np.sqrt(size) |
range(size) |
self.paraminds.keys() |
random.gauss(0,1) |
np.exp(-tau*norm-tau_prime*random.gauss(0,1) |
np.floor(y) |
np.abs(y-np.floor(y) |
np.abs(y-np.floor(y) |
random.random() |
random.sample(self.paramvals[paramname], 1) |
random.gauss(0,1) |
np.exp(-tau*norm-tau_prime*random.gauss(0,1) |
np.floor(y) |
np.abs(y-np.floor(y) |
np.abs(y-np.floor(y) |
random.random() |
list(range(self.LOW[i], self.UP[i]+1) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.