Speeding up solving times with highs

200 views
Skip to first unread message

Matthew Smith

unread,
Mar 11, 2025, 11:00:24 AM3/11/25
to pypsa
Dear PyPSA community,

Does anyone have any tips for speeding up solving times using Highs, or any other open source solver? I have quite powerful hardware at my disposal but this doesn't help speed up LT runs. 

I'm wondering if there are any options to find almost-but-not-quite optimal solutions, either through heuristics or iterative solving processes?

Thanks,
Matt

Matthew Smith

unread,
Mar 11, 2025, 2:18:55 PM3/11/25
to pypsa
E.g. has anyone had any luck changing the Highs solver options from default?

Johannes

unread,
Mar 11, 2025, 4:17:29 PM3/11/25
to pypsa
Hi Matt,

You could try the solver config provided with PyPSA-Eur:


Not sure how up to date it is, given that Highs is being actively improved :)

Best,
Johannes

Matthew Smith

unread,
Mar 11, 2025, 11:51:28 PM3/11/25
to pypsa
Hi Johannes,

Thank you, this is a great lead. SInce I use PyPSA, I need to figure out a good way to bulk-set how to set these options. I'll report back when done.

Best regards,
Matt

Matthew Smith

unread,
Mar 12, 2025, 3:34:04 AM3/12/25
to pypsa
How to set the solver options from a txt file. Note that, unfortunately, these options haven't seemed to improve performance above the defaults. 

Save the options as a txt file in the format:

threads: 1
solver: "ipm"
run_crossover: "off"
small_matrix_value: 1e-6
large_matrix_value: 1e9
primal_feasibility_tolerance: 1e-5
dual_feasibility_tolerance: 1e-5
ipm_optimality_tolerance: 1e-4
parallel: "on"
random_seed: 123
log_to_console: False

Load it in as a dict:

with open('highs_options.txt', 'r') as file:
    highs_options_dict = dict(line.strip().split(':', 1) for line in file)

Refer to the dict:

network.optimize.solve_model(solver_name="highs", solver_options=highs_options_dict)
Reply all
Reply to author
Forward
0 new messages