POI assumes that inner VariableIndex match outer VariableIndex
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 28/100
Hướng nghiên cứu
Bắt đầu với trình tái hiện Julia rút gọn và lần theo trạng thái lồng nhau của CachingOptimizer, đặc biệt là VariablesContainer và các ràng buộc affine vô hướng được nêu trong báo cáo. So sánh ánh xạ biến thông qua index_map.jl và MOI_wrapper.jl của HiGHS, sau đó sử dụng lỗi kiểm thử MathOptInterface đã được báo cáo để xác minh nguyên nhân. Hoàn tất khi trình tái hiện không còn tạo ra một ràng buộc tham chiếu đến một VariableIndex bị thiếu và kiểm thử bị ảnh hưởng chạy thành công.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
I still don't know where the error is.
Here is what I know:
- The seemingly inoffensive(we know they are never inoffensive) update in POI: https://github.com/jump-dev/DiffOpt.jl/pull/316
Led to a fail in MOI tests in DiffOpt:
test_conic_linear_VectorOfVariables_2: Error During Test at /home/runner/.julia/packages/MathOptInterface/zq9bo/src/Test/Test.jl:264
Got exception outside of a @test
KeyError: key MOI.VariableIndex(4) not found
Stacktrace:
[1] getindex(c::MathOptInterface.Utilities.CleverDicts.CleverDict{MathOptInterface.VariableIndex, MathOptInterface.VariableIndex, typeof(MathOptInterface.Utilities.CleverDicts.key_to_index), typeof(MathOptInterface.Utilities.CleverDicts.index_to_key)}, key::MathOptInterface.VariableIndex)
@ MathOptInterface.Utilities.CleverDicts ~/.julia/packages/MathOptInterface/zq9bo/src/Utilities/CleverDicts.jl:164
[2] getindex
@ ~/.julia/packages/MathOptInterface/zq9bo/src/Utilities/copy/index_map.jl:64 [inlined]
[3] _extract_row_data(dest::HiGHS.Optimizer, src::MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.Model{Float64}}, mapping::MathOptInterface.Utilities.IndexMap, rowlower::Vector{Float64}, rowupper::Vector{Float64}, I::Vector{Int32}, J::Vector{Int32}, V::Vector{Float64}, ::Type{MathOptInterface.EqualTo{Float64}})
@ HiGHS ~/.julia/packages/HiGHS/umjNf/src/MOI_wrapper.jl:2997
[4] copy_to(dest::HiGHS.Optimizer, src::MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.Model{Float64}})
@ HiGHS ~/.julia/packages/HiGHS/umjNf/src/MOI_wrapper.jl:3065
I reduced the test to:
using Test
import MathOptInterface as MOI
import DiffOpt
import HiGHS
model = DiffOpt.diff_optimizer(HiGHS.Optimizer)
MOI.set(model, MOI.Silent(), true)
T = Float64
x = MOI.add_variable(model)
@test MOI.get(model, MOI.NumberOfVariables()) == 1
ys, vc = MOI.add_constrained_variables(model, MOI.Nonpositives(1))
y = ys[1]
@test MOI.get(model, MOI.NumberOfVariables()) == 2
z, s = MOI.add_variables(model, 2)
@test MOI.get(model, MOI.NumberOfVariables()) == 4
MOI.set(
model,
MOI.ObjectiveFunction{MOI.ScalarAffineFunction{T}}(),
MOI.ScalarAffineFunction(
MOI.ScalarAffineTerm.(T[3, 2, -4], [x, y, z]),
T(0),
),
)
MOI.set(model, MOI.ObjectiveSense(), MOI.MIN_SENSE)
c = MOI.add_constraint(
model,
MOI.VectorAffineFunction(
MOI.VectorAffineTerm.(
[1, 1, 2, 3, 3],
MOI.ScalarAffineTerm.(T[1, -1, 1, 1, 1], [x, s, y, x, z]),
),
T[4, 3, -12],
),
MOI.Zeros(3),
)
vz = MOI.add_constraint(model, [z], MOI.Nonnegatives(1))
vov = MOI.VectorOfVariables([s])
vs = MOI.add_constraint(model, vov, MOI.Zeros(1))
@test MOI.get(model, MOI.TerminationStatus()) == MOI.OPTIMIZE_NOT_CALLED
MOI.optimize!(model)
And the same error is trigged.
Inpective the innermost CachingOptimizer we get:
julia> model.optimizer.optimizer.optimizer.model
MOIU.CachingOptimizer
├ state: EMPTY_OPTIMIZER
├ mode: AUTOMATIC
├ model_cache: MOIU.UniversalFallback{MOIU.Model{Float64}}
│ ├ ObjectiveSense: MIN_SENSE
│ ├ ObjectiveFunctionType: MOI.ScalarAffineFunction{Float64}
│ ├ NumberOfVariables: 3
│ └ NumberOfConstraints: 5
│ ├ MOI.ScalarAffineFunction{Float64} in MOI.EqualTo{Float64}: 3
│ ├ MOI.VariableIndex in MOI.GreaterThan{Float64}: 1
│ └ MOI.VariableIndex in MOI.LessThan{Float64}: 1
└ optimizer: A HiGHS model with 0 columns and 0 rows.
Where there are only 3 variables:
julia> model.optimizer.optimizer.optimizer.model.model_cache.model.variables
MathOptInterface.Utilities.VariablesContainer{Float64}(UInt16[0x0000, 0x0004, 0x0002], [-Inf, -Inf, 0.0], [Inf, 0.0, Inf])
but the first of the affine constraints contains a 4th variable!
julia> model.optimizer.optimizer.optimizer.model.model_cache.model.constraints.moi_scalaraffinefunction.moi_equalto.constraints
MathOptInterface.Utilities.CleverDicts.CleverDict{MathOptInterface.ConstraintIndex{MathOptInterface.ScalarAffineFunction{Float64}, MathOptInterface.EqualTo{Float64}}, Tuple{MathOptInterface.ScalarAffineFunction{Float64}, MathOptInterface.EqualTo{Float64}}, typeof(MathOptInterface.Utilities.CleverDicts.key_to_index), typeof(MathOptInterface.Utilities.CleverDicts.index_to_key)} with 3 entries:
ConstraintIndex{ScalarAffineFunction{Float64}, EqualTo{Float64}}(1) => (0.0 + 1.0 MOI.VariableIndex(1) - 1.0 MOI.VariableIndex(4), EqualTo{Float64}(-4.0))
ConstraintIndex{ScalarAffineFunction{Float64}, EqualTo{Float64}}(2) => (0.0 + 1.0 MOI.VariableIndex(2), EqualTo{Float64}(-3.0))
ConstraintIndex{ScalarAffineFunction{Float64}, EqualTo{Float64}}(3) => (0.0 + 1.0 MOI.VariableIndex(1) + 1.0 MOI.VariableIndex(3), EqualTo{Float64}(12.0))
- Ngôn ngữ chính
- Julia
- Star
- 49
- Fork
- 8
- Merge trung bình
- 22 giờ 26 phút
- Pull request đã merge (30 ngày)
- 2
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của jump-dev/ParametricOptInterface.jl
-
POI failing with ClarabelĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 52/100
jump-dev/ParametricOptInterface.jl#201 · 17 bình luận ·
-
Keeping track of the performanceĐang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
jump-dev/ParametricOptInterface.jl#71 · 8 bình luận · 3 reaction ·
Tất cả issue của jump-dev/ParametricOptInterface.jl
Issue tương tự
-
io
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
JuliaGPU/GPUArrays.jl#837 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
bmad-sim/BeamTracking.jl#382 ·
Maintainer thường phản hồi trong vòng 1 ngày