File tree Expand file tree Collapse file tree 2 files changed +17
-13
lines changed Expand file tree Collapse file tree 2 files changed +17
-13
lines changed Original file line number Diff line number Diff line change @@ -78,15 +78,17 @@ function bridge_constraint(
78
78
F = try
79
79
LinearAlgebra. cholesky (LinearAlgebra. Symmetric (Q))
80
80
catch
81
- error ("""
82
- Unable to transform a quadratic constraint into a second-order cone
83
- constraint because the quadratic constraint is not strongly convex.
84
-
85
- Convex constraints that are not strongly convex (i.e., the matrix is
86
- positive semidefinite but not positive definite) are not supported
87
- yet.
88
-
89
- Note that a quadratic equality constraint is non-convex.""" )
81
+ throw (
82
+ MOI. UnsupportedConstraint {typeof(func),typeof(set)} (
83
+ " Unable to transform a quadratic constraint into a " *
84
+ " second-order cone constraint because the quadratic " *
85
+ " constraint is not strongly convex.\n\n Convex constraints " *
86
+ " that are not strongly convex (i.e., the matrix is positive " *
87
+ " semidefinite but not positive definite) are not supported " *
88
+ " yet.\n\n Note that a quadratic equality constraint is " *
89
+ " non-convex." ,
90
+ ),
91
+ )
90
92
end
91
93
# Construct the VectorAffineFunction. We're aiming for:
92
94
# | 1 |
Original file line number Diff line number Diff line change @@ -24,7 +24,8 @@ function test_error_for_nonconvex_quadratic_constraints()
24
24
mock = MOI. Utilities. MockOptimizer (MOI. Utilities. Model {Float64} ())
25
25
bridged_mock = MOI. Bridges. Constraint. QuadtoSOC {Float64} (mock)
26
26
x = MOI. add_variable (bridged_mock)
27
- @test_throws ErrorException begin
27
+ @test_throws (
28
+ MOI. UnsupportedConstraint,
28
29
MOI. add_constraint (
29
30
bridged_mock,
30
31
MOI. ScalarQuadraticFunction (
@@ -34,8 +35,9 @@ function test_error_for_nonconvex_quadratic_constraints()
34
35
),
35
36
MOI. GreaterThan (0.0 ),
36
37
)
37
- end
38
- @test_throws ErrorException begin
38
+ )
39
+ @test_throws (
40
+ MOI. UnsupportedConstraint,
39
41
MOI. add_constraint (
40
42
bridged_mock,
41
43
MOI. ScalarQuadraticFunction (
@@ -45,7 +47,7 @@ function test_error_for_nonconvex_quadratic_constraints()
45
47
),
46
48
MOI. LessThan (0.0 ),
47
49
)
48
- end
50
+ )
49
51
return
50
52
end
51
53
You can’t perform that action at this time.
0 commit comments