diff --git a/src/Bridges/Constraint/bridge.jl b/src/Bridges/Constraint/bridge.jl index f28b94171e..0d7f6e12fe 100644 --- a/src/Bridges/Constraint/bridge.jl +++ b/src/Bridges/Constraint/bridge.jl @@ -33,10 +33,10 @@ function bridge_constraint end The number of variables created by the bridge `b` in the model. """ -MOI.get(::AbstractBridge, ::MOI.NumberOfVariables) = 0 +MOI.get(::AbstractBridge, ::MOI.NumberOfVariables) = Int64(0) """ - MOI.get(b::AbstractBridge, ::MOI.NumberOfVariables) + MOI.get(b::AbstractBridge, ::MOI.ListOfVariableIndices) The list of variables created by the bridge `b` in the model. """ diff --git a/src/Bridges/Constraint/det.jl b/src/Bridges/Constraint/det.jl index 71eab504d6..7591340dce 100644 --- a/src/Bridges/Constraint/det.jl +++ b/src/Bridges/Constraint/det.jl @@ -178,7 +178,10 @@ function subsum( end # Attributes, Bridge acting as a model -MOI.get(b::LogDetBridge, ::MOI.NumberOfVariables) = length(b.Δ) + length(b.l) +function MOI.get(b::LogDetBridge, ::MOI.NumberOfVariables) + return Int64(length(b.Δ) + length(b.l)) +end + MOI.get(b::LogDetBridge, ::MOI.ListOfVariableIndices) = [b.Δ; b.l] function MOI.get( b::LogDetBridge{T}, @@ -187,19 +190,19 @@ function MOI.get( MOI.PositiveSemidefiniteConeTriangle, }, ) where {T} - return 1 + return Int64(1) end function MOI.get( b::LogDetBridge{T}, ::MOI.NumberOfConstraints{MOI.VectorAffineFunction{T},MOI.ExponentialCone}, ) where {T} - return length(b.lcindex) + return Int64(length(b.lcindex)) end function MOI.get( b::LogDetBridge{T}, ::MOI.NumberOfConstraints{MOI.ScalarAffineFunction{T},MOI.LessThan{T}}, ) where {T} - return 1 + return Int64(1) end function MOI.get( b::LogDetBridge{T}, @@ -357,7 +360,7 @@ function MOIB.added_constraint_types(::Type{RootDetBridge{T}}) where {T} end # Attributes, Bridge acting as a model -MOI.get(b::RootDetBridge, ::MOI.NumberOfVariables) = length(b.Δ) +MOI.get(b::RootDetBridge, ::MOI.NumberOfVariables) = Int64(length(b.Δ)) MOI.get(b::RootDetBridge, ::MOI.ListOfVariableIndices) = b.Δ function MOI.get( b::RootDetBridge{T}, @@ -366,7 +369,7 @@ function MOI.get( MOI.PositiveSemidefiniteConeTriangle, }, ) where {T} - return 1 + return Int64(1) end function MOI.get( b::RootDetBridge{T}, @@ -375,7 +378,7 @@ function MOI.get( MOI.GeometricMeanCone, }, ) where {T} - return 1 + return Int64(1) end function MOI.get( b::RootDetBridge{T}, diff --git a/src/Bridges/Constraint/functionize.jl b/src/Bridges/Constraint/functionize.jl index 6b35d590a9..90d3d79fe5 100644 --- a/src/Bridges/Constraint/functionize.jl +++ b/src/Bridges/Constraint/functionize.jl @@ -51,7 +51,7 @@ function MOI.get( b::ScalarFunctionizeBridge{T,S}, ::MOI.NumberOfConstraints{MOI.ScalarAffineFunction{T},S}, ) where {T,S} - return 1 + return Int64(1) end function MOI.get( b::ScalarFunctionizeBridge{T,S}, @@ -141,7 +141,7 @@ function MOI.get( b::VectorFunctionizeBridge{T,S}, ::MOI.NumberOfConstraints{MOI.VectorAffineFunction{T},S}, ) where {T,S} - return 1 + return Int64(1) end function MOI.get( b::VectorFunctionizeBridge{T,S}, diff --git a/src/Bridges/Constraint/geomean.jl b/src/Bridges/Constraint/geomean.jl index 1b60810697..7439e62179 100644 --- a/src/Bridges/Constraint/geomean.jl +++ b/src/Bridges/Constraint/geomean.jl @@ -158,25 +158,25 @@ function concrete_bridge_type( end # Attributes, Bridge acting as a model -MOI.get(b::GeoMeanBridge, ::MOI.NumberOfVariables) = length(b.xij) +MOI.get(b::GeoMeanBridge, ::MOI.NumberOfVariables) = Int64(length(b.xij)) MOI.get(b::GeoMeanBridge, ::MOI.ListOfVariableIndices) = b.xij function MOI.get( b::GeoMeanBridge{T,F}, ::MOI.NumberOfConstraints{F,MOI.LessThan{T}}, ) where {T,F} - return 1 # t ≤ x_{l1}/sqrt(N) + return Int64(1) # t ≤ x_{l1}/sqrt(N) end function MOI.get( b::GeoMeanBridge{T,F,G}, ::MOI.NumberOfConstraints{G,MOI.RotatedSecondOrderCone}, ) where {T,F,G} - return length(b.socrc) + return Int64(length(b.socrc)) end function MOI.get( b::GeoMeanBridge{T,F,G}, ::MOI.NumberOfConstraints{G,MOI.Nonnegatives}, ) where {T,F,G} - return (b.d > 2 ? 0 : 1) + return Int64(b.d > 2 ? 0 : 1) end function MOI.get( b::GeoMeanBridge{T,F}, diff --git a/src/Bridges/Constraint/geomean_to_relentr.jl b/src/Bridges/Constraint/geomean_to_relentr.jl index b3c642598a..dfa0de1634 100644 --- a/src/Bridges/Constraint/geomean_to_relentr.jl +++ b/src/Bridges/Constraint/geomean_to_relentr.jl @@ -77,7 +77,7 @@ function concrete_bridge_type( end # Attributes, Bridge acting as a model -MOI.get(bridge::GeoMeantoRelEntrBridge, ::MOI.NumberOfVariables) = 1 +MOI.get(bridge::GeoMeantoRelEntrBridge, ::MOI.NumberOfVariables) = Int64(1) function MOI.get(bridge::GeoMeantoRelEntrBridge, ::MOI.ListOfVariableIndices) return [bridge.y] end @@ -85,13 +85,13 @@ function MOI.get( bridge::GeoMeantoRelEntrBridge{T,F}, ::MOI.NumberOfConstraints{F,MOI.Nonnegatives}, ) where {T,F} - return 1 + return Int64(1) end function MOI.get( bridge::GeoMeantoRelEntrBridge{T,F,G}, ::MOI.NumberOfConstraints{G,MOI.RelativeEntropyCone}, ) where {T,F,G} - return 1 + return Int64(1) end function MOI.get( bridge::GeoMeantoRelEntrBridge{T,F}, diff --git a/src/Bridges/Constraint/indicator_sos.jl b/src/Bridges/Constraint/indicator_sos.jl index 2b03f68634..14c0e3584c 100644 --- a/src/Bridges/Constraint/indicator_sos.jl +++ b/src/Bridges/Constraint/indicator_sos.jl @@ -155,7 +155,7 @@ end # Attributes, Bridge acting as a model function MOI.get(::IndicatorSOS1Bridge, ::MOI.NumberOfVariables) - return 1 + return Int64(1) end function MOI.get(b::IndicatorSOS1Bridge, ::MOI.ListOfVariableIndices) @@ -166,28 +166,28 @@ function MOI.get( ::IndicatorSOS1Bridge{T,BC,Nothing}, ::MOI.NumberOfConstraints{MOI.SingleVariable,BC}, ) where {T,BC} - return 0 + return Int64(0) end function MOI.get( ::IndicatorSOS1Bridge{T,BC,CI}, ::MOI.NumberOfConstraints{MOI.SingleVariable,BC}, ) where {T,BC,CI<:MOI.ConstraintIndex{MOI.SingleVariable,BC}} - return 1 + return Int64(1) end function MOI.get( ::IndicatorSOS1Bridge, ::MOI.NumberOfConstraints{MOI.VectorOfVariables,<:MOI.SOS1}, ) - return 1 + return Int64(1) end function MOI.get( ::IndicatorSOS1Bridge{T,BC}, ::MOI.NumberOfConstraints{MOI.ScalarAffineFunction{T},BC}, ) where {T,BC,CI<:MOI.ConstraintIndex{MOI.SingleVariable,BC}} - return 1 + return Int64(1) end function MOI.get( diff --git a/src/Bridges/Constraint/interval.jl b/src/Bridges/Constraint/interval.jl index 29e99313f4..7a14294716 100644 --- a/src/Bridges/Constraint/interval.jl +++ b/src/Bridges/Constraint/interval.jl @@ -81,13 +81,13 @@ function MOI.get( ::SplitIntervalBridge{T,F,S,LS}, ::MOI.NumberOfConstraints{F,LS}, ) where {T,F,S,LS} - return 1 + return Int64(1) end function MOI.get( ::SplitIntervalBridge{T,F,S,LS,US}, ::MOI.NumberOfConstraints{F,US}, ) where {T,F,S,LS,US} - return 1 + return Int64(1) end function MOI.get( bridge::SplitIntervalBridge{T,F,S,LS}, diff --git a/src/Bridges/Constraint/norm_spec_nuc_to_psd.jl b/src/Bridges/Constraint/norm_spec_nuc_to_psd.jl index a730e7a7d5..3b9b2a2852 100644 --- a/src/Bridges/Constraint/norm_spec_nuc_to_psd.jl +++ b/src/Bridges/Constraint/norm_spec_nuc_to_psd.jl @@ -69,7 +69,7 @@ function MOI.get( bridge::NormSpectralBridge{T,F,G}, ::MOI.NumberOfConstraints{F,MOI.PositiveSemidefiniteConeTriangle}, ) where {T,F,G} - return 1 + return Int64(1) end function MOI.get( bridge::NormSpectralBridge{T,F,G}, @@ -267,7 +267,7 @@ end # Attributes, Bridge acting as a model function MOI.get(bridge::NormNuclearBridge, ::MOI.NumberOfVariables) - return length(bridge.U) + length(bridge.V) + return Int64(length(bridge.U) + length(bridge.V)) end function MOI.get(bridge::NormNuclearBridge, ::MOI.ListOfVariableIndices) return vcat(bridge.U, bridge.V) @@ -276,13 +276,13 @@ function MOI.get( bridge::NormNuclearBridge{T,F,G,H}, ::MOI.NumberOfConstraints{F,MOI.GreaterThan{T}}, ) where {T,F,G,H} - return 1 + return Int64(1) end function MOI.get( bridge::NormNuclearBridge{T,F,G,H}, ::MOI.NumberOfConstraints{G,MOI.PositiveSemidefiniteConeTriangle}, ) where {T,F,G,H} - return 1 + return Int64(1) end function MOI.get( bridge::NormNuclearBridge{T,F,G,H}, diff --git a/src/Bridges/Constraint/norm_to_lp.jl b/src/Bridges/Constraint/norm_to_lp.jl index 90d02fb2c2..b54d06f6f4 100644 --- a/src/Bridges/Constraint/norm_to_lp.jl +++ b/src/Bridges/Constraint/norm_to_lp.jl @@ -135,13 +135,13 @@ function concrete_bridge_type( end # Attributes, Bridge acting as a model -MOI.get(b::NormOneBridge, ::MOI.NumberOfVariables) = length(b.y) +MOI.get(b::NormOneBridge, ::MOI.NumberOfVariables) = Int64(length(b.y)) MOI.get(b::NormOneBridge, ::MOI.ListOfVariableIndices) = b.y function MOI.get( b::NormOneBridge{T,F}, ::MOI.NumberOfConstraints{F,MOI.Nonnegatives}, ) where {T,F} - return 1 + return Int64(1) end function MOI.get( b::NormOneBridge{T,F}, diff --git a/src/Bridges/Constraint/quad_to_soc.jl b/src/Bridges/Constraint/quad_to_soc.jl index 979d58b1d8..fe0eca65a9 100644 --- a/src/Bridges/Constraint/quad_to_soc.jl +++ b/src/Bridges/Constraint/quad_to_soc.jl @@ -183,7 +183,7 @@ function MOI.get( MOI.RotatedSecondOrderCone, }, ) where {T} - return 1 + return Int64(1) end function MOI.get( bridge::QuadtoSOCBridge{T}, diff --git a/src/Bridges/Constraint/relentr_to_exp.jl b/src/Bridges/Constraint/relentr_to_exp.jl index 94a2518fbf..58b9e42ad5 100644 --- a/src/Bridges/Constraint/relentr_to_exp.jl +++ b/src/Bridges/Constraint/relentr_to_exp.jl @@ -78,20 +78,20 @@ end # Attributes, Bridge acting as a model function MOI.get(bridge::RelativeEntropyBridge, ::MOI.NumberOfVariables) - return length(bridge.y) + return Int64(length(bridge.y)) end MOI.get(bridge::RelativeEntropyBridge, ::MOI.ListOfVariableIndices) = bridge.y function MOI.get( bridge::RelativeEntropyBridge{T,F}, ::MOI.NumberOfConstraints{F,MOI.GreaterThan{T}}, ) where {T,F} - return 1 + return Int64(1) end function MOI.get( bridge::RelativeEntropyBridge{T,F,G}, ::MOI.NumberOfConstraints{G,MOI.ExponentialCone}, ) where {T,F,G} - return length(bridge.y) + return Int64(length(bridge.y)) end function MOI.get( bridge::RelativeEntropyBridge{T,F}, diff --git a/src/Bridges/Constraint/scalarize.jl b/src/Bridges/Constraint/scalarize.jl index b36886f147..b55fde502b 100644 --- a/src/Bridges/Constraint/scalarize.jl +++ b/src/Bridges/Constraint/scalarize.jl @@ -55,7 +55,7 @@ function MOI.get( bridge::ScalarizeBridge{T,F,S}, ::MOI.NumberOfConstraints{F,S}, ) where {T,F,S} - return length(bridge.scalar_constraints) + return Int64(length(bridge.scalar_constraints)) end function MOI.get( bridge::ScalarizeBridge{T,F,S}, diff --git a/src/Bridges/Constraint/semi_to_binary.jl b/src/Bridges/Constraint/semi_to_binary.jl index c4855ce50c..ee5635d910 100644 --- a/src/Bridges/Constraint/semi_to_binary.jl +++ b/src/Bridges/Constraint/semi_to_binary.jl @@ -216,7 +216,7 @@ end # Attributes, Bridge acting as a model function MOI.get(::SemiToBinaryBridge, ::MOI.NumberOfVariables) - return 1 + return Int64(1) end function MOI.get(b::SemiToBinaryBridge, ::MOI.ListOfVariableIndices) @@ -227,28 +227,28 @@ function MOI.get( ::SemiToBinaryBridge{T,S}, ::MOI.NumberOfConstraints{MOI.SingleVariable,MOI.ZeroOne}, ) where {T,S} - return 1 + return Int64(1) end function MOI.get( ::SemiToBinaryBridge{T,S}, ::MOI.NumberOfConstraints{MOI.SingleVariable,MOI.Integer}, ) where {T,S<:MOI.Semiinteger} - return 1 + return Int64(1) end function MOI.get( ::SemiToBinaryBridge{T,S}, ::MOI.NumberOfConstraints{MOI.ScalarAffineFunction{T},MOI.GreaterThan{T}}, ) where {T,S} - return 1 + return Int64(1) end function MOI.get( ::SemiToBinaryBridge{T,S}, ::MOI.NumberOfConstraints{MOI.ScalarAffineFunction{T},MOI.LessThan{T}}, ) where {T,S} - return 1 + return Int64(1) end function MOI.get( diff --git a/src/Bridges/Constraint/set_map.jl b/src/Bridges/Constraint/set_map.jl index 48a1be61de..6014d81bf6 100644 --- a/src/Bridges/Constraint/set_map.jl +++ b/src/Bridges/Constraint/set_map.jl @@ -39,7 +39,7 @@ function MOI.get( ::SetMapBridge{T,S2,S1,F}, ::MOI.NumberOfConstraints{F,S2}, ) where {T,S2,S1,F} - return 1 + return Int64(1) end function MOI.get( bridge::SetMapBridge{T,S2,S1,F}, diff --git a/src/Bridges/Constraint/slack.jl b/src/Bridges/Constraint/slack.jl index f9b2ac9d26..cbe6da8a8e 100644 --- a/src/Bridges/Constraint/slack.jl +++ b/src/Bridges/Constraint/slack.jl @@ -15,13 +15,13 @@ function MOI.get( ::AbstractSlackBridge{T,VF,ZS,F}, ::MOI.NumberOfConstraints{F,ZS}, ) where {T,VF,ZS,F} - return 1 + return Int64(1) end function MOI.get( ::AbstractSlackBridge{T,VF,ZS,F,S}, ::MOI.NumberOfConstraints{VF,S}, ) where {T,VF,ZS,F,S} - return 1 + return Int64(1) end function MOI.get( bridge::AbstractSlackBridge{T,VF,ZS,F}, @@ -200,7 +200,7 @@ function concrete_bridge_type( end # Attributes, Bridge acting as a model -MOI.get(b::ScalarSlackBridge, ::MOI.NumberOfVariables) = 1 +MOI.get(b::ScalarSlackBridge, ::MOI.NumberOfVariables) = Int64(1) MOI.get(b::ScalarSlackBridge, ::MOI.ListOfVariableIndices) = [b.slack] # Attributes, Bridge acting as a constraint @@ -289,7 +289,7 @@ function concrete_bridge_type( end # Attributes, Bridge acting as a model -MOI.get(b::VectorSlackBridge, ::MOI.NumberOfVariables) = length(b.slack) +MOI.get(b::VectorSlackBridge, ::MOI.NumberOfVariables) = Int64(length(b.slack)) MOI.get(b::VectorSlackBridge, ::MOI.ListOfVariableIndices) = b.slack # Attributes, Bridge acting as a constraint diff --git a/src/Bridges/Constraint/soc_to_nonconvex_quad.jl b/src/Bridges/Constraint/soc_to_nonconvex_quad.jl index f035f2d316..c04e96ca9b 100644 --- a/src/Bridges/Constraint/soc_to_nonconvex_quad.jl +++ b/src/Bridges/Constraint/soc_to_nonconvex_quad.jl @@ -168,7 +168,7 @@ function MOI.get( ::AbstractSOCtoNonConvexQuadBridge{T}, ::MOI.NumberOfConstraints{MOI.ScalarQuadraticFunction{T},MOI.LessThan{T}}, ) where {T} - return 1 + return Int64(1) end function MOI.get( @@ -185,7 +185,7 @@ function MOI.get( bridge::AbstractSOCtoNonConvexQuadBridge{T}, ::MOI.NumberOfConstraints{MOI.ScalarAffineFunction{T},MOI.GreaterThan{T}}, ) where {T} - return length(bridge.var_pos) + return Int64(length(bridge.var_pos)) end function MOI.get( diff --git a/src/Bridges/Constraint/square.jl b/src/Bridges/Constraint/square.jl index 9d3a7a89a4..3a0bf3e804 100644 --- a/src/Bridges/Constraint/square.jl +++ b/src/Bridges/Constraint/square.jl @@ -164,13 +164,13 @@ function MOI.get( ::SquareBridge{T,F,G,TT}, ::MOI.NumberOfConstraints{F,TT}, ) where {T,F,G,TT} - return 1 + return Int64(1) end function MOI.get( bridge::SquareBridge{T,F,G}, ::MOI.NumberOfConstraints{G,MOI.EqualTo{T}}, ) where {T,F,G} - return length(bridge.sym) + return Int64(length(bridge.sym)) end function MOI.get( bridge::SquareBridge{T,F,G,TT}, diff --git a/src/Bridges/Constraint/vectorize.jl b/src/Bridges/Constraint/vectorize.jl index 9c44cdbc3d..cfe3cf1181 100644 --- a/src/Bridges/Constraint/vectorize.jl +++ b/src/Bridges/Constraint/vectorize.jl @@ -75,7 +75,7 @@ function MOI.get( ::VectorizeBridge{T,F,S}, ::MOI.NumberOfConstraints{F,S}, ) where {T,F,S} - return 1 + return Int64(1) end function MOI.get( diff --git a/src/Bridges/Constraint/zero_one.jl b/src/Bridges/Constraint/zero_one.jl index 98747e6cad..cd18ab1761 100644 --- a/src/Bridges/Constraint/zero_one.jl +++ b/src/Bridges/Constraint/zero_one.jl @@ -102,14 +102,14 @@ function MOI.get( bridge::ZeroOneBridge{T}, ::MOI.NumberOfConstraints{MOI.SingleVariable,MOI.Interval{T}}, ) where {T} - return 1 + return Int64(1) end function MOI.get( bridge::ZeroOneBridge, ::MOI.NumberOfConstraints{MOI.SingleVariable,MOI.Integer}, ) - return 1 + return Int64(1) end function MOI.get( diff --git a/src/Bridges/Objective/functionize.jl b/src/Bridges/Objective/functionize.jl index f86c984c99..1b9f444aa4 100644 --- a/src/Bridges/Objective/functionize.jl +++ b/src/Bridges/Objective/functionize.jl @@ -35,7 +35,7 @@ end # Attributes, Bridge acting as a model function MOI.get(bridge::FunctionizeBridge, ::MOI.NumberOfVariables) - return 0 + return Int64(0) end function MOI.get(bridge::FunctionizeBridge, ::MOI.ListOfVariableIndices) return MOI.VariableIndex[] diff --git a/src/Bridges/Objective/slack.jl b/src/Bridges/Objective/slack.jl index 44307e4503..faeb229198 100644 --- a/src/Bridges/Objective/slack.jl +++ b/src/Bridges/Objective/slack.jl @@ -73,7 +73,7 @@ end # Attributes, Bridge acting as a model function MOI.get(bridge::SlackBridge, ::MOI.NumberOfVariables) - return 1 + return Int64(1) end function MOI.get(bridge::SlackBridge, ::MOI.ListOfVariableIndices) return [bridge.slack] @@ -82,7 +82,7 @@ function MOI.get( bridge::SlackBridge{T,F}, ::MOI.NumberOfConstraints{F,S}, ) where {T,F,S<:Union{MOI.GreaterThan{T},MOI.LessThan{T}}} - return bridge.constraint isa MOI.ConstraintIndex{F,S} ? 1 : 0 + return Int64(bridge.constraint isa MOI.ConstraintIndex{F,S} ? 1 : 0) end function MOI.get( bridge::SlackBridge{T,F}, diff --git a/src/Bridges/Variable/flip_sign.jl b/src/Bridges/Variable/flip_sign.jl index 12869a791d..62aec94ec3 100644 --- a/src/Bridges/Variable/flip_sign.jl +++ b/src/Bridges/Variable/flip_sign.jl @@ -26,7 +26,7 @@ end # Attributes, Bridge acting as a model function MOI.get(bridge::FlipSignBridge, ::MOI.NumberOfVariables) - return length(bridge.flipped_variables) + return Int64(length(bridge.flipped_variables)) end function MOI.get(bridge::FlipSignBridge, ::MOI.ListOfVariableIndices) return bridge.flipped_variables @@ -35,7 +35,7 @@ function MOI.get( ::FlipSignBridge{T,S1,S2}, ::MOI.NumberOfConstraints{MOI.VectorOfVariables,S2}, ) where {T,S1,S2<:MOI.AbstractVectorSet} - return 1 + return Int64(1) end function MOI.get( bridge::FlipSignBridge{T,S1,S2}, diff --git a/src/Bridges/Variable/free.jl b/src/Bridges/Variable/free.jl index d564d96832..ac7682a9fe 100644 --- a/src/Bridges/Variable/free.jl +++ b/src/Bridges/Variable/free.jl @@ -32,7 +32,7 @@ end # Attributes, Bridge acting as a model function MOI.get(bridge::FreeBridge, ::MOI.NumberOfVariables) - return length(bridge.variables) + return Int64(length(bridge.variables)) end function MOI.get(bridge::FreeBridge, ::MOI.ListOfVariableIndices) return vcat(bridge.variables) @@ -41,7 +41,7 @@ function MOI.get( bridge::FreeBridge, ::MOI.NumberOfConstraints{MOI.VectorOfVariables,MOI.Nonnegatives}, ) - return 1 + return Int64(1) end function MOI.get( bridge::FreeBridge, diff --git a/src/Bridges/Variable/rsoc_to_psd.jl b/src/Bridges/Variable/rsoc_to_psd.jl index 51c8319489..89259543f2 100644 --- a/src/Bridges/Variable/rsoc_to_psd.jl +++ b/src/Bridges/Variable/rsoc_to_psd.jl @@ -82,7 +82,7 @@ end # Attributes, Bridge acting as a model function MOI.get(bridge::RSOCtoPSDBridge, ::MOI.NumberOfVariables) - return length(bridge.variables) + return Int64(length(bridge.variables)) end function MOI.get(bridge::RSOCtoPSDBridge, ::MOI.ListOfVariableIndices) return bridge.variables @@ -91,7 +91,11 @@ function MOI.get( bridge::RSOCtoPSDBridge, ::MOI.NumberOfConstraints{MOI.VectorOfVariables,S}, ) where {S<:Union{MOI.PositiveSemidefiniteConeTriangle,MOI.Nonnegatives}} - return bridge.psd isa MOI.ConstraintIndex{MOI.VectorOfVariables,S} ? 1 : 0 + if bridge.psd isa MOI.ConstraintIndex{MOI.VectorOfVariables,S} + return Int64(1) + else + return Int64(0) + end end function MOI.get( bridge::RSOCtoPSDBridge, @@ -107,7 +111,7 @@ function MOI.get( bridge::RSOCtoPSDBridge{T}, ::MOI.NumberOfConstraints{MOI.SingleVariable,MOI.EqualTo{T}}, ) where {T} - return length(bridge.off_diag) + return Int64(length(bridge.off_diag)) end function MOI.get( bridge::RSOCtoPSDBridge{T}, @@ -119,7 +123,7 @@ function MOI.get( bridge::RSOCtoPSDBridge{T}, ::MOI.NumberOfConstraints{MOI.ScalarAffineFunction{T},MOI.EqualTo{T}}, ) where {T} - return length(bridge.diag) + return Int64(length(bridge.diag)) end function MOI.get( bridge::RSOCtoPSDBridge{T}, diff --git a/src/Bridges/Variable/rsoc_to_soc.jl b/src/Bridges/Variable/rsoc_to_soc.jl index 9a13e0021c..4290622f0c 100644 --- a/src/Bridges/Variable/rsoc_to_soc.jl +++ b/src/Bridges/Variable/rsoc_to_soc.jl @@ -102,7 +102,7 @@ end # Attributes, Bridge acting as a model function MOI.get(bridge::RSOCtoSOCBridge, ::MOI.NumberOfVariables) - return length(bridge.variables) + return Int64(length(bridge.variables)) end function MOI.get(bridge::RSOCtoSOCBridge, ::MOI.ListOfVariableIndices) return bridge.variables @@ -111,7 +111,7 @@ function MOI.get( bridge::RSOCtoSOCBridge, ::MOI.NumberOfConstraints{MOI.VectorOfVariables,MOI.SecondOrderCone}, ) - return 1 + return Int64(1) end function MOI.get( bridge::RSOCtoSOCBridge, diff --git a/src/Bridges/Variable/soc_to_rsoc.jl b/src/Bridges/Variable/soc_to_rsoc.jl index 34b4a25c9c..6e0d839ce8 100644 --- a/src/Bridges/Variable/soc_to_rsoc.jl +++ b/src/Bridges/Variable/soc_to_rsoc.jl @@ -37,7 +37,7 @@ end # Attributes, Bridge acting as a model function MOI.get(bridge::SOCtoRSOCBridge, ::MOI.NumberOfVariables) - return length(bridge.variables) + return Int64(length(bridge.variables)) end function MOI.get(bridge::SOCtoRSOCBridge, ::MOI.ListOfVariableIndices) return bridge.variables @@ -46,7 +46,7 @@ function MOI.get( bridge::SOCtoRSOCBridge, ::MOI.NumberOfConstraints{MOI.VectorOfVariables,MOI.RotatedSecondOrderCone}, ) - return 1 + return Int64(1) end function MOI.get( bridge::SOCtoRSOCBridge, diff --git a/src/Bridges/Variable/vectorize.jl b/src/Bridges/Variable/vectorize.jl index 1684ba36b5..a4af036cb3 100644 --- a/src/Bridges/Variable/vectorize.jl +++ b/src/Bridges/Variable/vectorize.jl @@ -45,7 +45,7 @@ end # Attributes, Bridge acting as a model function MOI.get(bridge::VectorizeBridge, ::MOI.NumberOfVariables) - return 1 + return Int64(1) end function MOI.get(bridge::VectorizeBridge, ::MOI.ListOfVariableIndices) return [bridge.variable] @@ -54,7 +54,7 @@ function MOI.get( ::VectorizeBridge{T,S}, ::MOI.NumberOfConstraints{MOI.VectorOfVariables,S}, ) where {T,S} - return 1 + return Int64(1) end function MOI.get( bridge::VectorizeBridge{T,S}, diff --git a/src/Bridges/Variable/zeros.jl b/src/Bridges/Variable/zeros.jl index 9be276edb5..36be138b37 100644 --- a/src/Bridges/Variable/zeros.jl +++ b/src/Bridges/Variable/zeros.jl @@ -35,7 +35,7 @@ function MOIB.added_constraint_types(::Type{<:ZerosBridge}) end # Attributes, Bridge acting as a model -MOI.get(bridge::ZerosBridge, ::MOI.NumberOfVariables) = 0 +MOI.get(bridge::ZerosBridge, ::MOI.NumberOfVariables) = Int64(0) function MOI.get(bridge::ZerosBridge, ::MOI.ListOfVariableIndices) return MOI.VariableIndex[] end diff --git a/src/Bridges/bridge.jl b/src/Bridges/bridge.jl index 6a844cb89e..c32761590f 100644 --- a/src/Bridges/bridge.jl +++ b/src/Bridges/bridge.jl @@ -24,7 +24,7 @@ abstract type AbstractBridge end The number of constraints of the type `F`-in-`S` created by the bridge `b` in the model. """ -MOI.get(::AbstractBridge, ::MOI.NumberOfConstraints) = 0 +MOI.get(::AbstractBridge, ::MOI.NumberOfConstraints) = Int64(0) """ MOI.get(b::AbstractBridge, ::MOI.ListOfConstraintIndices{F, S}) where {F, S} diff --git a/src/Bridges/bridge_optimizer.jl b/src/Bridges/bridge_optimizer.jl index 3949f148e4..498b625c90 100644 --- a/src/Bridges/bridge_optimizer.jl +++ b/src/Bridges/bridge_optimizer.jl @@ -656,7 +656,7 @@ function MOI.get(b::AbstractBridgeOptimizer, attr::MOI.NumberOfVariables) for bridge in values(Objective.bridges(b)) s -= MOI.get(bridge, attr) end - return s + return Int64(s) end # Number of all constraints, including those bridged @@ -693,7 +693,7 @@ function MOI.get( for bridge in values(Objective.bridges(b)) s -= MOI.get(bridge, attr) end - return s + return Int64(s) end function MOI.get(b::AbstractBridgeOptimizer, attr::MOI.ListOfConstraints) if Constraint.has_bridges(Constraint.bridges(b)) && diff --git a/src/Test/modellike.jl b/src/Test/modellike.jl index 9d51eda101..bbe70b2c42 100644 --- a/src/Test/modellike.jl +++ b/src/Test/modellike.jl @@ -466,7 +466,7 @@ abstract type BadModel <: MOI.ModelLike end function MOI.get(::BadModel, ::MOI.ListOfModelAttributesSet) return MOI.AbstractModelAttribute[] end -MOI.get(::BadModel, ::MOI.NumberOfVariables) = 1 +MOI.get(::BadModel, ::MOI.NumberOfVariables) = Int64(1) MOI.get(::BadModel, ::MOI.ListOfVariableIndices) = [MOI.VariableIndex(1)] function MOI.get(::BadModel, ::MOI.ListOfVariableAttributesSet) return MOI.AbstractVariableAttribute[] diff --git a/src/Utilities/model.jl b/src/Utilities/model.jl index b9472c0abd..b7141cc255 100644 --- a/src/Utilities/model.jl +++ b/src/Utilities/model.jl @@ -6,7 +6,7 @@ abstract type AbstractOptimizer{T} <: MOI.AbstractOptimizer end const AbstractModel{T} = Union{AbstractModelLike{T},AbstractOptimizer{T}} # Variables -function MOI.get(model::AbstractModel, ::MOI.NumberOfVariables) +function MOI.get(model::AbstractModel, ::MOI.NumberOfVariables)::Int64 if model.variable_indices === nothing return model.num_variables_created else @@ -605,13 +605,14 @@ function MOI.get( ::MOI.NumberOfConstraints{MOI.SingleVariable,S}, ) where {S} flag = single_variable_flag(S) - return count(mask -> !iszero(flag & mask), model.single_variable_mask) + n = count(mask -> !iszero(flag & mask), model.single_variable_mask), + return Int64(n) end function MOI.get( model::AbstractModel, noc::MOI.NumberOfConstraints{F,S}, ) where {F,S} - return MOI.get(model.constraints, noc) + return Int64(MOI.get(model.constraints, noc)) end function _add_contraint_type( diff --git a/src/Utilities/struct_of_constraints.jl b/src/Utilities/struct_of_constraints.jl index d4dade254d..fc0d3ca3e4 100644 --- a/src/Utilities/struct_of_constraints.jl +++ b/src/Utilities/struct_of_constraints.jl @@ -94,9 +94,9 @@ function MOI.get( noc::MOI.NumberOfConstraints{F,S}, ) where {F,S} if MOI.supports_constraint(model, F, S) - return MOI.get(constraints(model, F, S), noc) + return Int64(MOI.get(constraints(model, F, S), noc)) else - return 0 + return Int64(0) end end diff --git a/src/Utilities/universalfallback.jl b/src/Utilities/universalfallback.jl index e23bfcf611..e2c744c37f 100644 --- a/src/Utilities/universalfallback.jl +++ b/src/Utilities/universalfallback.jl @@ -315,7 +315,7 @@ end function MOI.get( uf::UniversalFallback, attr::MOI.NumberOfConstraints{MOI.SingleVariable,S}, -) where {S} +)::Int64 where {S} F = MOI.SingleVariable if MOI.supports_constraint(uf.model, F, S) return MOI.get(uf.model, attr) @@ -328,7 +328,7 @@ end function MOI.get( uf::UniversalFallback, attr::MOI.NumberOfConstraints{F,S}, -) where {F,S} +)::Int64 where {F,S} return MOI.get(constraints(uf, F, S), attr) end function MOI.get( diff --git a/src/Utilities/vector_of_constraints.jl b/src/Utilities/vector_of_constraints.jl index f46353dcdb..1116ff93ea 100644 --- a/src/Utilities/vector_of_constraints.jl +++ b/src/Utilities/vector_of_constraints.jl @@ -125,7 +125,7 @@ function MOI.get( v::VectorOfConstraints{F,S}, ::MOI.NumberOfConstraints{F,S}, ) where {F,S} - return length(v.constraints) + return Int64(length(v.constraints)) end function MOI.get( diff --git a/src/attributes.jl b/src/attributes.jl index 10c94a3216..5a5ad31fc5 100644 --- a/src/attributes.jl +++ b/src/attributes.jl @@ -875,7 +875,7 @@ attribute_value_type(::ObjectiveSense) = OptimizationSense A model attribute for the number of variables in the model. """ struct NumberOfVariables <: AbstractModelAttribute end -attribute_value_type(::NumberOfVariables) = Int +attribute_value_type(::NumberOfVariables) = Int64 """ ListOfVariableIndices() @@ -901,7 +901,7 @@ struct ListOfConstraintIndices{F,S} <: AbstractModelAttribute end A model attribute for the number of constraints of the type `F`-in-`S` present in the model. """ struct NumberOfConstraints{F,S} <: AbstractModelAttribute end -attribute_value_type(::NumberOfConstraints) = Int +attribute_value_type(::NumberOfConstraints) = Int64 """ ListOfConstraints()