Skip to content

Commit

Permalink
fix MOI tests (#1028)
Browse files Browse the repository at this point in the history
  • Loading branch information
guimarqu authored Aug 3, 2023
1 parent b485a37 commit becc0e4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
11 changes: 9 additions & 2 deletions src/MOIwrapper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -590,8 +590,15 @@ function MOI.get(
orig_form = get_original_formulation(model.inner)
constrid = getid(_info(model, index).constr)
terms = MOI.ScalarAffineTerm{Float64}[]
for (varid, coef) in @view getcoefmatrix(orig_form)[constrid, :]
push!(terms, MOI.ScalarAffineTerm(coef, model.moi_varids[varid]))
matrix = getcoefmatrix(orig_form)
if matrix.matrix.fillmode
for (varid, coef) in view(matrix.matrix.buffer, constrid, :)
push!(terms, MOI.ScalarAffineTerm(coef, model.moi_varids[varid]))
end
else
for (varid, coef) in @view getcoefmatrix(orig_form)[constrid, :]
push!(terms, MOI.ScalarAffineTerm(coef, model.moi_varids[varid]))
end
end
return MOI.ScalarAffineFunction(terms, 0.0)
end
Expand Down
4 changes: 0 additions & 4 deletions test/parser.jl
Original file line number Diff line number Diff line change
Expand Up @@ -406,9 +406,7 @@ module Parser
var = cache.variables[varid]
if var.duty <= ClMP.AbstractOriginMasterVar || var.duty <= ClMP.AbstractAddedMasterVar
is_explicit = !(var.duty <= ClMP.AbstractImplicitMasterVar)
@show varid
v = ClMP.setvar!(master, varid, var.duty; lb = var.lb, ub = var.ub, kind = var.kind, is_explicit = is_explicit)
@show ClMP.getid(v)
else
if haskey(all_spvars, varid)
var, sp = all_spvars[varid]
Expand All @@ -421,8 +419,6 @@ module Parser
explicit = true
end
v = ClMP.clonevar!(sp, master, sp, var, duty; cost = ClMP.getcurcost(sp, var), is_explicit = explicit)
@show ClMP.getname(master, v)
@show ClMP.getid(v)
else
throw(UndefVarParserError("Variable $varid not present in any subproblem"))
end
Expand Down

0 comments on commit becc0e4

Please sign in to comment.