1

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)

user20650
  • 24,654
  • 5
  • 56
  • 91
Mousta1101
  • 11
  • 2
  • okay. I can reproduce this with `packageVersion("ompr.highs") ‘0.0.1.9000’; packageVersion("ompr") ‘1.0.3’ packageVersion("highs") ‘0.1.10’`. If I copy the function and comment out the [line](https://github.com/dirkschumacher/ompr.highs/blob/main/R/highs.R#L58) then the function runs. I'd raise an issue at https://github.com/dirkschumacher/ompr.highs/issues. – user20650 Jun 07 '23 at 16:13
  • [old highs versions](https://gitlab.com/roigrp/solver/highs/-/blob/b257be8395b10bff17f86c745ec6e169c10a4434/R/highs.R#L120) has a `dry_run` argument but [current highs version](https://gitlab.com/roigrp/solver/highs/-/blob/main/R/highs.R#L312) does not. Seems to be a version mismatch. – user20650 Jun 07 '23 at 16:26
  • The problem is solved by commenting the indicated line. It is effectively a highs version problem. Thank you for your answer. i'll let you raise the issue on github @user20650 . – Mousta1101 Jun 07 '23 at 16:39

0 Answers0