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

ExaModels #58

Merged
merged 6 commits into from
Jan 27, 2024
Merged

ExaModels #58

merged 6 commits into from
Jan 27, 2024

Conversation

ccoffrin
Copy link
Member

Results of initial testing, there appears to be a subtle indexing bug in how the modeling layer solution data is turned into the dicts that are use for the standard solution format. It happens on more than 50% of the pglib cases here are two examples,

pglib_opf_case179_goc.m -> KeyError: key 1 not found
pglib_opf_case200_activ.m -> KeyError: key 16 not found

@sshin23, can you see if you can reproduce and propose a fix with a PR into this branch?

sshin23 and others added 3 commits January 26, 2024 19:26
* Added ExaModels.jl example
* Update project files
* added examodels to testing
* [hotfix] "ma27" option removed
* "typo fix README"

---------

Co-authored-by: Oscar Dowson <odow@users.noreply.github.com>
examodels.jl Outdated
Comment on lines 239 to 249
va_sol = ExaModels.solution(result, va)
va_dict = Dict("va_$(i)" => va_sol[busdict[i]] for (i,b) in enumerate(data.bus))

vm_sol = ExaModels.solution(result, vm)
vm_dict = Dict("vm_$(i)" => vm_sol[busdict[i]] for (i,b) in enumerate(data.bus))

pg_sol = ExaModels.solution(result, pg)
pg_dict = Dict("pg_$(i)" => pg_sol[gendict[i]] for (i,b) in enumerate(data.gen))

qg_sol = ExaModels.solution(result, qg)
qg_dict = Dict("qg_$(i)" => qg_sol[gendict[i]] for (i,b) in enumerate(data.gen))
Copy link
Contributor

Choose a reason for hiding this comment

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

Replacing this part with

    va_sol = ExaModels.solution(result, va)
    va_dict = Dict("va_$(i)" => va_sol[b.i] for (i,b) in enumerate(data.bus))
    
    vm_sol = ExaModels.solution(result, vm)
    vm_dict = Dict("vm_$(i)" => vm_sol[b.i] for (i,b) in enumerate(data.bus))

    pg_sol = ExaModels.solution(result, pg)
    pg_dict = Dict("pg_$(i)" => pg_sol[b.i] for (i,b) in enumerate(data.gen))

    qg_sol = ExaModels.solution(result, qg)
    qg_dict = Dict("qg_$(i)" => qg_sol[b.i] for (i,b) in enumerate(data.gen))

seems to resolve the issue

Copy link
Member Author

Choose a reason for hiding this comment

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

Confirmed it seems to work on my side. I will apply the fix and text again.

Copy link
Member Author

Choose a reason for hiding this comment

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

Looking at the CI log, the validation test is going to fail. So the indexing bug was worked around but the solution is no longer in the correct format.

@ccoffrin
Copy link
Member Author

Detailed results below. Once the solution encoding issue is resolved, I say we are good to merge.

Objective Value Correctness Check

