Skip to content

Commit

Permalink
Bump compat of DimensionalData (#3707)
Browse files Browse the repository at this point in the history
  • Loading branch information
odow authored Mar 11, 2024
1 parent d7c45a9 commit 0f917fa
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ DimensionalData = "0703355e-b756-11e9-17c0-8b28908087d0"
JuMPDimensionalDataExt = "DimensionalData"

[compat]
DimensionalData = "0.24, 0.25"
DimensionalData = "0.24, 0.25, 0.26.2"
LinearAlgebra = "<0.0.1, 1.6"
MacroTools = "0.5"
MathOptInterface = "1.25.2"
Expand Down
2 changes: 1 addition & 1 deletion docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ CDDLib = "=0.9.2"
CSV = "0.10"
Clarabel = "=0.6.0"
DataFrames = "1"
DimensionalData = "0.24"
DimensionalData = "0.26.2"
Distributions = "0.25"
Documenter = "=1.2.1"
DocumenterCitations = "1"
Expand Down
31 changes: 20 additions & 11 deletions docs/src/extensions/DimensionalData.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,16 @@ julia> @variable(
x[i = 2:4, j = ["a", "b"]] >= i,
container = DimensionalData.DimArray,
)
3×2 DimArray{VariableRef,2} with dimensions:
Dim{:i} Sampled{Int64} 2:4 ForwardOrdered Regular Points,
Dim{:j} Categorical{String} String["a", "b"] ForwardOrdered
"a" "b"
2 x[2,a] x[2,b]
3 x[3,a] x[3,b]
4 x[4,a] x[4,b]
╭─────────────────────────────╮
│ 3×2 DimArray{VariableRef,2} │
├─────────────────────────────┴─────────────────── dims ┐
↓ i Sampled{Int64} 2:4 ForwardOrdered Regular Points,
→ j Categorical{String} ["a", "b"] ForwardOrdered
└───────────────────────────────────────────────────────┘
↓ → "a" "b"
2 x[2,a] x[2,b]
3 x[3,a] x[3,b]
4 x[4,a] x[4,b]
```

Here `x` is a `DimensionalData.Dim` array object, so indexing uses the
Expand All @@ -69,8 +72,11 @@ julia> @expression(
sum(x[At(i), At(j)] for i in 2:4),
container = DimensionalData.DimArray,
)
2-element DimArray{AffExpr,1} with dimensions:
Dim{:j} Categorical{String} String["a", "b"] ForwardOrdered
╭───────────────────────────────╮
│ 2-element DimArray{AffExpr,1} │
├───────────────────────────────┴───────────── dims ┐
↓ j Categorical{String} ["a", "b"] ForwardOrdered
└───────────────────────────────────────────────────┘
"a" x[2,a] + x[3,a] + x[4,a]
"b" x[2,b] + x[3,b] + x[4,b]
```
Expand All @@ -82,8 +88,11 @@ julia> @constraint(
expr[At(j)] <= 1,
container = DimensionalData.DimArray,
)
2-element DimArray{ConstraintRef{Model, MathOptInterface.ConstraintIndex{MathOptInterface.ScalarAffineFunction{Float64}, MathOptInterface.LessThan{Float64}}, ScalarShape},1} with dimensions:
Dim{:j} Categorical{String} String["a", "b"] ForwardOrdered
╭──────────────────────────────────────────────────────────────────────────────╮
│ 2-element DimArray{ConstraintRef{Model, MathOptInterface.ConstraintIndex{MathOptInterface.ScalarAffineFunction{Float64}, MathOptInterface.LessThan{Float64}}, ScalarShape},1} │
├──────────────────────────────────────────────────────────────────────── dims ┤
↓ j Categorical{String} ["a", "b"] ForwardOrdered
└──────────────────────────────────────────────────────────────────────────────┘
"a" x[2,a] + x[3,a] + x[4,a] ≤ 1
"b" x[2,b] + x[3,b] + x[4,b] ≤ 1
```
Expand Down

0 comments on commit 0f917fa

Please sign in to comment.