-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #150 from abachma2/moga
Multi-objective optimization for once-through scenarios
- Loading branch information
Showing
9 changed files
with
1,120 additions
and
0 deletions.
There are no files selected for viewing
158 changes: 158 additions & 0 deletions
158
input/haleu/optimization/once-through/MOGA_Analysis.ipynb
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
import numpy as np | ||
import dakota.interfacing as di | ||
import sys | ||
|
||
sys.path.append('../../../../scripts') | ||
import create_AR_DeployInst as cdi | ||
import output_metrics as oup | ||
import dakota_input as inp | ||
|
||
# ---------------------------- | ||
# Parse Dakota parameters file | ||
# ---------------------------- | ||
|
||
params, results = di.read_parameters_file() | ||
|
||
# ------------------------------- | ||
# Convert and send to Cyclus | ||
# ------------------------------- | ||
|
||
# Edit Cyclus input file | ||
cyclus_template = 'oncethrough_input.xml.in' | ||
scenario_name = ('lwr_' + | ||
str(int(params['lwr'])) + | ||
'_mmr_share_' + | ||
str(int(params['mmr_share'])) + | ||
'_xe100_share_' + | ||
str(int(params['xe100_share'])) + | ||
'_voygr_share_' + | ||
str(int(params['voygr_share'])) + | ||
'_mmr_burnup_' + | ||
str(int(params['mmr_burnup'])) + | ||
'_xe100_burnup_' + | ||
str(int(params['xe100_burnup']))) | ||
variable_dict = {'handle': scenario_name, | ||
'lwr':str(int(params['lwr'])), | ||
'mmr_share':str(int(params['mmr_share'])), | ||
'xe100_share':str(int(params['xe100_share'])), | ||
'voygr_share':str(int(params['voygr_share'])), | ||
'mmr_burnup':str(int(params['mmr_burnup'])), | ||
'xe100_burnup':str(int(params['xe100_burnup']))} | ||
output_xml = './cyclus-files/' + scenario_name + '.xml' | ||
|
||
output_sqlite = './cyclus-files/' + scenario_name + '.sqlite' | ||
inp.render_input(cyclus_template, variable_dict, output_xml) | ||
|
||
# Create DeployInst for LWRs | ||
DI_dict = cdi.write_lwr_deployinst( | ||
params['lwr'], | ||
"../../inputs/united_states/buildtimes/" + | ||
"UNITED_STATES_OF_AMERICA/deployinst.xml", | ||
"../../../../database/lwr_power_order.txt") | ||
cdi.write_deployinst(DI_dict, './cyclus-files/' + | ||
scenario_name + | ||
'_deployinst.xml') | ||
|
||
# Create DeployInst for advanced reactors | ||
duration = 1500 | ||
mmr_lifetimes = {41:120, 62:180, 74:218, 78:231, 82:240, 86:255, 90:267} | ||
reactor_prototypes = {'Xe-100': (76, 720), | ||
'MMR': (5, mmr_lifetimes[int(params['mmr_burnup'])]), | ||
'VOYGR': (73, 720)} | ||
demand_equation = np.zeros(duration) | ||
demand_equation[721:] = 87198.156 | ||
lwr_DI = cdi.convert_xml_to_dict("./cyclus-files/" + | ||
scenario_name + | ||
'_deployinst.xml') | ||
deploy_schedule = cdi.write_AR_deployinst( | ||
lwr_DI, | ||
"../../inputs/united_states/reactors/", | ||
duration, | ||
reactor_prototypes, | ||
demand_equation, | ||
{'MMR':int(params['mmr_share']), | ||
'Xe-100':int(params['xe100_share']), | ||
'VOYGR':int(params['voygr_share'])}) | ||
cdi.write_deployinst(deploy_schedule, "./cyclus-files/AR_DeployInst_" + | ||
scenario_name + | ||
".xml") | ||
|
||
# Run Cyclus with edited input file | ||
oup.run_cyclus(output_sqlite, output_xml) | ||
|
||
# ---------------------------- | ||
# Return the results to Dakota | ||
# ---------------------------- | ||
results['haleu_swu'].function = oup.calculate_swu(output_sqlite, | ||
['Xe-100', 'MMR'], | ||
721) | ||
results['waste'].function = oup.get_waste_discharged(output_sqlite, | ||
['Xe-100', 'MMR','VOYGR'], | ||
721, | ||
{'MMR':'spent_MMR_haleu', | ||
'Xe-100':'spent_xe100_haleu', | ||
'VOYGR':'spent_smr_fuel'}) | ||
results.write() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#Optimization of Scenatio 7 for minimizing HALEU and Waste | ||
|
||
environment | ||
tabular_data | ||
tabular_data_file = './moga_min.dat' | ||
write_restart = './moga_min.rst' | ||
|
||
method | ||
moga | ||
max_function_evaluations = 1500 | ||
initialization_type unique_random | ||
population_size = 25 | ||
mutation_type replace_uniform | ||
mutation_rate 0.10 | ||
crossover_type shuffle_random | ||
crossover_rate 0.3 | ||
fitness_type domination_count | ||
replacement_type below_limit = 6 | ||
shrinkage_fraction = 0.9 | ||
|
||
model | ||
single | ||
|
||
variables | ||
active all | ||
discrete_design_range = 4 | ||
lower_bounds 0 0 0 0 | ||
upper_bounds 100 100 100 50 | ||
descriptors 'mmr_share' 'xe100_share' 'voygr_share' 'lwr' | ||
discrete_design_set | ||
integer = 2 | ||
elements_per_variable 7 8 | ||
elements 41 62 74 78 82 86 90 28 56 84 112 140 151 168 185 | ||
descriptors = 'mmr_burnup' 'xe100_burnup' | ||
linear_inequality_constraint_matrix = 1 1 1 0 0 0 | ||
linear_inequality_lower_bounds = 100 | ||
linear_inequality_upper_bounds = inf | ||
|
||
interface | ||
fork | ||
asynchronous | ||
evaluation_concurrency = 48 | ||
analysis_drivers = 'python moga_driver.py' | ||
|
||
responses | ||
objective_functions = 2 | ||
sense = 'min' | ||
descriptors 'haleu_swu' 'waste' | ||
no_gradients | ||
no_hessians |
377 changes: 377 additions & 0 deletions
377
input/haleu/optimization/once-through/moga_tuning/Tuning_results.ipynb
Large diffs are not rendered by default.
Oops, something went wrong.
94 changes: 94 additions & 0 deletions
94
input/haleu/optimization/once-through/moga_tuning/moga_tuning_driver.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
import numpy as np | ||
import dakota.interfacing as di | ||
import sys | ||
|
||
sys.path.append('../../../../../scripts') | ||
import create_AR_DeployInst as cdi | ||
import output_metrics as oup | ||
import dakota_input as inp | ||
# ---------------------------- | ||
# Parse Dakota parameters file | ||
# ---------------------------- | ||
|
||
params, results = di.read_parameters_file() | ||
|
||
# ------------------------------- | ||
# Convert and send to Cyclus | ||
# ------------------------------- | ||
|
||
# Edit Cyclus input file | ||
cyclus_template = 'moga_tuning_input.xml.in' | ||
scenario_name = ('lwr_' + | ||
str(int(params['lwr'])) + | ||
'_mmr_share_' + | ||
str(int(params['mmr_share'])) + | ||
'_xe100_share_' + | ||
str(int(params['xe100_share'])) + | ||
'_voygr_share_' + | ||
str(int(params['voygr_share'])) + | ||
'_mmr_burnup_' + | ||
str(int(params['mmr_burnup'])) + | ||
'_xe100_burnup_' + | ||
str(int(params['xe100_burnup']))) | ||
variable_dict = {'handle': scenario_name, | ||
'lwr':str(int(params['lwr'])), | ||
'mmr_share':str(int(params['mmr_share'])), | ||
'xe100_share':str(int(params['xe100_share'])), | ||
'voygr_share':str(int(params['voygr_share'])), | ||
'mmr_burnup':str(int(params['mmr_burnup'])), | ||
'xe100_burnup':str(int(params['xe100_burnup']))} | ||
output_xml = './cyclus-files/' + scenario_name + '.xml' | ||
|
||
output_sqlite = './cyclus-files/' + scenario_name + '.sqlite' | ||
inp.render_input(cyclus_template, variable_dict, output_xml) | ||
|
||
# Create DeployInst for LWRs | ||
DI_dict = cdi.write_lwr_deployinst( | ||
params['lwr'], | ||
"../../../inputs/united_states/buildtimes/" + | ||
"UNITED_STATES_OF_AMERICA/deployinst.xml", | ||
"../../../../../database/lwr_power_order.txt") | ||
cdi.write_deployinst(DI_dict, './cyclus-files/' + | ||
scenario_name + | ||
'_deployinst.xml') | ||
|
||
# Create DeployInst for advanced reactors | ||
duration = 1500 | ||
mmr_lifetimes = {41:120, 62:180, 74:218, 78:231, 82:240, 86:255, 90:267} | ||
reactor_prototypes = {'Xe-100': (76, 720), | ||
'MMR': (5, mmr_lifetimes[int(params['mmr_burnup'])]), | ||
'VOYGR': (73, 720)} | ||
demand_equation = np.zeros(duration) | ||
demand_equation[721:] = 87198.156 | ||
lwr_DI = cdi.convert_xml_to_dict("./cyclus-files/" + | ||
scenario_name + | ||
'_deployinst.xml') | ||
deploy_schedule = cdi.write_AR_deployinst( | ||
lwr_DI, | ||
"../../../inputs/united_states/reactors/", | ||
duration, | ||
reactor_prototypes, | ||
demand_equation, | ||
{'MMR':int(params['mmr_share']), | ||
'Xe-100':int(params['xe100_share']), | ||
'VOYGR':int(params['voygr_share'])}) | ||
cdi.write_deployinst(deploy_schedule, "./cyclus-files/AR_DeployInst_" + | ||
scenario_name + | ||
".xml") | ||
|
||
# Run Cyclus with edited input file | ||
oup.run_cyclus(output_sqlite, output_xml) | ||
|
||
# ---------------------------- | ||
# Return the results to Dakota | ||
# ---------------------------- | ||
results['haleu_swu'].function = oup.calculate_swu(output_sqlite, | ||
['Xe-100', 'MMR'], | ||
721) | ||
results['waste'].function = oup.get_waste_discharged(output_sqlite, | ||
['Xe-100', 'MMR','VOYGR'], | ||
721, | ||
{'MMR':'spent_MMR_haleu', | ||
'Xe-100':'spent_xe100_haleu', | ||
'VOYGR':'spent_smr_fuel'}) | ||
results.write() |
Oops, something went wrong.