Case Vars Cons JuMP JuMP SymAD ExaModels
case3_lmbd 24 28 5.81264e+03 5.81264e+03 5.81264e+03
case5_pjm 44 53 1.75519e+04 1.75519e+04 1.75519e+04
case14_ieee 118 169 2.17808e+03 2.17808e+03 2.17808e+03
case24_ieee_rts 266 315 6.33522e+04 6.33522e+04 6.33522e+04
case30_ieee 236 348 8.20852e+03 8.20852e+03 8.20852e+03
case30_as 236 348 8.03127e+02 8.03127e+02 8.03127e+02
case39_epri 282 401 1.38416e+05 1.38416e+05 1.38416e+05
case57_ieee 448 675 3.75893e+04 3.75893e+04 3.75893e+04
case60_c 518 737 9.26937e+04 9.26937e+04 9.26937e+04
case73_ieee_rts 824 987 1.89764e+05 1.89764e+05 1.89764e+05
case89_pegase 1042 1649 1.07286e+05 1.07286e+05 1.07286e+05
case118_ieee 1088 1539 9.72136e+04 9.72136e+04 9.72136e+04
case162_ieee_dtc 1484 2313 1.08076e+05 1.08076e+05 1.08076e+05
case179_goc 1468 2200 7.54266e+05 7.54266e+05 7.54266e+05
case197_snem 1608 2397 1.50165e+00 1.50165e+00 1.50165e+00
case200_activ 1456 2116 2.75576e+04 2.75576e+04 2.75576e+04
case240_pserc 2558 3617 3.32967e+06 3.32967e+06 3.32967e+06
case300_ieee 2382 3478 5.65220e+05 5.65220e+05 5.65220e+05
case500_goc 4254 6097 4.54946e+05 4.54946e+05 4.54946e+05
case588_sdet 4110 5979 3.13140e+05 3.13140e+05 3.13140e+05
case793_goc 5432 7978 2.60198e+05 2.60198e+05 2.60198e+05
case1354_pegase 11192 16646 1.25884e+06 1.25884e+06 1.25884e+06
case1803_snem 15246 23172 9.83346e+04 9.83346e+04 9.83346e+04
case1888_rte 14480 21494 1.40253e+06 1.40253e+06 1.40253e+06
case1951_rte 15018 22075 2.08558e+06 2.08558e+06 2.08558e+06
case2000_goc 19008 29432 9.73432e+05 9.73432e+05 9.73432e+05
case2312_goc 17128 25716 4.41330e+05 4.41330e+05 4.41330e+05
case2383wp_k 17004 25039 1.86819e+06 1.86819e+06 1.86819e+06
case2736sp_k 19088 28356 1.30801e+06 1.30801e+06 1.30801e+06
case2737sop_k 18988 28358 7.77728e+05 7.77728e+05 7.77728e+05
case2742_goc 24540 38196 2.75705e+05 2.75705e+05 2.75705e+05
case2746wp_k 19520 28446 1.63171e+06 1.63171e+06 1.63171e+06
case2746wop_k 19582 28642 1.20826e+06 1.20826e+06 1.20826e+06
case2848_rte 21822 32129 1.28661e+06 1.28661e+06 1.28661e+06
case2853_sdet 23028 33154 2.05239e+06 2.05239e+06 2.05239e+06
case2868_rte 22090 32393 2.00961e+06 2.00961e+06 2.00961e+06
case2869_pegase 25086 37813 2.46279e+06 2.46279e+06 2.46279e+06
case3012wp_k 21082 31029 2.60084e+06 2.60084e+06 2.60084e+06
case3022_goc 23238 34990 6.01384e+05 6.01384e+05 6.01384e+05
case3120sp_k 21608 32092 2.14797e+06 2.14797e+06 2.14797e+06
case3375wp_k 24350 35876 7.43817e+06 7.43817e+06 7.43817e+06
case3970_goc 35270 54428 9.60985e+05 9.60985e+05 9.60985e+05
case4020_goc 36696 56957 8.22247e+05 8.22247e+05 8.22247e+05
case4601_goc 38814 59596 8.26242e+05 8.26242e+05 8.26242e+05
case4619_goc 42532 66289 4.76704e+05 4.76704e+05 4.76704e+05
case4661_sdet 34758 51302 2.25134e+06 2.25134e+06 2.25134e+06
case4837_goc 41398 64030 8.72255e+05 8.72255e+05 8.72255e+05
case4917_goc 37872 56917 1.38779e+06 1.38779e+06 1.38779e+06
case5658_epigrids 48552 74821 1.20731e+06 1.20731e+06 1.20731e+06
case6468_rte 49734 75937 2.06973e+06 2.06973e+06 2.06973e+06
case6470_rte 50482 75976 2.23757e+06 2.23757e+06 2.23757e+06
case6495_rte 50426 76124 3.06783e+06 3.06783e+06 3.06783e+06
case6515_rte 50546 76290 2.82550e+06 2.82550e+06 2.82550e+06
case7336_epigrids 62116 95306 1.88239e+06 1.88239e+06 1.88239e+06
case8387_pegase 78748 118702 2.77139e+06 2.77139e+06 2.77139e+06
case9241_pegase 85568 130826 6.24309e+06 6.24309e+06 6.24309e+06
case9591_goc 83572 130588 1.06168e+06 1.06168e+06 1.06168e+06
case10000_goc 76804 112352 1.35403e+06 1.35403e+06 1.35403e+06
case10192_epigrids 89850 139456 1.68692e+06 1.68692e+06 1.68692e+06
case10480_goc 96750 150874 2.31465e+06 2.31465e+06 2.31465e+06
case13659_pegase 117370 170588 8.94805e+06 8.94805e+06 8.94805e+06
case19402_goc 179562 281733 1.97782e+06 1.97782e+06 1.97782e+06
case20758_epigrids 179236 274918 2.61864e+06 2.61864e+06 2.61864e+06
case24464_goc 203374 313641 2.62953e+06 2.62953e+06 2.62953e+06
case30000_goc 208624 307752 1.14233e+06 1.14233e+06 1.14233e+06
case78484_epigrids 674562 1039062 1.53159e+07 1.53159e+07 1.53159e+07

