Skip to content

Commit c5bc60a

Browse files
committed
added index types
1 parent 7f2b091 commit c5bc60a

File tree

7 files changed

+66
-7
lines changed

7 files changed

+66
-7
lines changed

docs/make.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ const _PAGES = [
77
"Home" => "index.md",
88
"API Reference" => [
99
"reference/domains.md",
10+
"reference/algebraic.md",
11+
"reference/differentiable.md",
1012
],
1113
]
1214

docs/src/reference/algebraic.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
```@meta
2+
CurrentModule = DynOptInterface
3+
```
4+
5+
# Algebraic Variables
6+
7+
```@docs
8+
AlgebraicIndex
9+
```

docs/src/reference/differentiable.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
```@meta
2+
CurrentModule = DynOptInterface
3+
```
4+
5+
# Differentiable Variables
6+
7+
```@docs
8+
DifferentiableIndex
9+
```

docs/src/reference/domains.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,5 @@ CurrentModule = DynOptInterface
55
# Domains
66

77
```@docs
8-
AbstractDomain
98
DomainIndex
10-
supports_domain
11-
UnsupportedDomain
12-
AddDomainNotAllowed
13-
add_domain
14-
Interval
159
```

src/DynOptInterface.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ module DynOptInterface
22

33
import MathOptInterface as MOI
44

5-
include("domains.jl")
5+
include("indices.jl")
6+
67

78
end

src/functions.jl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"""
2+
ScalarNonlinearDOFunction(head::Sumbol, args::Vector{Any})
3+
4+
A scalar-valued nonlinear DO function `head(args...)`. Each argument must be one of the following:
5+
6+
* A constant value of type `T<:Real`
7+
* An `MOI.VariableIndex`
8+
* An `MOI.ScalarNonlinearFunction`
9+
* A [`DomainIndex`](@ref)
10+
* An [`AlgebraicIndex`](@ref)
11+
* A [`DifferentiableIndex`](@ref)
12+
"""
13+
struct ScalarNonlinearDOFunction
14+
head::Symbol
15+
args::Vector{Any}
16+
end

src/indices.jl

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
"""
2+
DomainIndex
3+
4+
A type-safe wrapper for `Int64` for use in referencing domains.
5+
"""
6+
struct DomainIndex
7+
value::Int64
8+
end
9+
10+
"""
11+
AlgebraicIndex
12+
13+
A type-safe wrapper for `Int64` for use in referencing algebraic variables.
14+
"""
15+
struct AlgebraicIndex
16+
value::Int64
17+
domain::DomainIndex
18+
end
19+
20+
"""
21+
DifferentiableIndex
22+
23+
A type-safe wrapper for `Int64` for use in referencing differentiable variables.
24+
"""
25+
struct DifferentiableIndex
26+
value::Int64
27+
domain::DomainIndex
28+
end

0 commit comments

Comments
 (0)