Skip to content

Instantly share code, notes, and snippets.

@brandomr
Created September 6, 2024 20:25
Show Gist options
  • Save brandomr/cd5aecfbe3376c7f9e76e1fc3aca079f to your computer and use it in GitHub Desktop.
Save brandomr/cd5aecfbe3376c7f9e76e1fc3aca079f to your computer and use it in GitHub Desktop.
example variable optimization
>>> can you run an optimization to come up with a geothermal power project that will maximize net cash flow at 20 years. Pick only a few key input parameters to optimize
thought: I need to run an optimization to maximize net cash flow for a geothermal power
project over a 20-year period. I will select key input parameters for this optimization.
tool: optimize_power
tool_input: {'input_names': ['no_of_prod_wells', 'flowrate', 'wellhead_temperature',
'geothermal_gradient'], 'input_lower_bounds': [1, 25, 100, 50], 'input_upper_bounds':
[10, 100, 200, 100], 'params_to_minimize': [], 'params_to_maximize': ['cumsum(Cash
Flow)[20]'], 'params_to_target': [], 'target_values': [], 'budget': 100}
observation: {'optimized inputs': {'no_of_prod_wells': 8, 'flowrate': 97.83986294796993,
'wellhead_temperature': 194.19139924744968, 'geothermal_gradient': 53.25363622054617},
'output results': {'cumsum(Cash Flow)[20]': 227.1885043308868}}
thought: I have completed the optimization and found the optimal parameters for the
geothermal power project. The results indicate the number of production wells, flow
rate, wellhead temperature, and geothermal gradient that maximize net cash flow over 20
years.
tool: final_answer
tool_input: The optimal parameters for maximizing net cash flow in a geothermal power
project over 20 years are as follows:
- Number of Production Wells: 8
- Flow Rate: 97.84 kg/s
- Wellhead Temperature: 194.19 °C
- Geothermal Gradient: 53.25 °C/km
The total net cash flow at 20 years is approximately $227.19 million.
The optimal parameters for maximizing net cash flow in a geothermal power project over 20 years are as follows:
- Number of Production Wells: 8
- Flow Rate: 97.84 kg/s
- Wellhead Temperature: 194.19 °C
- Geothermal Gradient: 53.25 °C/km
The total net cash flow at 20 years is approximately $227.19 million.
>>> can you run an optimization that maximizes yearly cash flow at all years
thought: I need to run an optimization to maximize yearly cash flow for a geothermal
power project across all years. I will use the same key input parameters as before.
tool: optimize_power
tool_input: {'input_names': ['no_of_prod_wells', 'flowrate', 'wellhead_temperature',
'geothermal_gradient'], 'input_lower_bounds': [1, 25, 100, 50], 'input_upper_bounds':
[10, 100, 200, 100], 'params_to_minimize': [], 'params_to_maximize': ['Cash Flow'],
'params_to_target': [], 'target_values': [], 'budget': 100}
observation: {'optimized inputs': {'no_of_prod_wells': 9, 'flowrate': 82.4778340789882,
'wellhead_temperature': 189.93513519327874, 'geothermal_gradient': 67.27633887181956},
'output results': {'Cash Flow': [-11.449765136501666, -109.92092717214945,
-109.92092717214945, 28.648014454736927, 28.166065761231135, 27.66585674802796,
27.160856755105574, 26.654861846054306, 26.149467103963183, 25.64549536318599,
25.143430204197166, 24.643583436155616, 24.146170850818137, 23.651350484217158,
23.159243604190845, 22.669946986547444, 22.18354047531221, 21.700091839593732,
21.21966000573798, 20.742297273340967, 20.26805087394397, 19.796964091756383,
19.32907708507424, 18.864427498453832, 18.40305092568671, 17.944981264441065,
17.490250990961826, 17.038891374983194]}}
thought: I have completed the optimization to maximize yearly cash flow for the
geothermal power project. The results show the optimal parameters and the cash flow for
each year.
tool: final_answer
tool_input: The optimal parameters for maximizing yearly cash flow in a geothermal power
project are as follows:
- Number of Production Wells: 9
- Flow Rate: 82.48 kg/s
- Wellhead Temperature: 189.94 °C
- Geothermal Gradient: 67.28 °C/km
The yearly cash flow results are as follows:
- Year 1: -$11.45 million
- Year 2: -$109.92 million
- Year 3: -$109.92 million
- Year 4: $28.65 million
- Year 5: $28.17 million
- Year 6: $27.67 million
- Year 7: $27.16 million
- Year 8: $26.65 million
- Year 9: $26.15 million
- Year 10: $25.65 million
- Year 11: $25.14 million
- Year 12: $24.64 million
- Year 13: $24.15 million
- Year 14: $23.65 million
- Year 15: $23.16 million
- Year 16: $22.67 million
- Year 17: $22.18 million
- Year 18: $21.70 million
- Year 19: $21.22 million
- Year 20: $20.27 million.
The optimal parameters for maximizing yearly cash flow in a geothermal power project are as follows:
- Number of Production Wells: 9
- Flow Rate: 82.48 kg/s
- Wellhead Temperature: 189.94 °C
- Geothermal Gradient: 67.28 °C/km
The yearly cash flow results are as follows:
- Year 1: -$11.45 million
- Year 2: -$109.92 million
- Year 3: -$109.92 million
- Year 4: $28.65 million
- Year 5: $28.17 million
- Year 6: $27.67 million
- Year 7: $27.16 million
- Year 8: $26.65 million
- Year 9: $26.15 million
- Year 10: $25.65 million
- Year 11: $25.14 million
- Year 12: $24.64 million
- Year 13: $24.15 million
- Year 14: $23.65 million
- Year 15: $23.16 million
- Year 16: $22.67 million
- Year 17: $22.18 million
- Year 18: $21.70 million
- Year 19: $21.22 million
- Year 20: $20.27 million.
>>>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment