[back] [prev] [next] [index] [root]

 


SimplexInit

Initializes the enumeration of all integral points contained in a bounded simplex.

Syntax:

s := SimplexInit(A, b [ , delta ]);

Simplex
  s  
real matrix
  A  
A \in R^{m \times n}
real matrix
  b  
b \in R^{m}
real
  delta  
should be 1+\epsilon

See also:  SimplexNext, SimplexElt, SimplexReInit

Description:

Initializes the enumeration of all integral points contained in an bounded simplex. This function performs Fourier-Motzkin elimination to produce a triangular system. Be careful: The size of the system may be exponential in the number of initial constraints. A simplex s if defined as s := { x\in R^n | Ax <= b } where <= means <= componentwise. If delta is given, it is used as a correction for round-off errors. You may get points outside of s.


Example:

Find all x,y in {\Bbb Z}^2|{ >= 0} subject to x+y <= 3:

kash> A := Mat(R, [[1,1],[-1, 0],[0,-1]]);
[ 1  1]
[-1  0]
[ 0 -1]
kash> b := MatTrans(Mat(R, [[3, 0, 0]]));
[3]
[0]
[0]
kash> s := SimplexInit(A, b);;
kash> while SimplexNext(s) do Print(SimplexElt(s), "\n"); od;
> [ 0, 0 ]
[ 1, 0 ]
[ 2, 0 ]
[ 3, 0 ]
[ 0, 1 ]
[ 1, 1 ]
[ 2, 1 ]
[ 0, 2 ]
[ 1, 2 ]
[ 0, 3 ]


<- back[back] [prev] [next] [index] [root]