-
Notifications
You must be signed in to change notification settings - Fork 32
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
Adapt OPF case parser for pglib files #133
Conversation
Those files have only the 10 first columns for the gen array. The others are actually not used in the formulations.
@pobonomo Looks good. |
Can you add a test case for this format, in the IO tests? gurobi-optimods/tests/opf/test_io.py Lines 116 to 148 in 3a28b20
|
That's actually not something so simple. The pglib is a benchmarking library for ACOPF. There is a report here: https://arxiv.org/abs/1908.02788 they follow the same matpower format that is implemented in the optimod but they omit some columns that apparently are not useful for the formulation of ACOPF. So to me it's not a new format. I don't think it's worth doing a new parser. What I did is just replacing the missing data with Nan. Now using the current test is an issue because `float(nan) != float(nan)'. I could just replace the line that test that the data is different with a numpy assert that can handle nan I think: @@ -135,7 +136,7 @@ class TestIO(unittest.TestCase):
# The first read and the round-trip should match exactly
self.assertEqual(set(reread.keys()), set(original.keys()))
for field, data in reread.items():
- self.assertEqual(data, original[field])
+ np.testing.assert_equal(data, original[field])
# Check types for some special cases
for bus in reread["bus"]: but to me it's making the test complicated and in the end less reliable. On the other hand I think it is worth that the optimod code doesn't throw an error from a standard publicly available library. |
This is really all I'm suggesting. If the optimod should handle these files, we should at least have a test that reads one, even if it doesn't assert anything about the result. That way, your new additions are actually covered by the tests and we're less likely to break this by some future change. |
You seem to have omitted the beginning of my message. The part of the file that we would use is already tested by the current test. In any case I added a test specific for a file in the 'pglib' format. |
Ok, sorry if I misunderstood something. Thanks for adding the test. |
Those files have only the 10 first columns for the gen array. The others are actually not used in the formulations.
Description
This is to be able to read models from the power grid lib: https://github.com/power-grid-lib/pglib-opf
Checklist
This is not a new mod!
gurobi_optimods
installable packagetests/
gurobi_optimods.datasets
for loading data)Have a nice day!