JuliaOpt / MathProgBase.jl

DEPRECATED: Solver-independent functions (i.e. linprog and mixintprog) and low-level interface for Mathematical Programming
Other
80 stars 38 forks source link

Assertion error in Loadproblem! #238

Open ivanrudnick opened 4 years ago

ivanrudnick commented 4 years ago

I am trying to run and optimization problem using Gurobi with JuMP 0.18. However the model fails with the following error:

Assertion error: rowub[i]< posinf
in solve at JuMP\I7whV\src\solvers.jl:150
in #solve#105 at JuMP\I7whV\src\solvers.jl:168
in #build at base\none
in #build#108 at JuMP\I7whV\src\solvers.jl:373
in loadproblem! at Gurobi\TX8tY\srcMPB_wrapper.jl:161

I have been trying to find the cause behind this error without any success. The error is being triggered in the following script:

  rangeconstrs = sum((rowlb .!= rowub) .& (rowlb .> neginf) .& (rowub .< posinf))
  if rangeconstrs > 0
      @warn("Julia Gurobi interface doesn't properly support range " *
            "(two-sided) constraints. See Gurobi.jl issue #14")
      add_rangeconstrs!(m.inner, float(A), float(rowlb), float(rowub))
      # A work around for the additional slack variables introduced and the
      # reformulation bug warning
      append!(obj, zeros(rangeconstrs))
  else
      b = Array{Float64}(undef, length(rowlb))
      senses = Array{Cchar}(undef, length(rowlb))
      for i in 1:length(rowlb)
          if rowlb[i] == rowub[i]
              senses[i] = '='
              b[i] = rowlb[i]
          elseif rowlb[i] > neginf
              senses[i] = '>'
              b[i] = rowlb[i]
          else
              @assert rowub[i] < posinf
              senses[i] = '<'
              b[i] = rowub[i]
          end
      end
      add_constrs!(m.inner, float(A), senses, b)
  end

Thank you

Edit(odow): formatting

odow commented 4 years ago

Are you passing a constraint with a lower-bound of -Inf and an upper-bound of Inf?

Is there any reason to use JuMP 0.18? We'd recommend that you upgrade to JuMP 0.20.

p.s.: In future, questions like this are better asked on the Discourse forum. It's easier to help if you read the first post of this PSA and provide a minimal working example.