r.model.label_y = 'MLR_TOTAL' r.model.header_line = 1 r.experiment.file_name = "Data.csv" r.experiment.label_x = '# Time_{}_75'.format(iso) r.experiment.label_y = 'SG_{}_75'.format(iso) r.experiment.header_line = 0 r.experiment.yfactor = 1e-3 r.fitness_method = pr.FitnessMethodRMSE(n_points=100) # use above model prototype (mps0) as template mps = copy.deepcopy(mps0) TEND = 600 # modify a single value of model parameter mps[3].value = TEND # create simulation setup object template_file = "SimpleConeLaunchTest_{}_BestParaSet_Toast.fds".format(iso) s = pr.SimulationSetup(name='cone_{}'.format(iso), work_dir='cone_{}'.format(iso), model_template=template_file, model_parameter=mps, model_executable='fds', relations=r) # append above object to simulation setup set setups.append(s) # use default values for optimiser optimiser = pr.OptimiserProperties()
model_parameter=model_parameter_setups[i], model_executable='fds', relations=r[i]) ssetups.append(s) # Initialise empty simulation setup sets. setups = pr.SimulationSetupSet() # Append above objects to simulation setup set. for i in range(len(HeatingRatesTGA)): setups.append(ssetups[i]) print('** setups generated') # Provide values for optimiser. optimiser = pr.OptimiserProperties(algorithm='sceua', repetitions=150, ngs=4, # Sub-processes would be used for # repetitions of an experiment. num_subprocesses=1, mpi=False) print('** input file processed')
# define variable 'ops': optimisation parameter set # define variable 'setups': simulation setup set # define variable 'optimiser': properties for the optimiser # import just for IDE convenience import propti as pr # fix the chid CHID = 'TGA_analysis_01' TEND = 9360 # use default values for optimiser optimiser = pr.OptimiserProperties(algorithm='sceua', repetitions=10) #ngs=4, # define the optimisation parameter op1 = pr.Parameter(name='ref_temp_comp_01', place_holder='rtc01', min_value=200, max_value=400) op2 = pr.Parameter(name='ref_rate_comp_01', place_holder='rrc01', min_value=0.001, max_value=0.01) op3 = pr.Parameter(name='ref_temp_comp_02', place_holder='rtc02', min_value=300, max_value=600) op4 = pr.Parameter(name='ref_rate_comp_02', place_holder='rrc02', min_value=0.001,
# Optimiser to perform FAST sensitivity analysis. # Use the same data from optimiser for sensitivity analysis num_subproc = optimiser.num_subprocesses mpi_bool = optimiser.mpi backup = optimiser.backup_every # Compute number of repetitions required k = len(ops) # total number of optimization params (M, d) = 3, 2 # M = inference factor, d = freq. step <spotpy defaults> rep = (1 + 4 * (M**2) * (1 + (k - 2) * d)) * k sensitivity = pr.OptimiserProperties('fast', repetitions=rep, backup_every=backup, db_name="propti_sensitivity_db", db_type="csv", num_subprocesses=num_subproc, mpi=mpi_bool) print(ver, setups, ops, sensitivity) ''' Not writing any data to pickle file since there is only one method to analyse sensitivity. It makes sense to Wiki this instead. ''' # Write sensitivity pickle file # out_file = open('propti_sensitivity.pickle.init', 'wb') # pickle.dump((setups, ops, optimiser), out_file) # out_file.close() # Run optimization.