简体   繁体   English

PuLP无法与Travis CI一起使用?

[英]PuLP not working with Travis CI?

I use PuLP in my project and all tests pass on my local machine . 我在项目中使用PuLP, 所有测试都在本地计算机上通过 But all tests involving PuLP fail when run by Travis CI . 但是由Travis CI运行时,所有涉及PuLP的测试都将失败

Here's an example failure: 这是一个失败示例:

=================================== 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>

It looks like Travis cannot find the CBC CMD solver although according to the PuLP-docs it is "included" / "bundled with pulp" . 看起来Travis找不到CBC CMD求解器,尽管根据PuLP文档,它是“包含” / “与纸浆捆绑在一起”的 (On my local machine I did not have to install the CBC CMD solver. It was installed automatically with PuLP.) (在本地计算机上,我不必安装CBC CMD求解器。它是与PuLP一起自动安装的。)

My question is: How can I make Travis CI find the solver? 我的问题是:如何使Travis CI找到求解器? Also interesting: Why did my problems using Travis CI occur? 同样有趣的是:为什么我在使用Travis CI时会出现问题?

Yes pulp does automatically install a version of cbc when you install it via pip. 是的,当您通过pip安装时,纸浆会自动安装cbc版本。 I suspect that the travis environment doesn't like this way to shortcut installs. 我怀疑travis环境不喜欢这种快捷方式安装方式。 Check via ssh that the cbc executable has execute permissions, if you can't do that. 如果不能执行此操作,请通过ssh检查cbc可执行文件是否具有执行权限。

1) install cbc in travis apt-get install coinor-cbc 1)在travis中安装cbc apt-get install coinor-cbc

2) use the 'COIN_CMD' solver to do the solving 2)使用“ COIN_CMD”求解器进行求解

Stu 斯图

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM