PuLP 不与 Travis CI 合作?
PuLP not working with Travis CI?
我在我的项目中使用 PuLP,所有测试都在我的本地机器上通过。但是 当 Travis CI.
运行 时,所有涉及 PuLP 的测试都失败了
这是一个失败的例子:
=================================== FAILURES ===================================
___________________________ test_scipy_sparse_matrix ___________________________
def test_scipy_sparse_matrix():
cluster_object = MaxPRegionsExact()
cluster_object.fit_from_scipy_sparse_matrix(adj, attr,
spatially_extensive_attr,
> threshold=threshold)
region/max_p_regions/tests/test_exact.py:23:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
region/max_p_regions/exact.py:153: in fit_from_scipy_sparse_matrix
prob.solve(solver)
../../../virtualenv/python3.4.6/lib/python3.4/site-packages/pulp/pulp.py:1664: in solve
status = solver.actualSolve(self, **kwargs)
../../../virtualenv/python3.4.6/lib/python3.4/site-packages/pulp/solvers.py:1362: in actualSolve
return self.solve_CBC(lp, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pulp.solvers.COIN_CMD object at 0x7ff3e76ba9b0>
lp = Max-p-Regions:
MINIMIZE
50.29999999999968*t_(0,_1) + 80.59999999999991*t_(0,_2) + 140.19999999999993*t_(0,_3) + 60.699... <= x_(8,_8,_5) <= 1 Integer
0 <= x_(8,_8,_6) <= 1 Integer
0 <= x_(8,_8,_7) <= 1 Integer
0 <= x_(8,_8,_8) <= 1 Integer
use_mps = True
def solve_CBC(self, lp, use_mps=True):
"""Solve a MIP problem using CBC"""
if not self.executable(self.path):
raise PulpSolverError("Pulp: cannot execute %s cwd: %s"%(self.path,
> os.getcwd()))
E pulp.solvers.PulpSolverError: Pulp: cannot execute cbc cwd: /home/travis/build/yogabonito/region
../../../virtualenv/python3.4.6/lib/python3.4/site-packages/pulp/solvers.py:1372: PulpSolverError
----------------------------- Captured stdout call -----------------------------
start solving with <pulp.solvers.COIN_CMD object at 0x7ff3e76ba9b0>
虽然根据 PuLP-docs,Travis 似乎无法找到 CBC CMD 求解器 "included" / "bundled with pulp"。 (在我的本地机器上,我不必安装 CBC CMD 解算器。它是随 PuLP 自动安装的。)
我的问题是: 我怎样才能让 Travis CI 找到求解器?同样有趣:为什么我使用 Travis CI 时出现问题?
是的,当您通过 pip 安装时,pulp 会自动安装一个 cbc 版本。我怀疑 travis 环境不喜欢这种快捷安装方式。
通过 ssh 检查 cbc 可执行文件是否具有执行权限,如果不能的话。
1) 在travis中安装cbc apt-get install coinor-cbc
2) 使用'COIN_CMD'求解器求解
斯图
我在我的项目中使用 PuLP,所有测试都在我的本地机器上通过。但是 当 Travis CI.
运行 时,所有涉及 PuLP 的测试都失败了这是一个失败的例子:
=================================== FAILURES ===================================
___________________________ test_scipy_sparse_matrix ___________________________
def test_scipy_sparse_matrix():
cluster_object = MaxPRegionsExact()
cluster_object.fit_from_scipy_sparse_matrix(adj, attr,
spatially_extensive_attr,
> threshold=threshold)
region/max_p_regions/tests/test_exact.py:23:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
region/max_p_regions/exact.py:153: in fit_from_scipy_sparse_matrix
prob.solve(solver)
../../../virtualenv/python3.4.6/lib/python3.4/site-packages/pulp/pulp.py:1664: in solve
status = solver.actualSolve(self, **kwargs)
../../../virtualenv/python3.4.6/lib/python3.4/site-packages/pulp/solvers.py:1362: in actualSolve
return self.solve_CBC(lp, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pulp.solvers.COIN_CMD object at 0x7ff3e76ba9b0>
lp = Max-p-Regions:
MINIMIZE
50.29999999999968*t_(0,_1) + 80.59999999999991*t_(0,_2) + 140.19999999999993*t_(0,_3) + 60.699... <= x_(8,_8,_5) <= 1 Integer
0 <= x_(8,_8,_6) <= 1 Integer
0 <= x_(8,_8,_7) <= 1 Integer
0 <= x_(8,_8,_8) <= 1 Integer
use_mps = True
def solve_CBC(self, lp, use_mps=True):
"""Solve a MIP problem using CBC"""
if not self.executable(self.path):
raise PulpSolverError("Pulp: cannot execute %s cwd: %s"%(self.path,
> os.getcwd()))
E pulp.solvers.PulpSolverError: Pulp: cannot execute cbc cwd: /home/travis/build/yogabonito/region
../../../virtualenv/python3.4.6/lib/python3.4/site-packages/pulp/solvers.py:1372: PulpSolverError
----------------------------- Captured stdout call -----------------------------
start solving with <pulp.solvers.COIN_CMD object at 0x7ff3e76ba9b0>
虽然根据 PuLP-docs,Travis 似乎无法找到 CBC CMD 求解器 "included" / "bundled with pulp"。 (在我的本地机器上,我不必安装 CBC CMD 解算器。它是随 PuLP 自动安装的。)
我的问题是: 我怎样才能让 Travis CI 找到求解器?同样有趣:为什么我使用 Travis CI 时出现问题?
是的,当您通过 pip 安装时,pulp 会自动安装一个 cbc 版本。我怀疑 travis 环境不喜欢这种快捷安装方式。 通过 ssh 检查 cbc 可执行文件是否具有执行权限,如果不能的话。
1) 在travis中安装cbc apt-get install coinor-cbc
2) 使用'COIN_CMD'求解器求解
斯图