Skip to content

Commit

Permalink
Test variable substitution for KernelBridge (#353)
Browse files Browse the repository at this point in the history
* Test variable substitution for KernelBridge

* Fix

* Fix format

* Fix

* Fix format
  • Loading branch information
blegat authored Jul 4, 2024
1 parent b9a03eb commit cf146a6
Showing 1 changed file with 27 additions and 8 deletions.
35 changes: 27 additions & 8 deletions test/Bridges/Variable/kernel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,48 @@ function test_runtests()
MOI.Bridges.runtests(
SumOfSquares.Bridges.Variable.KernelBridge,
model -> begin
MOI.add_constrained_variables(
p, _ = MOI.add_constrained_variables(
model,
SumOfSquares.WeightedSOSCone{
MOI.PositiveSemidefiniteConeTriangle,
}(
MB.SubBasis{MB.Monomial}([
x^4,
x^3 * y,
x^2 * y^2,
x * y^3,
y^4,
x * y^3,
x^2 * y^2,
x^3 * y,
x^4,
]),
[MB.SubBasis{MB.Monomial}([x^2, y^2, x * y])],
[MB.SubBasis{MB.Monomial}([y^2, x * y, x^2])],
[MB.algebra_element(1.0 * x^0 * y^0)],
),
)
a = float.(1:length(p))
MOI.add_constraint(
model,
MOI.Utilities.vectorize([a' * p]),
MOI.Zeros(1),
)
end,
model -> begin
Q, _ = MOI.add_constrained_variables(
q, _ = MOI.add_constrained_variables(
model,
MOI.PositiveSemidefiniteConeTriangle(3),
)
end,
a = float.(1:length(q))
MOI.add_constraint(
model,
MOI.Utilities.vectorize([
1.0 * q[1] +
4.0 * q[2] +
3.0 * (1.0q[3] + 2.0q[4]) +
8.0 * q[5] +
5.0 * q[6],
]),
MOI.Zeros(1),
)
end;
cannot_unbridge = true,
)
return
end
Expand Down

0 comments on commit cf146a6

Please sign in to comment.