Skip to content

Commit

Permalink
broadcasting +,= where necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
kalmarek committed May 4, 2018
1 parent 005e338 commit 31e39c1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/MOIWrapper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -232,11 +232,11 @@ function MOIU.loadconstraint!(optimizer::SCSOptimizer, ci, f::MOI.VectorAffineFu
offset = constroffset(optimizer, ci)
rows = constrrows(s)
optimizer.cone.nrows[offset] = length(rows)
i = offset + rows
i = offset .+ rows
# The SCS format is b - Ax ∈ cone
# so minus=false for b and minus=true for A
optimizer.data.b[i] = scalecoef(rows, orderval(f.constant, s), false, s)
append!(optimizer.data.I, offset + orderidx(I, s))
append!(optimizer.data.I, offset .+ orderidx(I, s))
append!(optimizer.data.J, J)
append!(optimizer.data.V, scalecoef(I, V, true, s))
end
Expand Down Expand Up @@ -352,7 +352,7 @@ end
function MOI.get(optimizer::SCSOptimizer, ::MOI.ConstraintPrimal, ci::CI{<:MOI.AbstractFunction, S}) where S <: MOI.AbstractSet
offset = constroffset(optimizer, ci)
rows = constrrows(optimizer, ci)
_unshift(optimizer, offset, unscalecoef(rows, reorderval(optimizer.sol.slack[offset + rows], S), S, length(rows)), S)
_unshift(optimizer, offset, unscalecoef(rows, reorderval(optimizer.sol.slack[offset .+ rows], S), S, length(rows)), S)
end

MOI.canget(optimizer::SCSOptimizer, ::MOI.DualStatus) = true
Expand All @@ -372,7 +372,7 @@ end
function MOI.get(optimizer::SCSOptimizer, ::MOI.ConstraintDual, ci::CI{<:MOI.AbstractFunction, S}) where S <: MOI.AbstractSet
offset = constroffset(optimizer, ci)
rows = constrrows(optimizer, ci)
unscalecoef(rows, reorderval(optimizer.sol.dual[offset + rows], S), S, length(rows))
unscalecoef(rows, reorderval(optimizer.sol.dual[offset .+ rows], S), S, length(rows))
end

MOI.canget(optimizer::SCSOptimizer, ::MOI.ResultCount) = true
Expand Down
2 changes: 1 addition & 1 deletion src/MPBWrapper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ function orderconesforscs(A_in, b_in, c_cones, v_cones)
# First, count the total number of variables
num_vars = 0
for (cone, idxs) in v_cones
col_map_type[idxs] = cone
col_map_type[idxs] .= cone
num_vars += length(idxs)
end
@assert num_vars == n
Expand Down

0 comments on commit 31e39c1

Please sign in to comment.