Cuts: Store variable names

This commit is contained in:
2023-01-23 15:15:53 -06:00
parent 41f9234de1
commit b5a76e4588
4 changed files with 16 additions and 7 deletions

View File

@@ -80,6 +80,11 @@ function collect(
ncuts = length([cr for cr in constraints if select(cr)])
cuts_lhs = spzeros(ncuts, nvars)
cuts_rhs = Float64[]
cuts_var_names = String[]
for i in 0:(nvars-1)
push!(cuts_var_names, name(VariableRef(model, MOI.VariableIndex(i))))
end
offset = 1
for conRef in constraints
@@ -98,6 +103,7 @@ function collect(
h5 = Hdf5Sample(h5_filename)
h5.put_sparse("cuts_cpx_lhs", cuts_lhs)
h5.put_array("cuts_cpx_rhs", cuts_rhs)
h5.put_array("cuts_cpx_var_names", to_str_array(cuts_var_names))
h5.file.close()
return

View File

@@ -43,7 +43,8 @@ function PyObject(m::SparseMatrixCSC)
).tocoo()
end
include("Cuts/BlackBox/cplex.jl")
export Hdf5Sample
end # module