Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing the ACOPF rectangular formulation and updating datasets #153

Merged
merged 23 commits into from
Oct 24, 2024

Conversation

hhijazi
Copy link
Member

@hhijazi hhijazi commented Jul 5, 2024

Description

This PR fixes #123 and corrects the rectangular ACOPF formulation as follows:

  • Formulate the problem without auxiliary variables to avoid feasibility violations.
  • Make sure to add voltage magnitude and phase angle bound constraints in the original space (e,f).
  • Make sure to remove buses that are disconnected (status==4).
  • Make sure to use the correct initial point (setting evar to 1).
  • Compute the voltage angles and magnitudes correctly when using the rectangular formulation.

Warning

The pstart initialization does not work with Gurobi 11, only with Gurobi 12. Therefore the performance on ACOPF will be bad until Gurobi 12. For instance, Gurobi 11.0.2 cannot find a feasible solution on network IEEE69.mat (from #123) after 600 seconds.

Copy link
Member

@simonbowly simonbowly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added some comments. Happy to help with the changes, just let me know. The main issue is that the tests do not pass. Have you run them locally?

src/gurobi_optimods/opf/io.py Outdated Show resolved Hide resolved
src/gurobi_optimods/opf/grbformulator_ac.py Outdated Show resolved Hide resolved
src/gurobi_optimods/opf/grbformulator_ac.py Outdated Show resolved Hide resolved
src/gurobi_optimods/opf/grbformulator.py Outdated Show resolved Hide resolved
src/gurobi_optimods/opf/converters.py Show resolved Hide resolved
src/gurobi_optimods/opf/converters.py Show resolved Hide resolved
src/gurobi_optimods/opf/api.py Show resolved Hide resolved
@hhijazi
Copy link
Member Author

hhijazi commented Oct 9, 2024

@simonbowly I finished cleaning up the tests and I added the AC-LOCAL option.
Using the python file from #123 and replacing the command below:

result = opf.solve_opf(case, opftype="AC-LOCAL")

we get:

Objective value = 82.31523524020653.
Solution quality statistics for model 'AC_Formulation_Model' :
  Maximum violation:
    Bound       : 5.50004486e-13 (s_1_1_2)
    Constraint  : 2.27396420e-09 (Qdef_1_1_2)
    Integrality : 0.00000000e+00
sum(abs(sinfeas)) = 4.98547332045843e-09.

Not sure why the doc-tests are failing though.

Copy link
Member

@simonbowly simonbowly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hhijazi I added a lot of comments.

My main concern is that so many of the tests are deleted or overwritten. It makes it impossible to tell whether any of the old cases would still work. The new version should be able to work with data that the old version handled.

src/gurobi_optimods/opf/violations.py Outdated Show resolved Hide resolved
src/gurobi_optimods/opf/api.py Outdated Show resolved Hide resolved
src/gurobi_optimods/opf/grbformulator_ac.py Outdated Show resolved Hide resolved
src/gurobi_optimods/opf/grbformulator_ac.py Show resolved Hide resolved
tests/opf/test_io.py Outdated Show resolved Hide resolved
tests/opf/test_io.py Show resolved Hide resolved
tests/opf/test_solver.py Show resolved Hide resolved
tests/opf/test_solver.py Show resolved Hide resolved
tests/opf/test_solver.py Outdated Show resolved Hide resolved
tests/opf/test_solver.py Show resolved Hide resolved
@simonbowly
Copy link
Member

@hhijazi when going through these comments (and the old ones) can you please mark them as resolved (if they are resolved).

Also, I don't think the description or title of this PR is accurate any more. This isn't just a fix. Can you update these to better describe the new functionality?

@hhijazi hhijazi changed the title #123: fixing the rectangular formulation Fixing the ACOPF rectangular formulation and updating datasets Oct 15, 2024
@simonbowly
Copy link
Member

@hhijazi this looks good, thanks. I added some tests for the "aclocal" mode. It's expected that these do not find solutions with Gurobi 10 or 11, right?

What should we do there? Error out if a user chooses aclocal with gurobi<12? Or take our chances but print a better warning message if/when it fails?

@simonbowly
Copy link
Member

What should we do there? Error out if a user chooses aclocal with gurobi<12? Or take our chances but print a better warning message if/when it fails?

I'll merge this and figure it out afterwards.

@simonbowly simonbowly self-requested a review October 24, 2024 10:51
@simonbowly simonbowly merged commit 4b6eaa1 into Gurobi:main Oct 24, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OPF problem
2 participants