Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sage.features.lrs: Make it a JoinFeature of Lrs, LrsNash; use Executable.absolute_filename #33466

Closed
mkoeppe opened this issue Mar 5, 2022 · 18 comments

Comments

@mkoeppe
Copy link
Contributor

mkoeppe commented Mar 5, 2022

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

@mkoeppe mkoeppe added this to the sage-9.6 milestone Mar 5, 2022
@mkoeppe
Copy link
Contributor Author

mkoeppe commented Mar 6, 2022

Dependencies: #31296

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Mar 6, 2022

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Mar 6, 2022

Commit: 2c58bc2

@mkoeppe

This comment has been minimized.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Mar 6, 2022

Last 10 new commits:

9fad95eMerge #31292
a93e9afsrc/sage/features/__init__.py: Simplify Executable.absolute_path
5b25c1dsage.features: Refactor StaticFile, Executable through a new base class FileFeature
6c35717sage.features.FileFeature: Replace method absolute_path by absolute_filename, with deprecation
9266709Merge #31292
a4d0ed6sage.interfaces.four_ti_2: Use Executable.absolute_filename
4252ea3sage.sandpiles.sandpile: Use Executable.absolute_filename() when interfacing 4ti2
17b9fdesage.interfaces.latte: Use Executable.absolute_filename
5145cb3Merge #31296
2c58bc2src/sage/features/lrs.py: Make Lrslib a JoinFeature of Lrs and LrsNash, use Executable.absolute_filename

@mkoeppe

This comment has been minimized.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 6, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

88bef23sage.game_theory: Use LrsNash().absolute_filename()
b1360f7Polyhedron_base._volume_lrs: Use Lrs().absolute_filename()
ec9bf39src/sage/game_theory/normal_form_game.py: Fix import

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 6, 2022

Changed commit from 2c58bc2 to ec9bf39

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Mar 6, 2022

Author: Matthias Koeppe

@mkoeppe

This comment has been minimized.

@mkoeppe mkoeppe changed the title sage.features.lrs: Make it a JoinFeature sage.features.lrs: Make it a JoinFeature of Lrs, LrsNash; use Executable.absolute_filename Mar 8, 2022
@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Apr 2, 2022

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

58d1186src/sage/features/lrs.py: Make Lrslib a JoinFeature of Lrs and LrsNash, use Executable.absolute_filename
1b90dd9sage.game_theory: Use LrsNash().absolute_filename()
e244564Polyhedron_base._volume_lrs: Use Lrs().absolute_filename()
b65f6a6src/sage/game_theory/normal_form_game.py: Fix import

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Apr 2, 2022

Changed commit from ec9bf39 to b65f6a6

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Apr 2, 2022

comment:12

Rebased

@seblabbe
Copy link
Contributor

seblabbe commented Apr 7, 2022

Reviewer: Sébastien Labbé

@seblabbe
Copy link
Contributor

seblabbe commented Apr 7, 2022

comment:13

All tests pass for me for the modified files with and without optional package lrslib. Patchbot is green.

@seblabbe
Copy link
Contributor

seblabbe commented Apr 7, 2022

comment:14

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)]]

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Apr 7, 2022

comment:15

Thank you!

@vbraun
Copy link
Member

vbraun commented Apr 10, 2022

Changed branch from u/mkoeppe/sage_features_lrs__make_it_a_joinfeature to b65f6a6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants