Skip to content

Use an interface instead of accessing internal fields - #29

Open
blegat wants to merge 4 commits into
mainfrom
nlpmodel
Open

Use an interface instead of accessing internal fields#29
blegat wants to merge 4 commits into
mainfrom
nlpmodel

Conversation

@blegat

@blegat blegat commented May 26, 2025

Copy link
Copy Markdown
Collaborator

The idea is to split separate the details about the problem representation with the optimization algorithm. It should make it easier to add support for low-rank matrices after this refactoring.

Current benchmark on SDPLIB

Benchmark added in #30

problem n m main (s) nlpmodel (s) speedup it main it nlpmodel obj main obj nlpmodel
gpp250-1 250 250 1.546 1.411 1.10× 22 18 80800.6 -15.4449
hinf1 14 13 0.002 0.002 1.11× 24 23 2.03266 2.03265
mcp124-3 124 124 0.066 0.059 1.12× 11 11 467.75 467.75
mcp124-4 124 124 0.067 0.058 1.15× 11 11 864.412 864.412
theta1 50 104 0.019 0.017 1.16× 11 11 23 23
qap8 65 529 0.506 0.432 1.17× 20 15 1.54015e+10 2052.57
qap7 50 358 0.209 0.172 1.22× 18 17 5.16172e+10 1076.81
mcp500-2 500 500 4.038 3.313 1.22× 13 13 1070.06 1070.06
truss1 13 6 0.001 0.001 1.28× 11 11 -9 -9
hinf3 16 13 0.003 0.002 1.29× 28 29 56.948 56.9485
hinf4 16 13 0.003 0.002 1.29× 30 29 274.764 274.765
theta3 150 1106 3.754 2.898 1.30× 13 13 42.167 42.167
infd2 30 10 0.013 0.009 1.34× 24 24 -1.26218e+57 -1.26212e+57
truss5 331 208 0.180 0.131 1.37× 16 16 -132.636 -132.636
equalG11 801 801 21.860 15.619 1.40× 13 13 629.155 629.155
hinf15 37 91 0.027 0.019 1.41× 27 27 20.2773 24.442
hinf10 18 21 0.004 0.003 1.46× 33 30 108.817 108.866
truss4 19 12 0.001 0.001 1.54× 11 11 -9.01 -9.01
hinf12 24 43 0.027 0.018 1.55× 101 101 1.15236e-08 9.9035e-09
control2 30 66 0.018 0.012 1.56× 25 25 8.3 8.3
hinf14 34 73 0.016 0.010 1.57× 22 21 13.0007 12.9974
hinf8 16 13 0.003 0.002 1.59× 28 23 116.359 116.213
mcp250-2 250 250 0.815 0.471 1.73× 11 11 531.93 531.93
mcp500-3 500 500 5.426 3.072 1.77× 12 12 1847.97 1847.97
control3 45 136 0.081 0.046 1.77× 26 25 13.6333 13.6333
maxG11 800 800 24.032 13.527 1.78× 13 13 629.165 629.165
gpp500-4 500 501 6.593 3.686 1.79× 12 13 -1567.02 -1567.02
truss8 628 496 3.361 1.823 1.84× 17 17 -133.115 -133.115
mcp500-4 500 500 5.743 3.111 1.85× 12 12 3566.74 3566.74
theta4 200 1949 24.027 12.864 1.87× 14 14 50.3212 50.3212
gpp500-1 500 501 14.222 7.569 1.88× 25 26 9.73956e+06 -25.3205
control9 135 1081 14.264 7.492 1.90× 34 34 14.6754 14.6754
mcp250-1 250 250 0.968 0.502 1.93× 12 12 317.264 317.264
qap9 82 748 2.295 1.089 2.11× 16 17 5.2357e+10 -348.686
mcp500-1 500 500 7.657 3.493 2.19× 14 14 598.149 598.149
arch2 335 174 1.902 0.858 2.22× 20 20 0.671516 0.671516
qap10 101 1021 4.408 1.948 2.26× 18 16 2860.67 7118.68
arch8 335 174 1.908 0.840 2.27× 20 20 7.05698 7.05698
ss30 426 132 8.680 3.541 2.45× 20 20 20.2395 20.2395
theta2 100 498 0.917 0.366 2.51× 12 12 32.8792 32.8792
mcp250-4 250 250 1.180 0.458 2.57× 11 11 1681.96 1681.96
hinf13 30 57 0.020 0.008 2.59× 24 24 44.8958 45.1178
mcp100 100 100 0.093 0.035 2.64× 11 11 226.157 226.157
mcp250-3 250 250 1.204 0.453 2.66× 11 11 981.173 981.173
control1 15 21 0.006 0.002 2.67× 24 24 17.7846 17.7846
arch4 335 174 2.267 0.849 2.67× 20 20 0.972628 0.972628
arch0 335 174 2.494 0.933 2.67× 22 22 0.566517 0.566517
hinf5 16 13 0.006 0.002 2.74× 25 29 362.92 362.913
hinf11 22 31 0.012 0.004 2.74× 33 34 65.9106 65.9138
control6 90 496 3.443 1.170 2.94× 40 39 37.3045 37.3044
hinf6 16 13 0.007 0.002 2.97× 32 31 449.011 448.941
gpp250-3 250 250 2.051 0.680 3.02× 20 15 -303.539 -303.539
gpp500-2 500 501 12.746 4.097 3.11× 22 15 122387 -156.06
qap6 37 229 0.196 0.062 3.17× 23 17 113.203 3047.57
truss2 133 58 0.039 0.012 3.17× 15 15 -123.38 -123.38
control8 120 861 14.320 4.455 3.21× 35 35 20.2864 20.2864
infp1 30 10 0.030 0.009 3.29× 28 23 4.81296 5.18035
hinf9 16 13 0.007 0.002 3.31× 33 27 236.249 236.249
infd1 30 10 0.041 0.012 3.33× 31 31 -1.42829e+58 -1.42825e+58
gpp124-1 124 125 0.620 0.184 3.36× 43 30 -7.34307 66.5973
control7 105 666 9.277 2.749 3.37× 39 39 20.6251 20.6251
control5 75 351 1.569 0.464 3.38× 36 33 16.8836 16.8836
gpp500-3 500 501 13.250 3.840 3.45× 23 14 3.41937e+08 -513.018
infp2 30 10 0.033 0.009 3.64× 28 23 7.33315 4.54581
qap5 26 136 0.041 0.011 3.68× 15 10 2.883e+12 -436
hinf7 16 13 0.007 0.002 3.73× 34 24 392.315 390.816
hinf2 16 13 0.007 0.002 3.78× 34 24 10.9699 10.9671
gpp250-2 250 250 2.336 0.563 4.15× 23 12 1188.17 -81.869
control4 60 231 0.642 0.149 4.30× 35 27 19.7942 19.7942
truss7 301 86 0.243 0.052 4.69× 27 25 -900.001 -900.001
gpp124-2 124 125 0.585 0.122 4.80× 28 20 902.828 -46.8623
gpp124-4 124 125 0.502 0.086 5.84× 36 14 -261.092 -418.988
truss3 31 27 0.011 0.002 5.93× 11 11 -9.10999 -9.10999
mcp124-2 124 124 0.378 0.063 6.02× 12 12 269.88 269.88
mcp124-1 124 124 0.458 0.068 6.74× 12 12 141.99 141.99
gpp124-3 124 125 0.502 0.073 6.88× 35 12 5.03715e+06 -153.014
truss6 451 172 0.824 0.080 10.31× 24 23 -901.001 -901.001
gpp100 100 101 0.587 0.043 13.59× 64 12 9.86352e+08 -44.9435
control10 150 1326 15.809 38 38.5331
control11 165 1596 31.997 42 31.9587
gpp250-4 250 250 0.612 14 -747.328
thetaG11 801 2401
maxG51 1000 1000 32.057 14 4006.26

82 problems solved by both — total time: 469.847s (main) vs 420.566s (nlpmodel); overall 1.12×, geometric-mean per-problem 1.24×.

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.

1 participant