2

以下のJuliaコードを実行すると:

using Convex
using DataFrames
using SCS
using JuMP

dim = 5
A = rand(dim,dim);
B = rand(dim,dim);
m = Model(solver=SCSSolver(max_iters=5000,eps=1e-4));
@variable(m,X[i=1:dim,j=1:dim]);
@objective(m,Min, vecnorm(A*X'-X'*B) + vecnorm(X*A-B*X) + lmda*vecnorm(I-X));
for i=1:dim
    @constraint(m,sum(X[i,:]) == 1);
for j=1:dim
    @constraint(m,sum(X[:,j] == 1);
@constraint(m, X >= 0);
@constraint(m, X <= 1);
status = solve(m);
P = getvalue(X);

if status == :Infeasible
        error("No solution found!")
    else
        println("Objective Value: ", getobjectivevalue(m));
    println("P: ", P);

エラーが発生します:

ERROR: LoadError: MethodError: no method matching +(::JuMP.GenericNormExpr{2,Float64,JuMP.Variable}, ::JuMP.GenericNormExpr{2,Float64,JuMP.Variable})
Closest candidates are:
  +(::Any, ::Any, !Matched::Any, !Matched::Any...) at operators.jl:138
  +{C,V<:JuMP.Variable}(!Matched::JuMP.Variable, ::JuMP.GenericNormExpr{2,C,V<:JuMP.Variable})

何か助けはありますか?

4

0 に答える 0