Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Generating integral solutions to a system of linear inequalities

I was wondering whether there was a straightforward way in Sage to generate all integral solutions of a system of linear inequalities. I have talked to Nicolas Thiéry here at FPSAC/Sage days 103, and he showed me the interface to PALP, but said I should ask here.

I have programmed such a solver myself for the sage-drg package (availble on Github at jaanos/sage-drg - see the drg/find.py file, as I am not allowed to post links).

It is a solution generator (as opposed to a function returning all solutions) which uses Sage's integer linear programming facilities. It also supports adding conditions on-the-fly and making a copy of the generator.

I was thinking that it would be a nice addition to Sage (Mathematica has FindInstance, which does something similar) - unless something like this already exists. Of course, the interface should be made more user-friendly. I would also like to know if there is a better way of doing such a thing.

Generating integral solutions to a system of linear inequalities

I was wondering whether there was a straightforward way in Sage to generate all integral solutions of a system of linear inequalities. I have talked to Nicolas Thiéry here at FPSAC/Sage days 103, and he showed me the interface to PALP, but said I should ask here.

I have programmed such a solver myself for the sage-drg package (availble on Github at jaanos/sage-drg - see the drg/find.py file, as I am not allowed to post links).package:

https://github.com/jaanos/sage-drg/blob/master/drg/find.py

It is a solution generator (as opposed to a function returning all solutions) which uses Sage's integer linear programming facilities. It also supports adding conditions on-the-fly and making a copy of the generator.

I was thinking that it would be a nice addition to Sage (Mathematica has FindInstance, which does something similar) - unless something like this already exists. Of course, the interface should be made more user-friendly. I would also like to know if there is a better way of doing such a thing.