Skip to content

Changing a model does not invalidate stored dual ray #2159

@odow

Description

@odow

I can reproduce this issue in 1.8.1 but not on 1.8.0.

See this example:

julia> using HiGHS

julia> begin
         ret = highs = Highs_create()
         ret = Highs_setStringOptionValue(highs, "presolve", "off")
         ret = Highs_changeObjectiveOffset(highs, 0.0)
         ret = Highs_addCol(highs, 0.0, 0.0, 0.0, 0, C_NULL, C_NULL)
         ret = Highs_addCol(highs, 0.0, 0.0, 0.0, 0, C_NULL, C_NULL)
         ret = Highs_addCol(highs, -1.0, 0.0, Inf, 0, C_NULL, C_NULL)
         ret = Highs_addCol(highs, -1.0, 0.0, Inf, 0, C_NULL, C_NULL)
         ret = Highs_addRow(highs, 0.0, 0.0, 2, Int32[2, 3], [1.0, -1.0])
         ret = Highs_addRow(highs, 1.0, Inf, 2, Int32[2, 3], [1.0, 1.0])
         ret = Highs_addRow(highs, -Inf, 0.0, 2, Int32[0, 2], [-2.0, 1.0])
         ret = Highs_addRow(highs, -Inf, 0.0, 2, Int32[1, 3], [-3.0, 1.0])
         ret = Highs_run(highs)
         has_dual_ray = Base.RefValue{Int32}(0)
         dual_ray_value = [0.0, 0.0, 0.0, 0.0]
         ret = Highs_getDualRay(highs, has_dual_ray, dual_ray_value)
         @show has_dual_ray, dual_ray_value
         ret = Highs_changeColBounds(highs, 1, 1.0, 1.0)
         ret = Highs_run(highs)
         ret = Highs_getDualRay(highs, has_dual_ray, dual_ray_value)
         @show has_dual_ray, dual_ray_value
       end
Running HiGHS 1.9.0 (git hash: 66f735e60): Copyright (c) 2024 HiGHS under MIT licence terms
Coefficient ranges:
  Matrix [1e+00, 3e+00]
  Cost   [1e+00, 1e+00]
  Bound  [0e+00, 0e+00]
  RHS    [1e+00, 1e+00]
Solving LP without presolve, or with basis, or unconstrained
Using EKK dual simplex solver - serial
  Iteration        Objective     Infeasibilities num(sum)
          0    -1.9999968934e+00 Ph1: 3(3); Du: 2(2) 0s
          2     0.0000000000e+00 0s
Model status        : Infeasible
Simplex   iterations: 2
Objective value     :  0.0000000000e+00
Relative P-D gap    :  0.0000000000e+00
HiGHS run time      :          0.00
Solving linear system to compute dual ray
(has_dual_ray, dual_ray_value) = (Base.RefValue{Int32}(1), [0.0, 1.0, -1.0, -1.0])
Coefficient ranges:
  Matrix [1e+00, 3e+00]
  Cost   [1e+00, 1e+00]
  Bound  [1e+00, 1e+00]
  RHS    [1e+00, 1e+00]
Solving LP without presolve, or with basis, or unconstrained
Using EKK dual simplex solver - serial
  Iteration        Objective     Infeasibilities num(sum)
          0    -2.9999961628e+00 Pr: 1(3) 0s
          1     9.7888364081e-13 0s
Model status        : Infeasible
Simplex   iterations: 1
Objective value     :  0.0000000000e+00
Relative P-D gap    :  9.7888364081e-13
HiGHS run time      :          0.00
Copying known dual ray
(has_dual_ray, dual_ray_value) = (Base.RefValue{Int32}(1), [0.0, 1.0, -1.0, -1.0])
(Base.RefValue{Int32}(1), [0.0, 1.0, -1.0, -1.0])

The second call to Highs_getDualRay says Copying known dual ray but the dual ray is not the same because we have modified the problem.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions