julia/JuMP:没有匹配 ndims 的方法

现在我想让自己更熟悉使用 julia/JuMP 的线性编程领域。更具体地说,我正在尝试实现弯曲分解的算法。由于我被困在某些部分,我想研究以前做过类似的其他实现。幸运的是,我可以在 JuMP 的官方教程部分找到一个:https://jump.dev/JuMP.jl/stable/tutorials/Optimization%20concepts/benders_decomposition/

https://github.com/jump-dev/JuMP.jl/blob/master/docs/src/tutorials/Optimization%20concepts/benders_decomposition.jl

不幸的是我不能执行它。它在第一次迭代中崩溃:

with fm_current = 1.0e6
x_current = [0.0,0.0]
ERROR: LoadError: MethodError: no method matching ndims(::AffExpr)
Closest candidates are:
  ndims(::GenericQuadExpr) at C:\Users\Laurenz\.julia\packages\JuMP\Xrr7O\src\quad_expr.jl:54
  ndims(::Base.Generator) at generator.jl:53
  ndims(::JuMP.Containers.VectorizedProductIterator) at C:\Users\Laurenz\.julia\packages\JuMP\Xrr7O\src\Containers\vectorized_product_iterator.jl:73
  ...
Stacktrace:

我所有的 julia 包都是最新的。

它在 MutableArithmetics.jl in this line:

中崩溃

也许有人已经在运行此代码,或者可以尝试运行它。将不胜感激! 谢谢:)

shanchuang2006 回答:julia/JuMP:没有匹配 ndims 的方法

它适用于 julia 1.5.4 和以下版本的软件包

(jump_playground) pkg> st
Status `C:\Projects\jump_playground\Project.toml`
  [60bf3e95] GLPK v0.14.12
  [4076af6c] JuMP v0.21.9
  [8dfed614] Test

有时当你更新包的版本时,你需要重新启动 julia REPL。此外,如果您使用的是较旧版本的 julia 或软件包,它可能无法正常工作,在这种情况下,最好使用 ] up 进行更新。

本文链接:https://www.f2er.com/17411.html

大家都在问