constraints={'length':200,'upper':1,'lower':0,'diff':0.66,'cost':50000})# length of detector, upper limit, lower limit and max diff of material parameters
importsys
n_epochs_pre=25//divide
n_epochs_main=40//divide
parameters=gen.parameters
parameters=gen.parameters
#if saved evolution exists, load it
importos.path
ifFalseandos.path.isfile('evolution.npy'):
...
...
@@ -106,6 +117,7 @@ if __name__ == "__main__":
'stds':std}
)
evolution.append([ps,losses,reco_losses])
withopen(outpath+'evolution.pkl','wb')asf:
pickle.dump(evolution,f)
# human readable
...
...
@@ -116,6 +128,7 @@ if __name__ == "__main__":
# now plot all entries of the dictionary ps in a plot and save it, make a new point for each of the items in the evolution list and use the dictionary keys as legend
save_evolution(updated_detector_parameters,o_loss,reco_loss,reco_model,gen.means,gen.stds)#save the optimised parameters here, not the ones for the next box generation