11export moments
22
3+ const _AE_APL = Union{SA. AlgebraElement,MP. AbstractPolynomialLike}
4+
35abstract type PolynomialSet end
46
57_in (:: MIME ) = Sys. iswindows () ? " in" : " ∈"
@@ -13,16 +15,10 @@ struct ZeroPoly <: PolynomialSet end
1315struct NonNegPoly <: PolynomialSet end
1416struct PosDefPolyMatrix <: PolynomialSet end
1517
16- function JuMP. function_string (
17- :: MIME"text/plain" ,
18- p:: Union{SA.AlgebraElement,MP.AbstractPolynomialLike} ,
19- )
18+ function JuMP. function_string (:: MIME"text/plain" , p:: _AE_APL )
2019 return sprint (show, MIME " text/plain" (), p)
2120end
22- function JuMP. function_string (
23- mime:: MIME"text/latex" ,
24- p:: Union{SA.AlgebraElement,MP.AbstractPolynomialLike} ,
25- )
21+ function JuMP. function_string (mime:: MIME"text/latex" , p:: _AE_APL )
2622 return SA. trim_LaTeX (mime, sprint (show, MIME " text/latex" (), p))
2723end
2824
@@ -203,7 +199,7 @@ non_constant_coefficients(p) = non_constant(MP.coefficients(p))
203199# # ZeroPoly
204200function JuMP. build_constraint (
205201 error_fn:: Function ,
206- p:: MP.AbstractPolynomialLike ,
202+ p:: _AE_APL ,
207203 s:: ZeroPoly ;
208204 domain:: SS.AbstractSemialgebraicSet = SS. FullSpace (),
209205 kws... ,
@@ -238,7 +234,7 @@ function JuMP.build_constraint(
238234end
239235function JuMP. build_constraint (
240236 error_fn:: Function ,
241- p:: MP.AbstractPolynomialLike ,
237+ p:: _AE_APL ,
242238 s:: MOI.EqualTo ;
243239 kws... ,
244240)
@@ -304,15 +300,15 @@ end
304300# `NonNegPoly`
305301function JuMP. build_constraint (
306302 error_fn:: Function ,
307- p:: MP.AbstractPolynomialLike ,
303+ p:: _AE_APL ,
308304 s:: MOI.GreaterThan ;
309305 kws... ,
310306)
311307 return JuMP. build_constraint (error_fn, p - s. lower, NonNegPoly (); kws... )
312308end
313309function JuMP. build_constraint (
314310 error_fn:: Function ,
315- p:: MP.AbstractPolynomialLike ,
311+ p:: _AE_APL ,
316312 s:: MOI.LessThan ;
317313 kws... ,
318314)
324320# need a more specific here to avoid ambiguity
325321function JuMP. build_constraint (
326322 error_fn:: Function ,
327- p:: AbstractMatrix{<:MP.AbstractPolynomialLike } ,
323+ p:: AbstractMatrix{<:_AE_APL } ,
328324 s:: PSDCone ;
329325 kws... ,
330326)
334330# Needed for the syntax `@constraint(model, A >= B, PSDCone())`
335331function JuMP. build_constraint (
336332 error_fn:: Function ,
337- f:: AbstractMatrix{<:MP.AbstractPolynomialLike } ,
333+ f:: AbstractMatrix{<:_AE_APL } ,
338334 s:: MOI.GreaterThan ,
339335 extra:: PSDCone ,
340336)
345341# Needed for the syntax `@constraint(model, A <= B, PSDCone())`
346342function JuMP. build_constraint (
347343 error_fn:: Function ,
348- f:: AbstractMatrix{<:MP.AbstractPolynomialLike } ,
344+ f:: AbstractMatrix{<:_AE_APL } ,
349345 s:: MOI.LessThan ,
350346 extra:: PSDCone ,
351347)
0 commit comments