@@ -613,27 +613,28 @@ function distance_to_set(
613613 distance:: ProjectionUpperBoundDistance ,
614614 x:: AbstractVector{T} ,
615615 set:: MOI.Indicator{MOI.ACTIVATE_ON_ONE} ,
616- ) where {T<: Real }
616+ ) where {T<: Number }
617617 _check_dimension (x, set)
618+
618619 return min (
619620 # Distance of x[1] from 0
620621 abs (x[1 ]),
621622 # Distance of x[1] from 1 + distance to set
622- sqrt ((1 - x[1 ])^ 2 + distance_to_set (distance, x[2 ], set. set)^ 2 ),
623+ sqrt (abs (1 - x[1 ])^ 2 + distance_to_set (distance, x[2 ], set. set)^ 2 ),
623624 )
624625end
625626
626627function distance_to_set (
627628 distance:: ProjectionUpperBoundDistance ,
628629 x:: AbstractVector{T} ,
629630 set:: MOI.Indicator{MOI.ACTIVATE_ON_ZERO} ,
630- ) where {T}
631+ ) where {T<: Number }
631632 _check_dimension (x, set)
632633 return min (
633634 # Distance of x[1] from 1
634635 abs (one (T) - x[1 ]),
635636 # Distance of x[1] from 0 + distance to set
636- sqrt (x[1 ]^ 2 + distance_to_set (distance, x[2 ], set. set)^ 2 ),
637+ sqrt (abs ( x[1 ]) ^ 2 + distance_to_set (distance, x[2 ], set. set)^ 2 ),
637638 )
638639end
639640
@@ -647,7 +648,7 @@ function distance_to_set(
647648 :: ProjectionUpperBoundDistance ,
648649 x:: AbstractVector{T} ,
649650 set:: MOI.NormNuclearCone ,
650- ) where {T}
651+ ) where {T<: Real }
651652 _check_dimension (x, set)
652653 X = reshape (x[2 : end ], set. row_dim, set. column_dim)
653654 return max (sum (LinearAlgebra. svdvals (X)) - x[1 ], zero (T))
@@ -663,7 +664,7 @@ function distance_to_set(
663664 :: ProjectionUpperBoundDistance ,
664665 x:: AbstractVector{T} ,
665666 set:: MOI.NormSpectralCone ,
666- ) where {T}
667+ ) where {T<: Real }
667668 _check_dimension (x, set)
668669 X = reshape (x[2 : end ], set. row_dim, set. column_dim)
669670 return max (maximum (LinearAlgebra. svdvals (X)) - x[1 ], zero (T))
0 commit comments