Open datadrivensupplychain opened 2 years ago
Is this because of how MILPModel handles multidimensional decision variables? I could probably form my decision variables x to be along a single vector if necessary.
Right. MILPModel was formulated with significant performance improvement over the original MIPModel. But using arrays in MILPModel constraints requires the use of the colwise
auxiliary function which users found not intuitive. Dirk has since updated MIPModel incorporating the performance improvements of MILPModel while maintaining the formulation elements of the original MIPModel.
So it is my impression now that the updated MIPModel supercedes MILPModel. So your MIPModel version is what you should use.
OK, I'm actually (sorta) used to using colwise
now, so if that's they key then I'll use that. Good to hear that MIPModel now has the performance benefits of MILPModel. I've been using MILPModel exclusively for a couple years now because of the speed of the model build, and just had to accept that the syntax was an acquired taste.
BTW, you may want to install the development versions of ompr, ompr.roi to ensure that the latest functionality is being accessed by your MIPModel formulation:
remotes::install_github("dirkschumacher/ompr")
remotes::install_github("dirkschumacher/ompr.roi")
Thanks, I'll try that. Right now I'm using the latest CRAN versions of both ompr and ompr.roi. I'm also using some random version of ROI.plugin.gurobi I was able to successfully install
I am building a
MILPModel
where the primary decision variables are binary,x[i,j]
. Depending upon thei,j
pair, I may want to forcex[i,j]
to 0 instead of giving the model the choice of 0 or 1. I have a static matrix,allowed_binary
, that isi
rows andj
columns, with value of 0 ifx[i,j]
must be 0, and a value of 1 ifx[i,j]
can be 0 or 1. I made a very simple constraint:add_constraint(x[i,j] <= allowed_binary[i,j], i=1:10, j = 1:20)
This constraint is accepted by
ompr
with aMIPModel
but when I add it in aMILPModel
, I get the errorError in constraint$lhs - constraint$rhs : non-numeric argument to binary operator
. Is this because of howMILPModel
handles multidimensional decision variables? I could probably form my decision variablesx
to be along a single vector if necessary.