R, how to do optimization with / or restrictions?

I am trying to do limited optimization using R. My restriction is not continuous. Here is an example:

minimize: f(x,y)=(x-2)^2+y^2
st. x=0 or x>=3
y=0 or y>=2

What is the optimization problem?

+4
source share
1 answer

They are called semi-continuous variables. Some solvers support them directly, but they can also be formulated using additional binary variables:

 3*d <= x <= 1000*d
 d binary

In any case, you get the MIQP model (mixed integer quadratic programming). Solutions like Gurobi and Cplex support this and have R interfaces.

+2
source

Source: https://habr.com/ru/post/1688962/


All Articles