funkelab / ilpy

Unified python wrappers for popular ILP solvers
https://funkelab.github.io/ilpy/
MIT License
3 stars 2 forks source link

Add functional `solve` API, use it for tests #22

Closed tlambert03 closed 1 year ago

tlambert03 commented 1 year ago

This includes #21 and would add a new functional ilpy.solve convenience function that, when used with expressions, can avoid a fair amount of boilerplate:

In [1]: import ilpy

In [2]: x = ilpy.Variable('x', index=0)

In [3]: ilpy.solve(x**2, constraints=[x>=3], sense='minimize', variable_type='integer')
Out[3]: [3.0]

it is also used in this PR for testing... adding a new Case tuple (like test case) that makes it easy to setup up testing a number of different programs

codecov-commenter commented 1 year ago

Codecov Report

Merging #22 (1c19b14) into main (9a74037) will decrease coverage by 1.33%. The diff coverage is 75.67%.

:mega: This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##             main      #22      +/-   ##
==========================================
- Coverage   86.10%   84.78%   -1.33%     
==========================================
  Files           3        4       +1     
  Lines         331      368      +37     
==========================================
+ Hits          285      312      +27     
- Misses         46       56      +10     
Impacted Files Coverage Δ
ilpy/_functional.py 74.28% <74.28%> (ø)
ilpy/__init__.py 84.61% <100.00%> (+2.79%) :arrow_up:

... and 1 file with indirect coverage changes

funkey commented 1 year ago

Beautiful, I like it! :)