Skip to content

Commit

Permalink
Updates to latest MOI
Browse files Browse the repository at this point in the history
  • Loading branch information
odow committed Sep 2, 2021
1 parent d25a14a commit 9001b35
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 86 deletions.
6 changes: 2 additions & 4 deletions perf/runbench.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@ function generate_moi_problem(model, At, b, c;
A_vals = nonzeros(At)
if var_bounds
for col in 1:cols
MOI.add_constraint(model, MOI.SingleVariable(x[col]),
MOI.LessThan(10.0))
MOI.add_constraint(model, MOI.SingleVariable(x[col]),
MOI.GreaterThan(-10.0))
MOI.add_constraint(model, x[col], MOI.LessThan(10.0))
MOI.add_constraint(model, x[col], MOI.GreaterThan(-10.0))
end
end
if scalar
Expand Down
12 changes: 6 additions & 6 deletions src/MOI_wrapper/MOI_copy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -93,22 +93,22 @@ function _add_set_data(cache, i, s::MOI.Interval{Float64})
end

function _extract_bound_data(src, map, cache, s::Type{S}) where {S}
for ci in MOI.get(src, MOI.ListOfConstraintIndices{MOI.SingleVariable,S}())
for ci in MOI.get(src, MOI.ListOfConstraintIndices{MOI.VariableIndex,S}())
f = MOI.get(src, MOI.ConstraintFunction(), ci)
s = MOI.get(src, MOI.ConstraintSet(), ci)
column = map[f.variable].value
column = map[f].value
_add_set_data(cache, column, s)
map[ci] = MOI.ConstraintIndex{MOI.SingleVariable,S}(column)
map[ci] = MOI.ConstraintIndex{MOI.VariableIndex,S}(column)
end
return
end

function _extract_type_data(src, map, cache, ::Type{S}) where {S}
for ci in MOI.get(src, MOI.ListOfConstraintIndices{MOI.SingleVariable,S}())
for ci in MOI.get(src, MOI.ListOfConstraintIndices{MOI.VariableIndex,S}())
f = MOI.get(src, MOI.ConstraintFunction(), ci)
column = map[f.variable].value
column = map[f].value
cache.types[column] = S == MOI.Integer ? INTEGER : BINARY
map[ci] = MOI.ConstraintIndex{MOI.SingleVariable,S}(column)
map[ci] = MOI.ConstraintIndex{MOI.VariableIndex,S}(column)
end
return
end
Expand Down
Loading

0 comments on commit 9001b35

Please sign in to comment.