Skip to content

Commit

Permalink
[docs] update docs to build on Julia 1.6 (#1570)
Browse files Browse the repository at this point in the history
  • Loading branch information
odow authored Sep 2, 2021
1 parent 5cdfac2 commit 9a54ba7
Show file tree
Hide file tree
Showing 13 changed files with 86 additions and 86 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ jobs:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@latest
with:
# Build documentation on Julia 1.0
version: '1.0'
# Build documentation on Julia 1.6
version: '1.6'
- name: Install dependencies
shell: julia --project=docs {0}
run: |
Expand Down
2 changes: 1 addition & 1 deletion docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ JSONSchema = "7d188eb4-7ad8-530c-ae41-71a32a6d4692"
MathOptInterface = "b8f27783-ece8-5eb3-8dc8-9495eed66fee"

[compat]
Documenter = "0.25"
Documenter = "0.27"
JSON = "0.21"
JSONSchema = "0.3"
8 changes: 4 additions & 4 deletions docs/src/manual/constraints.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Use [`add_constraint`](@ref) to add a single constraint.

```jldoctest constraints; setup=:(model = MOI.Utilities.Model{Float64}(); x = MOI.add_variables(model, 2))
julia> c = MOI.add_constraint(model, MOI.VectorOfVariables(x), MOI.Nonnegatives(2))
MathOptInterface.ConstraintIndex{MathOptInterface.VectorOfVariables,MathOptInterface.Nonnegatives}(1)
MathOptInterface.ConstraintIndex{MathOptInterface.VectorOfVariables, MathOptInterface.Nonnegatives}(1)
```

[`add_constraint`](@ref) returns a [`ConstraintIndex`](@ref) type, which should
Expand All @@ -36,9 +36,9 @@ julia> c = MOI.add_constraints(
[x[1], x[2]],
[MOI.GreaterThan(0.0), MOI.GreaterThan(1.0)]
)
2-element Array{MathOptInterface.ConstraintIndex{MathOptInterface.VariableIndex,MathOptInterface.GreaterThan{Float64}},1}:
MathOptInterface.ConstraintIndex{MathOptInterface.VariableIndex,MathOptInterface.GreaterThan{Float64}}(1)
MathOptInterface.ConstraintIndex{MathOptInterface.VariableIndex,MathOptInterface.GreaterThan{Float64}}(2)
2-element Vector{MathOptInterface.ConstraintIndex{MathOptInterface.VariableIndex, MathOptInterface.GreaterThan{Float64}}}:
MathOptInterface.ConstraintIndex{MathOptInterface.VariableIndex, MathOptInterface.GreaterThan{Float64}}(1)
MathOptInterface.ConstraintIndex{MathOptInterface.VariableIndex, MathOptInterface.GreaterThan{Float64}}(2)
```
This time, a vector of [`ConstraintIndex`](@ref) are returned.

Expand Down
14 changes: 7 additions & 7 deletions docs/src/manual/modification.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ julia> c = MOI.add_constraint(
MOI.ScalarAffineFunction([MOI.ScalarAffineTerm(1.0, x)], 0.0),
MOI.EqualTo(1.0),
)
MathOptInterface.ConstraintIndex{MathOptInterface.ScalarAffineFunction{Float64},MathOptInterface.EqualTo{Float64}}(1)
MathOptInterface.ConstraintIndex{MathOptInterface.ScalarAffineFunction{Float64}, MathOptInterface.EqualTo{Float64}}(1)
julia> MOI.set(model, MOI.ConstraintSet(), c, MOI.EqualTo(2.0));
Expand Down Expand Up @@ -66,7 +66,7 @@ julia> c = MOI.add_constraint(
MOI.ScalarAffineFunction([MOI.ScalarAffineTerm(1.0, x)], 0.0),
MOI.LessThan(1.0),
)
MathOptInterface.ConstraintIndex{MathOptInterface.ScalarAffineFunction{Float64},MathOptInterface.LessThan{Float64}}(1)
MathOptInterface.ConstraintIndex{MathOptInterface.ScalarAffineFunction{Float64}, MathOptInterface.LessThan{Float64}}(1)
julia> new_c = MOI.transform(model, c, MOI.GreaterThan(2.0));
Expand All @@ -92,7 +92,7 @@ julia> c = MOI.add_constraint(
MOI.ScalarAffineFunction([MOI.ScalarAffineTerm(1.0, x)], 0.0),
MOI.EqualTo(1.0),
)
MathOptInterface.ConstraintIndex{MathOptInterface.ScalarAffineFunction{Float64},MathOptInterface.EqualTo{Float64}}(1)
MathOptInterface.ConstraintIndex{MathOptInterface.ScalarAffineFunction{Float64}, MathOptInterface.EqualTo{Float64}}(1)
julia> new_f = MOI.ScalarAffineFunction([MOI.ScalarAffineTerm(2.0, x)], 1.0);
Expand Down Expand Up @@ -120,7 +120,7 @@ julia> c = MOI.add_constraint(
MOI.ScalarAffineFunction([MOI.ScalarAffineTerm(1.0, x)], 0.0),
MOI.EqualTo(1.0),
)
MathOptInterface.ConstraintIndex{MathOptInterface.ScalarAffineFunction{Float64},MathOptInterface.EqualTo{Float64}}(1)
MathOptInterface.ConstraintIndex{MathOptInterface.ScalarAffineFunction{Float64}, MathOptInterface.EqualTo{Float64}}(1)
julia> MOI.modify(model, c, MOI.ScalarConstantChange(1.0));
Expand Down Expand Up @@ -171,7 +171,7 @@ julia> c = MOI.add_constraint(
),
MOI.Nonnegatives(2),
)
MathOptInterface.ConstraintIndex{MathOptInterface.VectorAffineFunction{Float64},MathOptInterface.Nonnegatives}(1)
MathOptInterface.ConstraintIndex{MathOptInterface.VectorAffineFunction{Float64}, MathOptInterface.Nonnegatives}(1)
julia> MOI.modify(model, c, MOI.VectorConstantChange([3.0, 4.0]));
Expand All @@ -198,7 +198,7 @@ julia> c = MOI.add_constraint(
MOI.ScalarAffineFunction([MOI.ScalarAffineTerm(1.0, x)], 0.0),
MOI.EqualTo(1.0),
)
MathOptInterface.ConstraintIndex{MathOptInterface.ScalarAffineFunction{Float64},MathOptInterface.EqualTo{Float64}}(1)
MathOptInterface.ConstraintIndex{MathOptInterface.ScalarAffineFunction{Float64}, MathOptInterface.EqualTo{Float64}}(1)
julia> MOI.modify(model, c, MOI.ScalarCoefficientChange(x, 2.0));
Expand Down Expand Up @@ -229,7 +229,7 @@ julia> c = MOI.add_constraint(
),
MOI.Nonnegatives(2),
)
MathOptInterface.ConstraintIndex{MathOptInterface.VectorAffineFunction{Float64},MathOptInterface.Nonnegatives}(1)
MathOptInterface.ConstraintIndex{MathOptInterface.VectorAffineFunction{Float64}, MathOptInterface.Nonnegatives}(1)
julia> MOI.modify(model, c, MOI.MultirowChange(x, [(1, 3.0), (2, 4.0)]));
Expand Down
2 changes: 1 addition & 1 deletion docs/src/manual/variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ true
Use [`add_variables`](@ref) to add a number of variables.
```jldoctest variables
julia> y = MOI.add_variables(model, 2)
2-element Array{MathOptInterface.VariableIndex,1}:
2-element Vector{MathOptInterface.VariableIndex}:
MathOptInterface.VariableIndex(2)
MathOptInterface.VariableIndex(3)
```
Expand Down
6 changes: 3 additions & 3 deletions docs/src/submodules/Bridges/implementation.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ Bridges.Objective.bridge_objective
```

When querying the [`NumberOfVariables`](@ref), [`NumberOfConstraints`](@ref)
[`ListOfVariableIndices`](@ref), and [`ListOfConstraintIndices`](@ref), the
[`ListOfVariableIndices`](@ref), and [`ListOfConstraintIndices`](@ref), the
variables and constraints created by the bridges in the underlying model are
hidden by the bridge optimizer. For this purpose, the bridge should provide
access to the variables and constraints it has created by implementing the
access to the variables and constraints it has created by implementing the
following methods of [`get`](@ref):
```@docs
get(::Bridges.Constraint.AbstractBridge, ::NumberOfVariables)
Expand All @@ -49,7 +49,7 @@ get(::Bridges.AbstractBridge, ::ListOfConstraintIndices)
# SetMap bridges

Implementing a constraint bridge relying on linear transformation between two
sets is easier thanks to the [SetMap interface](constraint_set_map).
sets is easier thanks to the [SetMap interface](@ref constraint_set_map).
The bridge simply needs to be a subtype of [`Bridges.Variable.SetMapBridge`]
for a variable bridge and [`Bridges.Constraint.SetMapBridge`] for a constraint
bridge and the linear transformation is represented with
Expand Down
30 changes: 15 additions & 15 deletions docs/src/submodules/Bridges/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,14 @@ in a [`Bridges.full_bridge_optimizer`](@ref).

```jldoctest
julia> inner_optimizer = MOI.Utilities.Model{Float64}()
MOIU.GenericModel{Float64,MOIU.ObjectiveContainer{Float64},MOIU.VariablesContainer{Float64},MOIU.ModelFunctionConstraints{Float64}}
MOIU.Model{Float64}
julia> optimizer = MOI.Bridges.full_bridge_optimizer(inner_optimizer, Float64)
MOIB.LazyBridgeOptimizer{MOIU.GenericModel{Float64,MOIU.ObjectiveContainer{Float64},MOIU.VariablesContainer{Float64},MOIU.ModelFunctionConstraints{Float64}}}
MOIB.LazyBridgeOptimizer{MOIU.Model{Float64}}
with 0 variable bridges
with 0 constraint bridges
with 0 objective bridges
with inner model MOIU.GenericModel{Float64,MOIU.ObjectiveContainer{Float64},MOIU.VariablesContainer{Float64},MOIU.ModelFunctionConstraints{Float64}}
with inner model MOIU.Model{Float64}
```

That's all you have to do! Use `optimizer` as normal, and bridging will happen
Expand All @@ -136,25 +136,25 @@ However, this will force the constraint to be bridged, even if the

```jldoctest
julia> inner_optimizer = MOI.Utilities.Model{Float64}()
MOIU.GenericModel{Float64,MOIU.ObjectiveContainer{Float64},MOIU.VariablesContainer{Float64},MOIU.ModelFunctionConstraints{Float64}}
MOIU.Model{Float64}
julia> optimizer = MOI.Bridges.Constraint.SplitInterval{Float64}(inner_optimizer)
MOIB.Constraint.SingleBridgeOptimizer{MOIB.Constraint.SplitIntervalBridge{Float64,F,S,LS,US} where US<:MOI.AbstractSet where LS<:MOI.AbstractSet where S<:MOI.AbstractSet where F<:MOI.AbstractFunction,MOIU.GenericModel{Float64,MOIU.ObjectiveContainer{Float64},MOIU.VariablesContainer{Float64},MOIU.ModelFunctionConstraints{Float64}}}
MOIB.Constraint.SingleBridgeOptimizer{MOIB.Constraint.SplitIntervalBridge{Float64, F, S, LS, US} where {F<:MOI.AbstractFunction, S<:MOI.AbstractSet, LS<:MOI.AbstractSet, US<:MOI.AbstractSet}, MOIU.Model{Float64}}
with 0 constraint bridges
with inner model MOIU.GenericModel{Float64,MOIU.ObjectiveContainer{Float64},MOIU.VariablesContainer{Float64},MOIU.ModelFunctionConstraints{Float64}}
with inner model MOIU.Model{Float64}
julia> x = MOI.add_variable(optimizer)
MOI.VariableIndex(1)
julia> MOI.add_constraint(optimizer, x, MOI.Interval(0.0, 1.0))
MathOptInterface.ConstraintIndex{MathOptInterface.VariableIndex,MathOptInterface.Interval{Float64}}(1)
MathOptInterface.ConstraintIndex{MathOptInterface.VariableIndex, MathOptInterface.Interval{Float64}}(1)
julia> MOI.get(optimizer, MOI.ListOfConstraintTypesPresent())
1-element Array{Tuple{Type,Type},1}:
1-element Vector{Tuple{Type, Type}}:
(MathOptInterface.VariableIndex, MathOptInterface.Interval{Float64})
julia> MOI.get(inner_optimizer, MOI.ListOfConstraintTypesPresent())
2-element Array{Tuple{Type,Type},1}:
2-element Vector{Tuple{Type, Type}}:
(MathOptInterface.VariableIndex, MathOptInterface.GreaterThan{Float64})
(MathOptInterface.VariableIndex, MathOptInterface.LessThan{Float64})
```
Expand All @@ -168,14 +168,14 @@ manually construct a [`Bridges.LazyBridgeOptimizer`](@ref).
First, wrap an inner optimizer:
```jldoctest lazy_bridge_optimizer
julia> inner_optimizer = MOI.Utilities.Model{Float64}()
MOIU.GenericModel{Float64,MOIU.ObjectiveContainer{Float64},MOIU.VariablesContainer{Float64},MOIU.ModelFunctionConstraints{Float64}}
MOIU.Model{Float64}
julia> optimizer = MOI.Bridges.LazyBridgeOptimizer(inner_optimizer)
MOIB.LazyBridgeOptimizer{MOIU.GenericModel{Float64,MOIU.ObjectiveContainer{Float64},MOIU.VariablesContainer{Float64},MOIU.ModelFunctionConstraints{Float64}}}
MOIB.LazyBridgeOptimizer{MOIU.Model{Float64}}
with 0 variable bridges
with 0 constraint bridges
with 0 objective bridges
with inner model MOIU.GenericModel{Float64,MOIU.ObjectiveContainer{Float64},MOIU.VariablesContainer{Float64},MOIU.ModelFunctionConstraints{Float64}}
with inner model MOIU.Model{Float64}
```

Then use [`Bridges.add_bridge`](@ref) to add individual bridges:
Expand All @@ -191,13 +191,13 @@ julia> x = MOI.add_variable(optimizer)
MOI.VariableIndex(1)
julia> MOI.add_constraint(optimizer, x, MOI.Interval(0.0, 1.0))
MathOptInterface.ConstraintIndex{MathOptInterface.VariableIndex,MathOptInterface.Interval{Float64}}(1)
MathOptInterface.ConstraintIndex{MathOptInterface.VariableIndex, MathOptInterface.Interval{Float64}}(1)
julia> MOI.get(optimizer, MOI.ListOfConstraintTypesPresent())
1-element Array{Tuple{Type,Type},1}:
1-element Vector{Tuple{Type, Type}}:
(MathOptInterface.VariableIndex, MathOptInterface.Interval{Float64})
julia> MOI.get(inner_optimizer, MOI.ListOfConstraintTypesPresent())
1-element Array{Tuple{Type,Type},1}:
1-element Vector{Tuple{Type, Type}}:
(MathOptInterface.VariableIndex, MathOptInterface.Interval{Float64})
```
18 changes: 9 additions & 9 deletions docs/src/submodules/FileFormats/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ To write a model `src` to a [MathOptFormat file](https://jump.dev/MathOptFormat/
use:
```jldoctest fileformats
julia> src = MOI.Utilities.Model{Float64}()
MOIU.GenericModel{Float64,MOIU.ObjectiveContainer{Float64},MOIU.VariablesContainer{Float64},MOIU.ModelFunctionConstraints{Float64}}
MOIU.Model{Float64}
julia> MOI.add_variable(src)
MathOptInterface.VariableIndex(1)
Expand Down Expand Up @@ -108,7 +108,7 @@ A MathOptFormat Model
julia> MOI.read_from_file(dest, "file.mof.json")
julia> MOI.get(dest, MOI.ListOfVariableIndices())
1-element Array{MathOptInterface.VariableIndex,1}:
1-element Vector{MathOptInterface.VariableIndex}:
MathOptInterface.VariableIndex(1)
julia> rm("file.mof.json") # Clean up after ourselves.
Expand All @@ -122,27 +122,27 @@ guess the format from the file extension. For example:

```jldoctest fileformats
julia> src = MOI.Utilities.Model{Float64}()
MOIU.GenericModel{Float64,MOIU.ObjectiveContainer{Float64},MOIU.VariablesContainer{Float64},MOIU.ModelFunctionConstraints{Float64}}
MOIU.Model{Float64}
julia> dest = MOI.FileFormats.Model(filename = "file.cbf.gz")
A Conic Benchmark Format (CBF) model
julia> MOI.copy_to(dest, src)
MathOptInterface.Utilities.IndexMap with 0 entries
MathOptInterface.Utilities.IndexMap()
julia> MOI.write_to_file(dest, "file.cbf.gz")
julia> src_2 = MOI.FileFormats.Model(filename = "file.cbf.gz")
A Conic Benchmark Format (CBF) model
julia> src = MOI.Utilities.Model{Float64}()
MOIU.GenericModel{Float64,MOIU.ObjectiveContainer{Float64},MOIU.VariablesContainer{Float64},MOIU.ModelFunctionConstraints{Float64}}
MOIU.Model{Float64}
julia> dest = MOI.FileFormats.Model(filename = "file.cbf.gz")
A Conic Benchmark Format (CBF) model
julia> MOI.copy_to(dest, src)
MathOptInterface.Utilities.IndexMap with 0 entries
MathOptInterface.Utilities.IndexMap()
julia> MOI.write_to_file(dest, "file.cbf.gz")
Expand Down Expand Up @@ -180,13 +180,13 @@ In addition to [`write_to_file`](@ref) and [`read_from_file`](@ref), you can
read and write directly from `IO` streams using `Base.write` and `Base.read!`:
```jldoctest
julia> src = MOI.Utilities.Model{Float64}()
MOIU.GenericModel{Float64,MOIU.ObjectiveContainer{Float64},MOIU.VariablesContainer{Float64},MOIU.ModelFunctionConstraints{Float64}}
MOIU.Model{Float64}
julia> dest = MOI.FileFormats.Model(format = MOI.FileFormats.FORMAT_MPS)
A Mathematical Programming System (MPS) model
julia> MOI.copy_to(dest, src)
MathOptInterface.Utilities.IndexMap with 0 entries
MathOptInterface.Utilities.IndexMap()
julia> io = IOBuffer();
Expand Down Expand Up @@ -255,7 +255,7 @@ Use `JSONSchema.validate` to obtain more insight into why the validation failed:
julia> JSONSchema.validate(bad_model, schema)
Validation failed:
path: [variables][1]
instance: Dict{String,Any}("NaMe"=>"x")
instance: Dict{String, Any}("NaMe" => "x")
schema key: required
schema value: Any["name"]
```
Loading

0 comments on commit 9a54ba7

Please sign in to comment.