Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

enumerate integer points in a polytope

This is a followup question to http://ask.sagemath.org/question/23666/solving-system-of-linear-diophantine-equations/

$A$ is a $5 \times 19$ matrix. $S=${-1,0,1}. As suggessted in the solution I compute integral points within a polytope. I have the following code:

eq3=[ (0,6,10,10,6,6,6,3,3,0,3,21,21,0,0,3,3,3,3,3), (0,12,16,15,13,13,14,7,7,2,8,27,27,1,2,7,7,5,4,6), (0,6,13,10,9,9,12,6,6,4,10,14,14,0,1,7,7,6,3,3), (0,0,5,5,0,0,0,0,0,0,0,7,7,0,0,0,0,0,0,0), (0,0,3,2,1,1,2,1,1,1,2,2,2,0,0,1,1,1,0,0)];

ineq3=[ (-lb,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(ub,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), (-lb,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(ub,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), (-lb,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(ub,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), (-lb,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(ub,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), (-lb,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(ub,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0), (-lb,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0),(ub,0,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0), (-lb,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0),(ub,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0), (-lb,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0),(ub,0,0,0,0,0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have the code running for more than 6 hours on my laptop without any output.. Are there any tricks to make the computation faster? Can i keep printing the integral points as they are found?