My goal is to find the minimum of a certain function over the manifold of doubly stochastic matrices. I use the package Manopt (https://manoptjl.org/stable/) for this. The relevant part of my code looks like this:
using Random
using Graphs
using Manopt
using Manifolds
using LinearAlgebra
n = 8
G = DiGraph(n)
for i = 1:n
add_edge!(G, i%n +1, (i+1)%n +1)
add_edge!(G, (i+1)%n +1, i%n +1)
end
A = adjacency_matrix(G)
P_0 = A / 2
M = MultinomialMatrices(n, n)
f(M, p) = 0 #sum((P_0 - p).^ 2)
particle_swarm(M, f)
Of course I need to change f to a more complex function, however, the code is not even working in this case of f=0. I also tried using the Nelder Mead Method instead of the partical swarm, yielding the same error. The error is the following: "MethodError: rand!(::TaskLocalRNG, ::AbstractManifold, ::SubArray{Float64, 1, Matrix{Float64}, Tuple{Base.Slice{Base.OneTo{Int64}}, Int64}, true}) is ambiguous. Candidates: [...]" and it keeps on listing 50-70 candidates.
Does anyone know what I am doing wrong?
I tried using different manifolds to optimize over and the problem didn't occur in the case of "simpler" one (eg. the sphere). I tried using other methods for optimizing, none of them worked.
Aucun commentaire:
Enregistrer un commentaire