Using Highs in cluster network optimizaion
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 148
- Forks
- 55
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 18
Description
Checklist
- I am using the current
masterbranch - I am running on an up-to-date
pypsa-usaenvironment. Update viaconda env update -f envs/environment.yaml
The Issue
When using highs in the cluster/simplify network scripts, an error is thrown by pyomo. If only highs is passed to the SolverFactory, the following error is thrown:
opt = po.SolverFactory("highs")
opt.solve(m)
Solver (asl) did not exit normally
File "/home/trevor/master/pypsa-usa/workflow/scripts/cluster_network.py", line 247, in distribute_clusters
results = opt.solve(m)
^^^^^^^^^^^^
File "/home/trevor/master/pypsa-usa/workflow/scripts/cluster_network.py", line 317, in busmap_for_n_clusters
n_clusters = distribute_clusters(
^^^^^^^^^^^^^^^^^^^^
File "/home/trevor/master/pypsa-usa/workflow/scripts/cluster_network.py", line 379, in clustering_for_n_clusters
busmap = busmap_for_n_clusters(
^^^^^^^^^^^^^^^^^^^^^^
File "/home/trevor/master/pypsa-usa/workflow/scripts/simplify_network.py", line 278, in <module>
clustering = clustering_for_n_clusters(
^^^^^^^^^^^^^^^^^^^^^^^^^^
pyomo.common.errors.ApplicationError: Solver (asl) did not exit normally
If you pass the solver appsi_highs, as described by pyomo with the command pyomo help --solvers, the following error is raised:
opt = po.SolverFactory("appsi_highs")
if not opt.has_capability("quadratic_objective"):
...
Traceback (most recent call last):
File "<string>", line 1, in <module>
AttributeError: 'LegacySolver' object has no attribute 'has_capability'
Steps To Reproduce
- Change solver configuration to the following:
solver:
name: highs
options: highs-default
- Run the workflow
Expected Behavior
The clustering optimization should run via ipopt if highs is selected for the quadratic optimization
Error Message
No response
Anything else?
The pypsa-eur team updated their clustering to use linopy; would be nice to follow their implementation and allow us to drop the pyomo dependency
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the failure with the solver configuration in workflow/scripts/cluster_network.py and the workflow entry point in workflow/scripts/simplify_network.py. Read the clustering code around the reported lines and compare the linked pypsa-eur implementation. Done means clustering runs with highs selected for quadratic optimization, using ipopt as expected, or the proposed linopy migration is clearly scoped.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100