Closed snestler closed 4 years ago
I can now answer my own question. The answer is yes. It can. We got it to work late last night. Thought I would share with others who might want to know.
A MIP model can be reactive. I confirm :)
I would not go for MILP models at this stage. Yes they are fast, but they dont seem to work yet for indexes with lag like this one:
add_constraint(sum_expr(f[i] * xf[i, j, k] - f[i] * xf[i, j-1, k], i = 1:n, k = 1:p) >= 0, j = 2:m)
Or when you use external functions to determine coefficients like this:
intralocation <- function(i, k) {
ifelse(i == k, 0, 1)
}
...
add_constraint(intralocation(i, k) * f[i] * xf[i, j, k] <= 10, i= 1:n, j = 1:m, k = 1:p)
Is there any reason that an ompr model (either MIP or MILP) cannot be a reactive object in Shiny? I have seen the example where Dirk uses ompr in a Shiny app to solve Sudoku. However, the model itself is not reactive. I would like to make it a reactive object with a "Build Model" actionButton and a "Solve Model" actionButton, each with their own eventReactive. Has anyone done this? Is it possible? I've been trying but am stuck. Thank you.