Skip to content

Commit

Permalink
Get custom data of a column in a disaggregated solution (#1110)
Browse files Browse the repository at this point in the history
* Get custom data of a column in a disaggregated solution

* Add tests for BD.customdata()
  • Loading branch information
rrsadykov authored Nov 28, 2023
1 parent 9ec48d1 commit d365f72
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ test/Manifest.toml
*.dot
*.mps
*DS_Store
test/.222-revise-exit-code
test/.222-revise-exit-code
test/playgap.json
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ TOML = "fa267f1f-6049-4f14-aa54-33bafae1ed76"
TimerOutputs = "a759f4b9-e2f1-59dc-863e-4aeb61b1ea8f"

[compat]
BlockDecomposition = "1.13"
BlockDecomposition = "1.14"
Crayons = "4.1"
DataStructures = "0.17, 0.18"
DynamicSparseArrays = "0.7"
Expand Down
5 changes: 5 additions & 0 deletions src/MOIwrapper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1108,6 +1108,11 @@ end

BD.value(info::ColumnInfo) = info.column_val

function BD.customdata(info::ColumnInfo)
masterform = getmaster(info.optimizer.inner.re_formulation)
return getcustomdata(masterform, info.column_var_id)
end

function BD.value(info::ColumnInfo, index::MOI.VariableIndex)
varid = info.optimizer.env.varids[index]
origin_form_uid = getoriginformuid(info.column_var_id)
Expand Down
2 changes: 1 addition & 1 deletion test/MathOptInterface/MOI_wrapper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function test_runtests()
"test_linear_integration_Interval",
"test_linear_integration_delete_variables",
"test_linear_transform",
# Can we just exclude them?
# To see later if we need to support SOS2 integration
"test_linear_SOS2_integration",
],
# This argument is useful to prevent tests from failing on future
Expand Down
1 change: 1 addition & 0 deletions test/e2e_extra/advanced_colgen/improve_relax_callback.jl
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ function test_improve_relaxation(; do_improve::Bool)
sets = BD.getsolutions(model, b)
for s in sets
@test BD.value(s) == 1.0 # value of the master column variable
@test BD.customdata(s).items == [1] || BD.customdata(s).items == [2, 3] # either [1] or [2, 3]
@test BD.value(s, x[b, 1]) != BD.value(s, x[b, 2]) # only x[1,1] in its set
@test BD.value(s, x[b, 1]) != BD.value(s, x[b, 3]) # only x[1,1] in its set
@test BD.value(s, x[b, 2]) == BD.value(s, x[b, 3]) # x[1,2] and x[1,3] in the same set
Expand Down
1 change: 1 addition & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ else
end

run_e2e_tests()
run_e2e_extra_tests()
end

@testset "Version" begin
Expand Down

0 comments on commit d365f72

Please sign in to comment.