Skip to content

Commit

Permalink
Function to test whether a column is proper (#1129)
Browse files Browse the repository at this point in the history
* Put back function `column_is_proper`

* Activate all tests
  • Loading branch information
rrsadykov authored Feb 2, 2024
1 parent 79b4092 commit d9004b2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/Algorithm/presolve/interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions src/MathProg/formulation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down
2 changes: 2 additions & 0 deletions test/unit/Presolve/presolve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit d9004b2

Please sign in to comment.