Skip to content

Commit

Permalink
Fix incorrect usage of Utilities.operate! (#2207)
Browse files Browse the repository at this point in the history
  • Loading branch information
odow authored Jun 13, 2023
1 parent 4526e6b commit c3708aa
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/Bridges/Constraint/bridges/count_belongs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ function MOI.Bridges.final_touch(
end
end
end
MOI.Utilities.operate!(-, T, f, scalars[1])
f = MOI.Utilities.operate!(-, T, f, scalars[1])
push!(
bridge.equal_to,
MOI.Utilities.normalize_and_add_constraint(
Expand Down
2 changes: 1 addition & 1 deletion src/Bridges/Constraint/bridges/count_distinct.jl
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ function MOI.Bridges.final_touch(
)
end
count_f = MOI.ScalarAffineFunction(count_terms, zero(T))
MOI.Utilities.operate!(-, T, count_f, scalars[1])
count_f = MOI.Utilities.operate!(-, T, count_f, scalars[1])
push!(
bridge.equal_to,
MOI.Utilities.normalize_and_add_constraint(
Expand Down
6 changes: 3 additions & 3 deletions src/Bridges/Constraint/bridges/count_distinct_reif.jl
Original file line number Diff line number Diff line change
Expand Up @@ -377,9 +377,9 @@ function MOI.Bridges.final_touch(
MOI.add_constraint(model, z[2], MOI.ZeroOne())
# ∑y - n - δ⁺ + δ⁻ = 0
f_0 = MOI.ScalarAffineFunction(count_terms, zero(T))
MOI.Utilities.operate!(-, T, f_0, scalars[2])
MOI.Utilities.operate!(-, T, f_0, z[3])
MOI.Utilities.operate!(+, T, f_0, z[4])
f_0 = MOI.Utilities.operate!(-, T, f_0, scalars[2])
f_0 = MOI.Utilities.operate!(-, T, f_0, z[3])
f_0 = MOI.Utilities.operate!(+, T, f_0, z[4])
push!(
bridge.equal_to,
MOI.Utilities.normalize_and_add_constraint(
Expand Down
2 changes: 1 addition & 1 deletion src/Bridges/Constraint/bridges/norm_to_power.jl
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function bridge_constraint(
for ri in r
f = MOI.Utilities.operate!(+, T, f, ri)
end
MOI.Utilities.operate!(-, T, f, fi_s[1])
f = MOI.Utilities.operate!(-, T, f, fi_s[1])
equal_ci = MOI.add_constraint(model, f, MOI.EqualTo(zero(T)))
return NormToPowerBridge{T,F}(power_ci, r, equal_ci, s)
end
Expand Down
6 changes: 3 additions & 3 deletions src/Bridges/Constraint/bridges/quad_to_soc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -414,11 +414,11 @@ function MOI.get(
for i in 3:MOI.output_dimension(f)
term = MOI.Utilities.operate(*, T, fs[i], fs[i])
term = MOI.Utilities.operate!(/, T, term, 2 * one(T))
MOI.Utilities.operate!(+, T, q, term)
q = MOI.Utilities.operate!(+, T, q, term)
end
MOI.Utilities.operate!(-, T, q, fs[2])
q = MOI.Utilities.operate!(-, T, q, fs[2])
if !b.less_than
MOI.Utilities.operate!(-, T, q)
q = MOI.Utilities.operate!(-, T, q)
end
q.constant += b.set_constant
return q
Expand Down

0 comments on commit c3708aa

Please sign in to comment.