Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in copy_to #172

Closed
odow opened this issue Sep 26, 2023 · 1 comment · Fixed by #173
Closed

Bug in copy_to #172

odow opened this issue Sep 26, 2023 · 1 comment · Fixed by #173

Comments

@odow
Copy link
Member

odow commented Sep 26, 2023

Using the file from https://discourse.julialang.org/t/highs-error-no-invertible-representation-for-getdualray/101372/11?u=odow

import HiGHS
import MathOptInterface as MOI
model = MOI.FileFormats.MOF.Model()
MOI.read_from_file(model, "/Users/Oscar/Downloads/test.mof.json")
MOI.set(model, MOI.ObjectiveSense(), MOI.FEASIBILITY_SENSE)
h = HiGHS.Optimizer()
MOI.copy_to(h, model)
julia> MOI.optimize!(h)
Presolving model
Presolve: Infeasible

Solving report
  Status            Infeasible
  Primal bound      inf
  Dual bound        -inf
  Gap               inf
  Solution status   -
  Timing            0.00 (total)
                    0.00 (presolve)
                    0.00 (postsolve)
  Nodes             0
  LP iterations     0 (total)
                    0 (strong br.)
                    0 (separation)
                    0 (heuristics)
ERROR:   No invertible representation for getDualRay

But the model is easy to grok that it should be feasible.

@odow
Copy link
Member Author

odow commented Sep 26, 2023

Rows with 0 >= 0 are being scrambled

julia> import HiGHS

julia> import MathOptInterface as MOI

julia> model = MOI.Utilities.Model{Float64}()
MOIU.Model{Float64}

julia> x = MOI.add_variable(model)
MOI.VariableIndex(1)

julia> g = zero(MOI.ScalarAffineFunction{Float64})
0.0

julia> MOI.add_constraint(model, 2.0 * x, MOI.GreaterThan(0.0))
MathOptInterface.ConstraintIndex{MathOptInterface.ScalarAffineFunction{Float64}, MathOptInterface.GreaterThan{Float64}}(1)

julia> MOI.add_constraint(model, g, MOI.GreaterThan(0.0))
MathOptInterface.ConstraintIndex{MathOptInterface.ScalarAffineFunction{Float64}, MathOptInterface.GreaterThan{Float64}}(2)

julia> MOI.add_constraint(model, 1.0 * x, MOI.EqualTo(1.0))
MathOptInterface.ConstraintIndex{MathOptInterface.ScalarAffineFunction{Float64}, MathOptInterface.EqualTo{Float64}}(1)

julia> h = HiGHS.Optimizer(); MOI.copy_to(h, model)
Running HiGHS 1.5.3 [date: 1970-01-01, git hash: 45a127b78]
Copyright (c) 2023 HiGHS under MIT licence terms
MathOptInterface.Utilities.IndexMap with 4 entries:
  MOI.VariableIndex(1)                                         => MOI.VariableIndex(1)
  ConstraintIndex{ScalarAffineFunction{Float64}, EqualTo{Floa => ConstraintIndex{ScalarAffineFunction{Float64}, EqualTo{Float64}}(3)
  ConstraintIndex{ScalarAffineFunction{Float64}, GreaterThan{ => ConstraintIndex{ScalarAffineFunction{Float64}, GreaterThan{Float64}}(2)
  ConstraintIndex{ScalarAffineFunction{Float64}, GreaterThan{ => ConstraintIndex{ScalarAffineFunction{Float64}, GreaterThan{Float64}}(1)

julia> print(h)
Minimize ScalarAffineFunction{Float64}:
 0.0

Subject to:

ScalarAffineFunction{Float64}-in-EqualTo{Float64}
 0.0 == 1.0

ScalarAffineFunction{Float64}-in-GreaterThan{Float64}
 0.0 + 2.0 v[1] >= 0.0
 0.0 + 1.0 v[1] >= 0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant