@@ -123,8 +123,7 @@ function MOI.get(
123123 if x === nothing
124124 return nothing
125125 end
126- @assert length (x) == 1
127- return x[1 ] + bridge. set_constant
126+ return only (x) + bridge. set_constant
128127end
129128
130129function MOI. get (
@@ -133,16 +132,15 @@ function MOI.get(
133132 bridge:: VectorizeBridge ,
134133)
135134 x = MOI. get (model, attr, bridge. vector_constraint)
136- @assert length (x) == 1
137135 if MOI. Utilities. is_ray (MOI. get (model, MOI. PrimalStatus (attr. result_index)))
138136 # If it is an infeasibility certificate, it is a ray and satisfies the
139137 # homogenized problem, see https://github.com/jump-dev/MathOptInterface.jl/issues/433
140- return x[ 1 ]
138+ return only (x)
141139 else
142140 # Otherwise, we need to add the set constant since the ConstraintPrimal
143141 # is defined as the value of the function and the set_constant was
144142 # removed from the original function
145- return x[ 1 ] + bridge. set_constant
143+ return only (x) + bridge. set_constant
146144 end
147145end
148146
@@ -180,8 +178,7 @@ function MOI.get(
180178 if x === nothing
181179 return nothing
182180 end
183- @assert length (x) == 1
184- return x[1 ]
181+ return only (x)
185182end
186183
187184function MOI. set (
@@ -235,8 +232,7 @@ function MOI.get(
235232 MOI. get (model, attr, bridge. vector_constraint),
236233 true ,
237234 )
238- @assert length (f) == 1
239- return convert (G, f[1 ])
235+ return convert (G, only (f))
240236end
241237
242238function MOI. get (
0 commit comments