From d9004b26e874c665a6254557c57f7b3ebe48067d Mon Sep 17 00:00:00 2001 From: Ruslan Sadykov <41117501+rrsadykov@users.noreply.github.com> Date: Fri, 2 Feb 2024 18:37:57 +0100 Subject: [PATCH] Function to test whether a column is proper (#1129) * Put back function `column_is_proper` * Activate all tests --- src/Algorithm/presolve/interface.jl | 6 ++++++ src/MathProg/formulation.jl | 4 ++-- test/unit/Presolve/presolve.jl | 2 ++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Algorithm/presolve/interface.jl b/src/Algorithm/presolve/interface.jl index 0b1f9f95d..411d84c11 100644 --- a/src/Algorithm/presolve/interface.jl +++ b/src/Algorithm/presolve/interface.jl @@ -550,3 +550,9 @@ function _column_is_proper(col_id, sp_form) end return true end + +function column_is_proper(col_id, reform) + sp_id = getoriginformuid(col_id) + sp_form = get_dw_pricing_sps(reform)[sp_id] + return _column_is_proper(col_id, sp_form) +end diff --git a/src/MathProg/formulation.jl b/src/MathProg/formulation.jl index 7da7e1d84..04447b813 100644 --- a/src/MathProg/formulation.jl +++ b/src/MathProg/formulation.jl @@ -356,8 +356,8 @@ function _addlocalartvar!(form::Formulation, constr::Constraint, abs_cost::Float constrname = getname(form, constr) constrsense = getperensense(form, constr) if constrsense == Equal - name1 = string("local_art_of_", constrname, "1") - name2 = string("local_art_of_", constrname, "2") + name1 = string("local_pos_art_of_", constrname) + name2 = string("local_neg_art_of_", constrname) var1 = setvar!( form, name1, art_var_duty; cost=cost, lb=0.0, ub=Inf, kind=Continuous ) diff --git a/test/unit/Presolve/presolve.jl b/test/unit/Presolve/presolve.jl index dbf7259c2..307021ecf 100644 --- a/test/unit/Presolve/presolve.jl +++ b/test/unit/Presolve/presolve.jl @@ -604,6 +604,8 @@ function test_presolve_full() └ value = 1.00 """ + @test Coluna.Algorithm.column_is_proper(master_vars["MC_1"], reform) == false + @test Coluna.Algorithm.column_is_proper(master_vars["MC_2"], reform) == true input = Coluna.Algorithm.PresolveInput(Dict(master_vars["MC_1"] => 0.0)) output = Coluna.Algorithm.run!(presolve_algorithm, env, reform, input)