Runtime Check

Case Vars Cons JuMP JuMP SymAD ExaModels
case3_lmbd 24 28 1.38e-02 8.84e-02 1.31e-02
case5_pjm 44 53 1.95e-02 8.47e-02 5.48e-02
case14_ieee 118 169 3.20e-01 5.52e-01 4.03e-02
case24_ieee_rts 266 315 3.60e-01 3.91e-01 6.84e-02
case30_ieee 236 348 3.73e-01 5.51e-01 4.80e-02
case30_as 236 348 3.31e-01 5.17e-01 6.01e-02
case39_epri 282 401 1.05e-01 3.24e-01 3.98e-02
case57_ieee 448 675 3.93e-01 6.18e-01 5.99e-02
case60_c 518 737 5.02e-01 6.15e-01 5.22e-02
case73_ieee_rts 824 987 5.08e-01 6.68e-01 1.17e-01
case89_pegase 1042 1649 6.60e-01 7.34e-01 1.39e-01
case118_ieee 1088 1539 6.39e-01 7.68e-01 1.25e-01
case162_ieee_dtc 1484 2313 6.43e-01 7.97e-01 1.67e-01
case179_goc 1468 2200 7.35e-01 9.61e-01 2.07e-01
case197_snem 1608 2397 7.04e-01 6.83e-01 1.42e-01
case200_activ 1456 2116 6.46e-01 5.64e-01 1.19e-01
case240_pserc 2558 3617 2.78e+00 1.61e+00 9.42e-01
case300_ieee 2382 3478 1.01e+00 1.01e+00 2.37e-01
case500_goc 4254 6097 1.53e+00 1.19e+00 4.50e-01
case588_sdet 4110 5979 1.37e+00 1.28e+00 3.69e-01
case793_goc 5432 7978 1.82e+00 1.55e+00 5.29e-01
case1354_pegase 11192 16646 5.14e+00 3.00e+00 1.24e+00
case1803_snem 15246 23172 8.36e+00 4.49e+00 2.59e+00
case1888_rte 14480 21494 2.06e+01 8.14e+00 5.08e+00
case1951_rte 15018 22075 9.85e+00 5.04e+00 2.88e+00
case2000_goc 19008 29432 7.87e+00 4.53e+00 2.36e+00
case2312_goc 17128 25716 7.26e+00 4.24e+00 2.24e+00
case2383wp_k 17004 25039 7.56e+00 4.16e+00 2.58e+00
case2736sp_k 19088 28356 7.14e+00 4.26e+00 2.24e+00
case2737sop_k 18988 28358 6.55e+00 4.41e+00 2.11e+00
case2742_goc 24540 38196 2.74e+01 1.30e+01 7.98e+00
case2746wp_k 19520 28446 6.67e+00 4.09e+00 2.23e+00
case2746wop_k 19582 28642 6.73e+00 4.11e+00 2.13e+00
case2848_rte 21822 32129 1.49e+01 7.07e+00 4.25e+00
case2853_sdet 23028 33154 1.03e+01 6.09e+00 3.19e+00
case2868_rte 22090 32393 1.64e+01 7.71e+00 4.44e+00
case2869_pegase 25086 37813 1.25e+01 6.98e+00 3.95e+00
case3012wp_k 21082 31029 1.04e+01 5.81e+00 3.19e+00
case3022_goc 23238 34990 1.14e+01 6.56e+00 3.34e+00
case3120sp_k 21608 32092 9.91e+00 5.70e+00 3.13e+00
case3375wp_k 24350 35876 1.21e+01 7.16e+00 3.79e+00
case3970_goc 35270 54428 1.66e+01 1.03e+01 7.04e+00
case4020_goc 36696 56957 2.20e+01 1.37e+01 1.04e+01
case4601_goc 38814 59596 2.45e+01 1.40e+01 8.21e+00
case4619_goc 42532 66289 2.15e+01 1.35e+01 8.42e+00
case4661_sdet 34758 51302 1.73e+01 1.08e+01 6.17e+00
case4837_goc 41398 64030 2.20e+01 1.28e+01 7.42e+00
case4917_goc 37872 56917 2.02e+01 1.11e+01 6.25e+00
case5658_epigrids 48552 74821 2.44e+01 1.39e+01 8.01e+00
case6468_rte 49734 75937 6.30e+01 2.92e+01 1.72e+01
case6470_rte 50482 75976 3.75e+01 1.93e+01 1.15e+01
case6495_rte 50426 76124 6.47e+01 3.18e+01 2.22e+01
case6515_rte 50546 76290 5.28e+01 2.66e+01 1.58e+01
case7336_epigrids 62116 95306 3.00e+01 1.83e+01 1.05e+01
case8387_pegase 78748 118702 4.93e+01 2.83e+01 1.68e+01
case9241_pegase 85568 130826 5.36e+01 3.03e+01 1.81e+01
case9591_goc 83572 130588 6.05e+01 3.90e+01 2.82e+01
case10000_goc 76804 112352 4.94e+01 2.72e+01 1.79e+01
case10192_epigrids 89850 139456 6.06e+01 3.35e+01 2.21e+01
case10480_goc 96750 150874 6.89e+01 4.36e+01 2.95e+01
case13659_pegase 117370 170588 6.63e+01 3.64e+01 2.38e+01
case19402_goc 179562 281733 1.48e+02 9.56e+01 7.76e+01
case20758_epigrids 179236 274918 9.99e+01 6.25e+01 3.96e+01
case24464_goc 203374 313641 1.27e+02 7.75e+01 5.23e+01
case30000_goc 208624 307752 2.43e+02 1.38e+02 1.09e+02
case78484_epigrids 674562 1039062 9.07e+02 5.52e+02 3.86e+02

@sshin23
Copy link
Contributor

sshin23 commented Jan 27, 2024

Thanks for the quick testing, @ccoffrin!

A suggested fix is in #59

@ccoffrin
Copy link
Member Author

Thanks for the quick testing

Sure thing. When the modeling layer is this fast the tests also go really fast. 😄

@ccoffrin ccoffrin marked this pull request as ready for review January 27, 2024 05:08
@ccoffrin ccoffrin merged commit c14e22b into main Jan 27, 2024
5 checks passed
@ccoffrin
Copy link
Member Author

Thank you very much for the contribution!

@ccoffrin ccoffrin deleted the examodels branch January 27, 2024 05:53
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.

None yet

2 participants