Skip to content

Commit b95a1a3

Browse files
committed
Fix format
1 parent 3e3670e commit b95a1a3

6 files changed

Lines changed: 15 additions & 48 deletions

File tree

src/Bridges/Constraint/zero_polynomial_in_algebraic_set.jl

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,7 @@ function MOI.Bridges.Constraint.bridge_constraint(
1919
::Type{ZeroPolynomialInAlgebraicSetBridge{T,F,Z,DT,B}},
2020
model::MOI.ModelLike,
2121
f::MOI.AbstractVectorFunction,
22-
s::PolyJuMP.ZeroPolynomialSet{
23-
<:SS.AbstractAlgebraicSet,
24-
Z,
25-
B,
26-
},
22+
s::PolyJuMP.ZeroPolynomialSet{<:SS.AbstractAlgebraicSet,Z,B},
2723
) where {T,F,Z,DT,B}
2824
p = MP.polynomial(MB.algebra_element(MOI.Utilities.scalarize(f), s.basis))
2925
# As `*(::MOI.ScalarAffineFunction{T}, ::S)` is only defined if `S == T`, we
@@ -65,14 +61,7 @@ end
6561
function MOI.Bridges.added_constraint_types(
6662
::Type{<:ZeroPolynomialInAlgebraicSetBridge{T,F,Z,DT,B}},
6763
) where {T,F,Z,DT,B}
68-
return [(
69-
F,
70-
PolyJuMP.ZeroPolynomialSet{
71-
SS.FullSpace,
72-
Z,
73-
B,
74-
},
75-
)]
64+
return [(F, PolyJuMP.ZeroPolynomialSet{SS.FullSpace,Z,B})]
7665
end
7766

7867
function MOI.Bridges.Constraint.concrete_bridge_type(
@@ -87,26 +76,15 @@ end
8776
# Attributes, Bridge acting as an model
8877
function MOI.get(
8978
::ZeroPolynomialInAlgebraicSetBridge{T,F,Z,DT,B},
90-
::MOI.NumberOfConstraints{
91-
F,
92-
PolyJuMP.ZeroPolynomialSet{
93-
SS.FullSpace,
94-
Z,
95-
B,
96-
},
97-
},
79+
::MOI.NumberOfConstraints{F,PolyJuMP.ZeroPolynomialSet{SS.FullSpace,Z,B}},
9880
) where {T,F,Z,DT,B}
9981
return 1
10082
end
10183
function MOI.get(
10284
b::ZeroPolynomialInAlgebraicSetBridge{T,F,Z,DT,B},
10385
::MOI.ListOfConstraintIndices{
10486
F,
105-
PolyJuMP.ZeroPolynomialSet{
106-
SS.FullSpace,
107-
Z,
108-
B,
109-
},
87+
PolyJuMP.ZeroPolynomialSet{SS.FullSpace,Z,B},
11088
},
11189
) where {T,F,Z,DT,B}
11290
return [b.zero_constraint]

src/SAGE/SAGE.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ struct Signomials{M<:Union{Nothing,Int,MP.AbstractMonomial}} <:
4141
end
4242
Signomials() = Signomials(nothing)
4343
_index(_, ::Nothing) = nothing
44-
_index(basis, mono::MP.AbstractMonomial) = SA.key_index(basis, MP.exponents(mono))::Int
44+
function _index(basis, mono::MP.AbstractMonomial)
45+
return SA.key_index(basis, MP.exponents(mono))::Int
46+
end
4547
function JuMP.moi_set(c::Signomials, basis::MB.SubBasis{MB.Monomial})
4648
monos = MB.keys_as_monomials(basis)
4749
return Cone(Signomials(_index(basis, c.monomial)), _exponents_matrix(monos))

test/Tests/zero_polynomial.jl

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,8 @@ function _zero_polynomial_test(
5353
F = MOI.VectorAffineFunction{Float64}
5454
full_basis_type = typeof(MB.FullBasis{MB.Monomial}(x))
5555
sub_basis_type = MB.explicit_basis_type(full_basis_type)
56-
ST = PolyJuMP.ZeroPolynomialSet{
57-
FullSpace,
58-
full_basis_type,
59-
sub_basis_type,
60-
}
61-
SP = PolyJuMP.ZeroPolynomialSet{
62-
FullSpace,
63-
full_basis_type,
64-
sub_basis_type,
65-
}
56+
ST = PolyJuMP.ZeroPolynomialSet{FullSpace,full_basis_type,sub_basis_type}
57+
SP = PolyJuMP.ZeroPolynomialSet{FullSpace,full_basis_type,sub_basis_type}
6658
@test Set(MOI.get(model, MOI.ListOfConstraintTypesPresent())) == Set([
6759
(MOI.VariableIndex, MOI.LessThan{Float64}),
6860
(F, SP),

test/Tests/zero_polynomial_in_algebraic_set.jl

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,8 @@ function zero_polynomial_in_algebraic_set_test(
5959
@test MOI.get(model, MOI.ListOfConstraintTypesPresent()) ==
6060
[(MOI.VariableIndex, MOI.LessThan{Float64}), (F, S)]
6161
@testset "Delete" begin
62-
ST = PolyJuMP.ZeroPolynomialSet{
63-
FullSpace,
64-
full_basis_type,
65-
sub_basis_type,
66-
}
62+
ST =
63+
PolyJuMP.ZeroPolynomialSet{FullSpace,full_basis_type,sub_basis_type}
6764
test_delete_bridge(model, cref, 2, ((F, MOI.Zeros, 0), (F, ST, 0)))
6865
end
6966
end

test/Tests/zero_polynomial_in_fixed_variables_set.jl

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,8 @@ function zero_polynomial_in_fixed_variables_set_test(
5959
@test MOI.get(model, MOI.ListOfConstraintTypesPresent()) ==
6060
[(MOI.VariableIndex, MOI.LessThan{Float64}), (F, S)]
6161
@testset "Delete" begin
62-
ST = PolyJuMP.ZeroPolynomialSet{
63-
FullSpace,
64-
full_basis_type,
65-
sub_basis_type,
66-
}
62+
ST =
63+
PolyJuMP.ZeroPolynomialSet{FullSpace,full_basis_type,sub_basis_type}
6764
test_delete_bridge(model, cref, 2, ((F, MOI.Zeros, 0), (F, ST, 0)))
6865
end
6966
end

test/constraint.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ function _test_constraint(
6262
set = JuMP.moi_set(c)
6363
@test set isa S
6464
if set isa PolyJuMP.ZeroPolynomialSet
65-
@test set.basis isa MB.SubBasis{MB.Monomial,typeof(MP.variables(set.basis))}
65+
@test set.basis isa
66+
MB.SubBasis{MB.Monomial,typeof(MP.variables(set.basis))}
6667
end
6768
if set isa PolyJuMP.PlusMinusSet
6869
set = set.set

0 commit comments

Comments
 (0)