Again, my curious interest is in pre-processing sparse data objects outside of MIPModel if possible. I created a simple sparse supply chain dataframe as an example: #437
Again, my curious interest is in pre-processing sparse data objects outside of MIPModel if possible. I created a simple sparse supply chain dataframe as an example:
In this case 3 plants produce 6 common products that are delivered to 2 warehouses. However not all plant, product, warehouse combinations are feasible. mat4 is a sparse dataframe of feasible combinations with a cost vector attached.
For this example, I am thinking that an ideal MIPModel solution for generating those variables would simply be:
model <- MIPModel() %>%
add_variable(x[mat4[, 1:3]])
Where x is the sparse index set read in directly. I read the help for add_variable:
But it is not clear to me how a .dots filter should be constructed with the current github version of MIPModel to generate a sparse variable set as in this simple sample case.
In this case 3 plants produce 6 common products that are delivered to 2 warehouses. However not all plant, product, warehouse combinations are feasible.
mat4
is a sparse dataframe of feasible combinations with a cost vector attached.For this example, I am thinking that an ideal MIPModel solution for generating those variables would simply be:
Where
x
is the sparse index set read in directly. I read the help foradd_variable
:But it is not clear to me how a
.dots
filter should be constructed with the current github version of MIPModel to generate a sparse variable set as in this simple sample case.Comments? Ideas?
Originally posted by @sbmack in https://github.com/dirkschumacher/ompr/discussions/412