File tree Expand file tree Collapse file tree 2 files changed +23
-6
lines changed Expand file tree Collapse file tree 2 files changed +23
-6
lines changed Original file line number Diff line number Diff line change @@ -7,26 +7,30 @@ Abstract supertype for set objects used to encode constraints.
7
7
"""
8
8
abstract type AbstractSet end
9
9
10
+ """
11
+ dimension(s::AbstractSet)
12
+
13
+ Return the underlying dimension (number of vector components) in the set `s`, i.e.,
14
+ ``n`` if the set is a subset of ``\\ mathbb{R}^n``.
15
+ """
16
+ function dimension end
17
+
10
18
"""
11
19
AbstractScalarSet
12
20
13
21
Abstract supertype for subsets of ``\\ mathbb{R}``.
14
22
"""
15
23
abstract type AbstractScalarSet <: AbstractSet end
16
24
25
+ dimension (s:: AbstractScalarSet ) = 1
26
+
17
27
"""
18
28
AbstractVectorSet
19
29
20
30
Abstract supertype for subsets of ``\\ mathbb{R}^n`` for some ``n``.
21
31
"""
22
32
abstract type AbstractVectorSet <: AbstractSet end
23
33
24
- """
25
- dimension(s::AbstractVectorSet)
26
-
27
- Return the underlying dimension (number of vector components) in the set `s`, i.e.,
28
- ``n`` if the set is a subset of ``\\ mathbb{R}^n``.
29
- """
30
34
dimension (s:: AbstractVectorSet ) = s. dimension # .dimension field is conventional, overwrite this method if not applicable
31
35
32
36
"""
Original file line number Diff line number Diff line change 3
3
@test MOIU. getconstant (MOI. GreaterThan (6 )) == 6
4
4
@test MOIU. getconstant (MOI. LessThan (2 )) == 2
5
5
end
6
+
7
+ @testset " Set dimension" begin
8
+ @test MOI. dimension (MOI. EqualTo (3.0 )) === 1
9
+ @test MOI. dimension (MOI. Reals (8 )) === 8
10
+ @test MOI. dimension (MOI. DualExponentialCone ()) === 3
11
+ @test MOI. dimension (MOI. PositiveSemidefiniteConeTriangle (4 )) === 10
12
+ @test MOI. dimension (MOI. PositiveSemidefiniteConeSquare (5 )) === 25
13
+ @test MOI. dimension (MOI. RootDetConeTriangle (6 )) === 22
14
+ @test MOI. dimension (MOI. LogDetConeTriangle (6 )) === 22
15
+ @test MOI. dimension (MOI. RootDetConeSquare (4 )) === 17
16
+ @test MOI. dimension (MOI. LogDetConeSquare (4 )) === 17
17
+ @test MOI. dimension (MOI. SOS2 (collect (1 : 6 ))) === 6
18
+ end
You can’t perform that action at this time.
0 commit comments