Skip to content

Commit

Permalink
Simplify starting_value
Browse files Browse the repository at this point in the history
  • Loading branch information
blegat committed Sep 22, 2021
1 parent 43f6663 commit c586df2
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions src/MOI_wrapper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -142,23 +142,7 @@ function starting_value(optimizer::Optimizer{T}, i) where {T}
return optimizer.starting_values[i]
else
v = optimizer.variables
has_lower_bound = !iszero(v.set_mask[i] & MOI.Utilities._LOWER_BOUND_MASK)
has_upper_bound = !iszero(v.set_mask[i] & MOI.Utilities._UPPER_BOUND_MASK)
if has_lower_bound && has_upper_bound
if zero(T) <= v.lower[i]
return v.lower[i]
elseif v.upper[i] <= zero(T)
return v.upper[i]
else
return zero(T)
end
elseif has_lower_bound
return max(zero(T), v.lower[i])
elseif has_upper_bound
return min(zero(T), v.upper[i])
else
return zero(T)
end
return min(max(zero(T), v.lower[i]), v.upper[i])
end
end

Expand Down

0 comments on commit c586df2

Please sign in to comment.