dirkschumacher / ompr

R package to model Mixed Integer Linear Programs
https://dirkschumacher.github.io/ompr/
Other
269 stars 35 forks source link

Implement Quadratic Constraints/Objectives #400

Open dirkschumacher opened 2 years ago

dirkschumacher commented 2 years ago

With the new MIPModel this is now possible. It requires some changes in ompr.roi and additional classes and operators.

mallerhand commented 2 years ago

This is good news, especially now we have the NEOS plugin so can workaround problems installing Rcplex. Are these changes in the development version, and do you plan to put it on CRAN soon?

Function "set_objective" (ompr v1.0.2) seems to have difficulty parsing a non-linear expression: model = MIPModel() model = add_variable(model, x, type="continuous") model = set_objective(model, x*x, sense="min") # Quadratic expressions are not supported (ok) model = set_objective(model, x^2, sense="min") # non-numeric argument to binary operator (!)

Keep up the good work Dirk :)