coin-or / python-mip

Python-MIP: collection of Python tools for the modeling and solution of Mixed-Integer Linear programs
Eclipse Public License 2.0
513 stars 88 forks source link

Tests fail to find the symbol Osi_getIntegerTolerance in lib/libCbcSolver.so #382

Open yurivict opened 1 month ago

yurivict commented 1 month ago

Describe the bug /usr/local/lib/libCbcSolver.so was installed by the package coin-or-cbc-2.10.11, which is its latest release, but python-mip fails to find the Osi_getIntegerTolerance symbol in it:

________________________________________________________________ test_2dpack_mip[CBC-./test/data/two_dim_pack_60_10_20.json] ________________________________________________________________
[gw3] freebsd14 -- Python 3.9.18 /usr/local/bin/python3.9

solver = 'CBC', instance = './test/data/two_dim_pack_60_10_20.json'

    @skip_on(NotImplementedError)
    @pytest.mark.parametrize("solver, instance", product(SOLVERS, INSTS))
    def test_2dpack_mip(solver: str, instance: str):
        """tests the MIP solution of different 2D pack instances"""
        with open(instance, "r") as finst:
            data = json.load(finst)
            W = data["W"]
            w = data["w"]
            h = data["h"]
            z_relax = data["relax"]
            z_ub = data["best"]
            isopt = data["opt"]

>       mip = create_mip(solver, w, h, W, False)

test/two_dim_pack_test.py:72: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
test/mip_2d_pack.py:16: in create_mip
    m = Model(solver_name=solver)
mip/model.py:91: in __init__
    import mip.cbc
mip/cbc.py:608: in <module>
    Osi_getIntegerTolerance = cbclib.Osi_getIntegerTolerance
/usr/local/lib/python3.9/site-packages/cffi/api.py:912: in __getattr__
    make_accessor(name)
/usr/local/lib/python3.9/site-packages/cffi/api.py:908: in make_accessor
    accessors[name](name)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

name = 'Osi_getIntegerTolerance'

    def accessor_function(name):
        key = 'function ' + name
        tp, _ = ffi._parser._declarations[key]
        BType = ffi._get_cached_btype(tp)
>       value = backendlib.load_function(BType, name)
E       AttributeError: function/symbol 'Osi_getIntegerTolerance' not found in library '/usr/local/lib/libCbcSolver.so': Undefined symbol "Osi_getIntegerTolerance"

/usr/local/lib/python3.9/site-packages/cffi/api.py:838: AttributeError
_______________________________________________________________ test_2dpack_mip[CBC-./test/data/two_dim_pack_80_1000_20.json] _______________________________________________________________
[gw2] freebsd14 -- Python 3.9.18 /usr/local/bin/python3.9

solver = 'CBC', instance = './test/data/two_dim_pack_80_1000_20.json'

    @skip_on(NotImplementedError)
    @pytest.mark.parametrize("solver, instance", product(SOLVERS, INSTS))
    def test_2dpack_mip(solver: str, instance: str):
        """tests the MIP solution of different 2D pack instances"""
        with open(instance, "r") as finst:
            data = json.load(finst)
            W = data["W"]
            w = data["w"]
            h = data["h"]
            z_relax = data["relax"]
            z_ub = data["best"]
            isopt = data["opt"]

>       mip = create_mip(solver, w, h, W, False)

test/two_dim_pack_test.py:72: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
test/mip_2d_pack.py:16: in create_mip
    m = Model(solver_name=solver)
mip/model.py:91: in __init__
    import mip.cbc
mip/cbc.py:608: in <module>
    Osi_getIntegerTolerance = cbclib.Osi_getIntegerTolerance
/usr/local/lib/python3.9/site-packages/cffi/api.py:912: in __getattr__
    make_accessor(name)
/usr/local/lib/python3.9/site-packages/cffi/api.py:908: in make_accessor
    accessors[name](name)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

name = 'Osi_getIntegerTolerance'

    def accessor_function(name):
        key = 'function ' + name
        tp, _ = ffi._parser._declarations[key]
        BType = ffi._get_cached_btype(tp)
>       value = backendlib.load_function(BType, name)
E       AttributeError: function/symbol 'Osi_getIntegerTolerance' not found in library '/usr/local/lib/libCbcSolver.so': Undefined symbol "Osi_getIntegerTolerance"

To Reproduce Run pytest .

Desktop (please complete the following information):

Additional context Add any other context about the problem here.