GLPK 安装错误

GLPK Installation Error

我正在 installing/setting 在 Windows 7 64 位 machine 上开发 Julia。我在安装 GLPK 包时遇到问题。到目前为止,我已经尝试完全重新安装 Julia,但没有成功。我尝试删除 .julia 文件夹和我的首选项,但没有成功。我总是收到以下错误:

julia> Pkg.build("GLPK")
INFO: Building GLPK
INFO: Attempting to Create directory C:\Users\Justin\.julia\v0.3\GLPK\deps\downl
oads
INFO: Directory C:\Users\Justin\.julia\v0.3\GLPK\deps\downloads already created
INFO: Downloading file http://downloads.sourceforge.net/project/winglpk/winglpk/
GLPK-4.52/winglpk-4.52.zip
INFO: Done downloading file http://downloads.sourceforge.net/project/winglpk/win
glpk/GLPK-4.52/winglpk-4.52.zip
INFO: Attempting to Create directory C:\Users\Justin\.julia\v0.3\GLPK\deps\src
INFO: Directory C:\Users\Justin\.julia\v0.3\GLPK\deps\src already created
INFO: Attempting to Create directory C:\Users\Justin\.julia\v0.3\GLPK\deps
INFO: Directory C:\Users\Justin\.julia\v0.3\GLPK\deps already created
INFO: Attempting to Create directory C:\Users\Justin\.julia\v0.3\GLPK\deps\src\g
lpk-4.52\w32

7-Zip [64] 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18

Processing archive: C:\Users\Justin\.julia\v0.3\GLPK\deps\downloads\winglpk-4.52
.zip

Error: Can not open file as archive

================================[ ERROR: GLPK ]=================================


failed process: Process(`7z x 'C:\Users\Justin\.julia\v0.3\GLPK\deps\downloads\w
inglpk-4.52.zip' -y '-oC:\Users\Justin\.julia\v0.3\GLPK\deps\src'`, ProcessExite
d(2)) [2]
while loading C:\Users\Justin\.julia\v0.3\GLPK\deps\build.jl, in expression star
ting on line 66

================================================================================


================================[ BUILD ERRORS ]================================


WARNING: GLPK had build errors.

 - packages with build errors remain installed in C:\Users\Justin\.julia\v0.3
 - build the package(s) and all dependencies with `Pkg.build("GLPK")`
 - build a single package by running its `deps/build.jl` script

================================================================================

在我看来,问题出在 'winglpk-4.52.zip' 上,如果我尝试直接访问并解压缩文件,我会收到一条错误消息,指出文件无效且 windows 无法打开.我尝试删除 GLPK 并从头开始,但也不走运。

有什么想法或建议吗?

更新:手动下载文件 'winglpk-4.52.zip' 并解压到位置 'C:\Users\Justin.julia\v0.3\GLPK\deps\src' 解决了问题。

但是,我收到另一个错误(不确定是否相关):

Cannot construct an affine expression with a term of type 
(GenericAffExpr{Float64,Variable})*(Float64)
while loading In[6], in expression starting on line 16

 in error at error.jl:21 (repeats 2 times)

此错误与命令有关:

@setObjective(myModel, Max, sum{x[i,j]*data[i,5], i=1:n,j=1:8});

我在 mac 上安装了 Julia,这不会报错..

第二个错误(来自 JuMP),看起来是因为您混淆了数据和变量 - 它需要是数据 * 变量(直到 Julia 0.4 发布并且可以修复!),即

@setObjective(myModel, Max, sum{data[i,5]*x[i,j], i=1:n,j=1:8});

我不确定为什么 7z 无法自动提取 GLPK,但您的修复很好。您可以使用 BinDeps.jl.

提交问题