ompr.highs package not working on my computer

59 Views Asked by At

Since i have changed my computer i have an issue with the ompr.highs package. I ran this exemple code :

library(ompr)
library(ompr.highs)
suppressPackageStartupMessages(library(dplyr, quietly = TRUE))
max_bins <- 10
bin_size <- 3
n <- 10
weights <- runif(n, max = bin_size)
MIPModel() |>
  add_variable(y[i], i = 1:max_bins, type = "binary") |>
  add_variable(x[i, j], i = 1:max_bins, j = 1:n, type = "binary") |>
  set_objective(sum_over(y[i], i = 1:max_bins), "min") |>
  add_constraint(sum_over(weights[j] * x[i, j], j = 1:n) <= y[i] * bin_size, i = 1:max_bins) |>
  add_constraint(sum_over(x[i, j], i = 1:max_bins) == 1, j = 1:n) |>
  solve_model(highs_optimizer()) |>
  get_solution(x[i, j]) |>
  filter(value > 0.9) |>
  arrange(i, j)

it works on other computers but not on mine. I use Rversion 4.2.0 and last version of Rstudio. If someone knows how to solve this it will help me a lot.

I use ompr.highs to solve a more complicated problem (it shows the same error). Though, the same code works on another computer.

The code above gives the error :

Error in highs_solve(L = as.numeric(obj$solution), A = constraints$matrix, :
unused argument (dry_run = FALSE)

0

There are 0 best solutions below