pylpsolve
pylpsolve copied to clipboard
Add Python 3 support
Seems to work fine!
In [1]: import pylpsolve as lp
In [2]: model = lp.LP()
In [5]: model.addConstraint([[1, 0], [0, 1], [1, -1], [-1, -1]], '>=', [0, 0, -3, -8])
Out[5]: [0, 1, 2, 3]
In [9]: model.setObjective([1, 2], mode='maximize')
In [11]: model.solve()
In [12]: model.getSolution()
Out[12]: array([ 2.5, 5.5])
In [13]: import sys
In [14]: sys.version
Out[14]: '3.5.1 |Continuum Analytics, Inc.| (default, Dec 7 2015, 11:16:01) \n[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)]'
After a bit more investigation, it seems that:
- the following test fails in both Python 2 and 3:
======================================================================
FAIL: testBasicBasis (test_basis.TestBases)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/groups/saalfeld/home/nuneziglesiasj/temp/pylpsolve/tests/test_basis.py", line 24, in testBasicBasis
self.assert_(lp.getInfo("Iterations") == 0, lp.getInfo("Iterations"))
AssertionError: False is not true : 2
----------------------------------------------------------------------
Ran 2631 tests in 1.263s
- the following test fails sporadically in Python 3 but passes in Python 2:
======================================================================
FAIL: testConstraints_d2 (test_minimal_lp.TestMinimal)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/groups/saalfeld/home/nuneziglesiasj/temp/pylpsolve/tests/test_minimal_lp.py", line 312, in testConstraints_d2
def testConstraints_d2(self): self.checkMinLP1("d2")
File "/groups/saalfeld/home/nuneziglesiasj/temp/pylpsolve/tests/test_minimal_lp.py", line 251, in checkMinLP1
self.assertAlmostEqual(lp.getSolution(0), 1)
AssertionError: 0.0 != 1 within 7 places
All other tests are passing so this is pretty close! Any ideas about fixing those two tests?
Thanks!
Hi folks, it doesn't look like this package is maintained anymore so I'm going to close this PR. Thanks for your work!