Skip to content

Commit

Permalink
Fix doc
Browse files Browse the repository at this point in the history
  • Loading branch information
blegat committed Oct 19, 2023
1 parent 0a0b7fa commit 79de4ef
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 38 deletions.
3 changes: 1 addition & 2 deletions docs/src/extensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ solution_summary(model)
```

```@docs
MOI.set(::Manopt.JuMP_Optimizer, ::MOI.VariablePrimalStart, ::MOI.VariableIndex, ::Union{Real,Nothing})
MOI.dimension(::Manopt.JuMP_VectorizedManifold)
MOI.empty!(::Manopt.JuMP_Optimizer)
MOI.supports(::Manopt.JuMP_Optimizer, ::MOI.RawOptimizerAttribute)
Expand All @@ -85,6 +84,6 @@ MOI.supports_add_constrained_variables(::Manopt.JuMP_Optimizer, ::Type{<:Manopt.
MOI.add_constrained_variables(::Manopt.JuMP_Optimizer, ::Manopt.JuMP_VectorizedManifold)
MOI.is_valid(model::Manopt.JuMP_Optimizer, ::MOI.VariableIndex)
MOI.get(model::Manopt.JuMP_Optimizer, ::MOI.NumberOfVariables)
MOI.supports(::Manopt.JuMP_Optimizer, ::MOI.RawOptimizerAttribute)
MOI.supports(::Manopt.JuMP_Optimizer, ::MOI.VariablePrimalStart, ::Type{MOI.VariableIndex})
MOI.set(::Manopt.JuMP_Optimizer, ::MOI.VariablePrimalStart, ::MOI.VariableIndex, ::Union{Real,Nothing})
```
64 changes: 28 additions & 36 deletions ext/ManoptJuMPExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,12 @@ function __init__()
return nothing
end

"""
struct VectorizedManifold{M} <: MOI.AbstractVectorSet
manifold::M
end
Representation of points of `manifold` as a vector of `R^n` where `n` is
`MOI.dimension(VectorizedManifold(manifold))`.
"""
# struct VectorizedManifold{M} <: MOI.AbstractVectorSet
# manifold::M
# end
#
# Representation of points of `manifold` as a vector of `R^n` where `n` is
# `MOI.dimension(VectorizedManifold(manifold))`.
struct VectorizedManifold{M<:ManifoldsBase.AbstractManifold} <: MOI.AbstractVectorSet
manifold::M
end
Expand All @@ -49,23 +47,21 @@ function MOI.dimension(set::VectorizedManifold)
return prod(ManifoldsBase.representation_size(set.manifold))
end

"""
Manopt.ManoptJuMPExt.Optimizer()
Creates a new optimizer object for the [MathOptInterface](https://jump.dev/MathOptInterface.jl/) (MOI).
An alias `Manopt.JuMP_Optimizer` is defined for convenience.
The minimization of a function `f(X)` of an an array `X[1:n1,1:n2,...]`
over a manifold `M` starting at `X0`, can be modeled as follows:
```julia
using JuMP
model = Model(Manopt.JuMP_Optimizer)
@variable(model, X[i1=1:n1,i2=1:n2,...] in M, start = X0[i1,i2,...])
@objective(model, Min, f(X))
```
The optimizer assumes that `M` has a `Array` shape described
by `ManifoldsBase.representation_size`.
"""
# Manopt.ManoptJuMPExt.Optimizer()
#
# Creates a new optimizer object for the [MathOptInterface](https://jump.dev/MathOptInterface.jl/) (MOI).
# An alias `Manopt.JuMP_Optimizer` is defined for convenience.
#
# The minimization of a function `f(X)` of an an array `X[1:n1,1:n2,...]`
# over a manifold `M` starting at `X0`, can be modeled as follows:
# ```julia
# using JuMP
# model = Model(Manopt.JuMP_Optimizer)
# @variable(model, X[i1=1:n1,i2=1:n2,...] in M, start = X0[i1,i2,...])
# @objective(model, Min, f(X))
# ```
# The optimizer assumes that `M` has a `Array` shape described
# by `ManifoldsBase.representation_size`.
mutable struct Optimizer <: MOI.AbstractOptimizer
# Manifold in which all the decision variables leave
manifold::Union{Nothing,ManifoldsBase.AbstractManifold}
Expand Down Expand Up @@ -193,7 +189,7 @@ end
MOI.supports_add_constrained_variables(::Optimizer, ::Type{<:VectorizedManifold})
Return `true` indicating that `Manopt.Optimizer` support optimization on
variables constrained to belong in a vectorized manifold [`VectorizedManifold`](@ref).
variables constrained to belong in a vectorized manifold `VectorizedManifold`.
"""
function MOI.supports_add_constrained_variables(::Optimizer, ::Type{<:VectorizedManifold})
return true
Expand All @@ -205,7 +201,7 @@ end
Add `MOI.dimension(set)` variables constrained in `set` and return the list
of variable indices that can be used to reference them as well a constraint
index for the constraint enforcing the membership of the variables in the
[`VectorizedManifold`](@ref) `set`.
`VectorizedManifold` `set`.
"""
function MOI.add_constrained_variables(model::Optimizer, set::VectorizedManifold)
F = MOI.VectorOfVariables
Expand Down Expand Up @@ -241,7 +237,7 @@ end
MOI.get(model::Optimizer, ::MOI.NumberOfVariables)
Return the number of variables added in the model, this corresponds
to the [`MOI.dimension`](@ref) of the [`VectorizedManifold`](@ref).
to the [`MOI.dimension`](@ref) of the `VectorizedManifold`.
"""
function MOI.get(model::Optimizer, ::MOI.NumberOfVariables)
if isnothing(model.manifold)
Expand Down Expand Up @@ -271,7 +267,7 @@ end
Set the starting value of the variable of index `vi` to `value`. Note that if
`value` is `nothing` then it essentially unset any previous starting values set
and hence [`MOI.optimize!`](@ref) unless another starting value is set.
and hence `MOI.optimize!` unless another starting value is set.
"""
function MOI.set(
model::Optimizer,
Expand Down Expand Up @@ -362,13 +358,9 @@ function MOI.optimize!(model::Optimizer)
return nothing
end

"""
struct ArrayShape{N} <: JuMP.AbstractShape
size::NTuple{N,Int}
end
Shape of an `Array{T,N}` of size `size`.
"""
# struct ArrayShape{N} <: JuMP.AbstractShape
#
# Shape of an `Array{T,N}` of size `size`.
struct ArrayShape{N} <: JuMP.AbstractShape
size::NTuple{N,Int}
end
Expand Down

0 comments on commit 79de4ef

Please sign in to comment.