r-opt / rmpk

Mixed Integer Linear and Quadratic Programming in R
https://r-opt.github.io/rmpk/
Other
44 stars 4 forks source link

Adding Lazy Constraints #51

Closed zamorarr closed 2 years ago

zamorarr commented 3 years ago

Hi @dirkschumacher!

Big fan of your ompr package. Thanks for all your work on optimization in R. Is rmpk still under development? I'm trying to add a lazy constraint to GLPK but can't seem to get it to work. I tried solver$set_irowgen_callback() as specified in the TSP vignette: https://github.com/r-opt/rmpk/blob/8c80a7c9ba06670086c8c618bc1da6ef7a32d22a/vignettes/tsp-subtour.Rmd#L118

but am getting the error:

Error in solver$set_irowgen_callback : 
  $ operator not defined for this S4 class

I'm pretty sure this is because I do not have rmpk.glpk installed, but was unsure if that was still the recommended way since that package is archived on Github (I'll probably try it anyway).

This package seems to be the only way I can find for using solver callbacks in R so I'm hoping to figure this out. Thanks for any help you could provide.

dirkschumacher commented 3 years ago

Thanks!

Yeah it is all work in progress, but due to reasons I had to limit my time on certain open source initiatives. You could try to restore the package versions with the correct git commit ids. I did some refactoring along the way which rendered the rmpk.glpk version incompatible.

I am planning to get back to this but as always I cannot make any promises because of time constraints.

dirkschumacher commented 2 years ago

Please checkout the GLPKoptimizer. I think this goes in the right direction: https://github.com/r-opt/GLPKoptimizer