sage.features.lrs: Make it a JoinFeature of Lrs, LrsNash; use Executable.absolute_filename
mkoeppe opened this issue · 18 comments
... as suggested in #33167 comment:4
Then use Lrs().absolute_filename()
and LrsNash().absolute_filename() (see #31296).
This makes these parts of the Sage library fully functional even when not being run from within sage-env (which sets PATH). To test this on a system without system lrslib installed, after sage -i lrslib:
$ venv/bin/python3 -c 'from sage.all import *; print(polytopes.hypercube(3).volume(engine="lrs"))'
$ venv/bin/python3 -c 'from sage.all import *; A = matrix([[1, -1], [-1, 1]]); B = matrix([[-1, 1], [1, -1]]); matching_pennies = NormalFormGame([A, B]); print(matching_pennies.obtain_nash(algorithm="lrs"))'
Depends on #31296
CC: @mwageringel @seblabbe @dimpase @saraedum @dcoudert @kliem
Component: refactoring
Author: Matthias Koeppe
Branch/Commit: b65f6a6
Reviewer: Sébastien Labbé
Issue created by migration from https://trac.sagemath.org/ticket/33466
Description changed:
---
+++
@@ -1,4 +1,5 @@
... as suggested in [#33167 comment:4](https://github.com/sagemath/sage/issues/33167#comment:4)
-Then use `LrsNash().absolute_pathname()` (see #31296).
+Then use `Lrs().absolute_pathname()`
+ and `LrsNash().absolute_pathname()` (see #31296).
Last 10 new commits:
9fad95e | Merge #31292 |
a93e9af | src/sage/features/__init__.py: Simplify Executable.absolute_path |
5b25c1d | sage.features: Refactor StaticFile, Executable through a new base class FileFeature |
6c35717 | sage.features.FileFeature: Replace method absolute_path by absolute_filename, with deprecation |
9266709 | Merge #31292 |
a4d0ed6 | sage.interfaces.four_ti_2: Use Executable.absolute_filename |
4252ea3 | sage.sandpiles.sandpile: Use Executable.absolute_filename() when interfacing 4ti2 |
17b9fde | sage.interfaces.latte: Use Executable.absolute_filename |
5145cb3 | Merge #31296 |
2c58bc2 | src/sage/features/lrs.py: Make Lrslib a JoinFeature of Lrs and LrsNash, use Executable.absolute_filename |
Description changed:
---
+++
@@ -3,3 +3,11 @@
Then use `Lrs().absolute_pathname()`
and `LrsNash().absolute_pathname()` (see #31296).
+This makes these parts of the Sage library fully functional even when not being run from within sage-env (which sets `PATH`). To test this on a system without system lrslib installed, after `sage -i lrslib`:
+
+```
+$ venv/bin/python3 -c 'from sage.all import *; print(polytopes.hypercube(3).volume(engine="lrs"))'
+$ venv/bin/python3 -c 'from sage.all import *; A = matrix([[1, -1], [-1, 1]]); B = matrix([[-1, 1], [1, -1]]); matching_pennies = NormalFormGame([A, B]); print(matching_pennies.obtain_nash(algorithm="lrs"))'
+```
+
+Author: Matthias Koeppe
Description changed:
---
+++
@@ -1,7 +1,7 @@
... as suggested in [#33167 comment:4](https://github.com/sagemath/sage/issues/33167#comment:4)
-Then use `Lrs().absolute_pathname()`
- and `LrsNash().absolute_pathname()` (see #31296).
+Then use `Lrs().absolute_filename()`
+ and `LrsNash().absolute_filename()` (see #31296).
This makes these parts of the Sage library fully functional even when not being run from within sage-env (which sets `PATH`). To test this on a system without system lrslib installed, after `sage -i lrslib`:
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
58d1186 | src/sage/features/lrs.py: Make Lrslib a JoinFeature of Lrs and LrsNash, use Executable.absolute_filename |
1b90dd9 | sage.game_theory: Use LrsNash().absolute_filename() |
e244564 | Polyhedron_base._volume_lrs: Use Lrs().absolute_filename() |
b65f6a6 | src/sage/game_theory/normal_form_game.py: Fix import |
Rebased
Reviewer: Sébastien Labbé
All tests pass for me for the modified files with and without optional package lrslib. Patchbot is green.
Also, here is what I get:
$ venv/bin/python3 -c 'from sage.all import *; print(polytopes.hypercube(3).volume(engine="lrs"))'
8
$ venv/bin/python3 -c 'from sage.all import *; A = matrix([[1, -1], [-1, 1]]); B = matrix([[-1, 1], [1, -1]]); matching_pennies = NormalFormGame([A, B]); print(matching_pennies.obtain_nash(algorithm="lrs"))'
[[(1/2, 1/2), (1/2, 1/2)]]
Thank you!
Changed branch from u/mkoeppe/sage_features_lrs__make_it_a_joinfeature to b65f6a6