Skip to content

Commit ae3fe04

Browse files
committed
Update
1 parent 0b468ce commit ae3fe04

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/Bridges/bridge_optimizer.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1758,10 +1758,10 @@ function MOI.get(
17581758
end
17591759

17601760
function _get_variable_if_equivalent(b, x)
1761-
return _get_variable_if_equivalent(bridged_variable_function(b, x))
1761+
return _get_variable_if_equivalent(bridged_variable_function(b, x), x)
17621762
end
17631763

1764-
function _get_variable_if_equivalent(f::MOI.ScalarAffineFunction)
1764+
function _get_variable_if_equivalent(f::MOI.ScalarAffineFunction, x)
17651765
if length(f.terms) == 1
17661766
term = only(f.terms)
17671767
if isone(term.coefficient)
@@ -1858,6 +1858,9 @@ function MOI.get(
18581858
end
18591859
vi_bridged = get(b.name_to_var, name, nothing)
18601860
MOI.Utilities.throw_if_multiple_with_name(vi_bridged, name)
1861+
if _get_variable_if_equivalent(b, vi_bridged) !== nothing
1862+
return vi_bridged
1863+
end
18611864
return MOI.Utilities.check_type_and_multiple_names(
18621865
MOI.VariableIndex,
18631866
vi_bridged,

0 commit comments

Comments
 (0)