  
  [1X6 [33X[0;0YPolyhedrons[133X[101X
  
  
  [1X6.1 [33X[0;0YCreating polyhedron[133X[101X
  
  [1X6.1-1 PolyhedronByInequalities[101X
  
  [33X[1;0Y[29X[2XPolyhedronByInequalities[102X( [3XL[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10Ya [10XPolyhedron[110X Object[133X
  
  [33X[0;0YThe  function  takes  a  list  of  lists  [10XL[110X[23X:=[L_1,  L_2, ...][123X where each [23XL_j[123X
  represents  an  inequality  and  returns the polyhedron defined by them. For
  example  the  [23Xj[123X'th entry [23XL_j = [c_j,a_{j1},a_{j2},...,a_{jn}][123X corresponds to
  the inequality [23Xc_j+\sum_{i=1}^n a_{ji}x_i \geq 0[123X.[133X
  
  [1X6.1-2 Polyhedron[101X
  
  [33X[1;0Y[29X[2XPolyhedron[102X( [3XP[103X, [3XC[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10Ya [10XPolyhedron[110X Object[133X
  
  [33X[0;0YThe input is a polytope [10XP[110X and a cone [10XC[110X. The output is the polyhedron defined
  by the Minkowski sum [10XP+C[110X.[133X
  
  [1X6.1-3 Polyhedron[101X
  
  [33X[1;0Y[29X[2XPolyhedron[102X( [3XL[103X, [3XC[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10Ya [10XPolyhedron[110X Object[133X
  
  [33X[0;0YThe  input is a list [10XL[110X and a cone [10XC[110X. The output is the polyhedron defined by
  the  Minkowski  sum  [10XP+C[110X  where  [10XP[110X  is  the polytope, i.e., the convex hull,
  defined by the points [10XL[110X.[133X
  
  [1X6.1-4 Polyhedron[101X
  
  [33X[1;0Y[29X[2XPolyhedron[102X( [3XP[103X, [3XL[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10Ya [10XPolyhedron[110X Object[133X
  
  [33X[0;0YThe input is a polytope [10XP[110X and a list [10XL[110X. The output is the polyhedron defined
  by the Minkowski sum [10XP+C[110X where [10XC[110X is the cone defined by the rays [10XL[110X.[133X
  
  [1X6.1-5 Polyhedron[101X
  
  [33X[1;0Y[29X[2XPolyhedron[102X( [3XP[103X, [3XC[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10Ya [10XPolyhedron[110X Object[133X
  
  [33X[0;0YThe  input is a list [10XP[110X and a list [10XC[110X. The output is the polyhedron defined by
  the Minkowski sum of the polytope defined by [10XP[110X and the cone defined by [10XC[110X.[133X
  
  
  [1X6.2 [33X[0;0YAttributes[133X[101X
  
  [1X6.2-1 ExternalCddPolyhedron[101X
  
  [33X[1;0Y[29X[2XExternalCddPolyhedron[102X( [3XP[103X ) [32X attribute[133X
  [6XReturns:[106X  [33X[0;10Ycdd Object[133X
  
  [33X[0;0YConverts  the polyhedron to a cdd object. The operations of CddInterface can
  then be applied on this convex object.[133X
  
  [1X6.2-2 ExternalNmzPolyhedron[101X
  
  [33X[1;0Y[29X[2XExternalNmzPolyhedron[102X( [3XP[103X ) [32X attribute[133X
  [6XReturns:[106X  [33X[0;10Ynormaliz Object[133X
  
  [33X[0;0YConverts   the   polyhedron   to  an  normaliz  object.  The  operations  of
  NormalizInterface can then be applied on this convex object.[133X
  
  [1X6.2-3 DefiningInequalities[101X
  
  [33X[1;0Y[29X[2XDefiningInequalities[102X( [3XP[103X ) [32X attribute[133X
  [6XReturns:[106X  [33X[0;10Ya list[133X
  
  [33X[0;0YReturns the Defining inequalities of the given polyhedron.[133X
  
  [1X6.2-4 MainRatPolytope[101X
  
  [33X[1;0Y[29X[2XMainRatPolytope[102X( [3XP[103X ) [32X attribute[133X
  [6XReturns:[106X  [33X[0;10Ya [10XPolytope[110X Object[133X
  
  [33X[0;0YReturns the main rational polytope of the polyhedron.[133X
  
  [1X6.2-5 MainPolytope[101X
  
  [33X[1;0Y[29X[2XMainPolytope[102X( [3XP[103X ) [32X attribute[133X
  [6XReturns:[106X  [33X[0;10Ya [10XPolytope[110X Object[133X
  
  [33X[0;0YReturns the main integral polytope of the given polyhedron.[133X
  
  [1X6.2-6 VerticesOfMainRatPolytope[101X
  
  [33X[1;0Y[29X[2XVerticesOfMainRatPolytope[102X( [3XP[103X ) [32X attribute[133X
  [6XReturns:[106X  [33X[0;10Ya list[133X
  
  [33X[0;0YReturns the vertices of the main rational polytope of the polyhedron.[133X
  
  [1X6.2-7 VerticesOfMainPolytope[101X
  
  [33X[1;0Y[29X[2XVerticesOfMainPolytope[102X( [3XP[103X ) [32X attribute[133X
  [6XReturns:[106X  [33X[0;10Ya list[133X
  
  [33X[0;0YReturns the vertices of the main integral polytope of the given polyhedron.[133X
  
  [1X6.2-8 TailCone[101X
  
  [33X[1;0Y[29X[2XTailCone[102X( [3XP[103X ) [32X attribute[133X
  [6XReturns:[106X  [33X[0;10Ya [10XCone[110X Object[133X
  
  [33X[0;0YReturns the tail cone of the polyhedron.[133X
  
  [1X6.2-9 RayGeneratorsOfTailCone[101X
  
  [33X[1;0Y[29X[2XRayGeneratorsOfTailCone[102X( [3XP[103X ) [32X attribute[133X
  [6XReturns:[106X  [33X[0;10Ya list[133X
  
  [33X[0;0YReturns the Ray Generators of the tail cone.[133X
  
  [1X6.2-10 LatticePointsGenerators[101X
  
  [33X[1;0Y[29X[2XLatticePointsGenerators[102X( [3XP[103X ) [32X attribute[133X
  [6XReturns:[106X  [33X[0;10Ya list[133X
  
  [33X[0;0YReturns  the  integral lattice generators of the polyhedron. The output is a
  list  [23XL[123X  of  length  [23X3[123X.  Any  integral point in polyhedron can be written as
  [23Xa+mb+nc[123X, where [23Xa\in L[1],b\in L[2],c\in L[3], m\geq 0[123X.[133X
  
  [1X6.2-11 BasisOfLinealitySpace[101X
  
  [33X[1;0Y[29X[2XBasisOfLinealitySpace[102X( [3XP[103X ) [32X attribute[133X
  [6XReturns:[106X  [33X[0;10Ya list[133X
  
  [33X[0;0YReturns  a  basis to the lineality space of the polyhedron. I.e., a basis to
  the vector space that is contained in [10XP[110X.[133X
  
  [1X6.2-12 FVector[101X
  
  [33X[1;0Y[29X[2XFVector[102X( [3XP[103X ) [32X attribute[133X
  [6XReturns:[106X  [33X[0;10Ya list[133X
  
  [33X[0;0YReturns a list whose [23Xi[123X'th entry is the number of faces of dimension [23Xi-1[123X.[133X
  
  
  [1X6.3 [33X[0;0YProperties[133X[101X
  
  [1X6.3-1 IsBounded[101X
  
  [33X[1;0Y[29X[2XIsBounded[102X( [3XP[103X ) [32X property[133X
  [6XReturns:[106X  [33X[0;10Ytrue or false[133X
  
  [33X[0;0YThe input is a polyhedron P and the output is whether it is bounded or not.[133X
  
  [1X6.3-2 IsPointed[101X
  
  [33X[1;0Y[29X[2XIsPointed[102X( [3XP[103X ) [32X property[133X
  [6XReturns:[106X  [33X[0;10Ytrue or false[133X
  
  [33X[0;0YThe  input  is  a  polyhedron  P  and the output is whether its tail cone is
  pointed or not.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XP := Polyhedron( [ [ 1, 1 ], [ 4, 7 ] ], [ [ 1, -1 ], [ 1, 1 ] ] );[127X[104X
    [4X[28X<A polyhedron in |R^2>[128X[104X
    [4X[25Xgap>[125X [27XVerticesOfMainRatPolytope( P );[127X[104X
    [4X[28X[ [ 1, 1 ], [ 4, 7 ] ][128X[104X
    [4X[25Xgap>[125X [27XVerticesOfMainPolytope( P );[127X[104X
    [4X[28X[ [ 1, 1 ], [ 4, 7 ] ][128X[104X
    [4X[25Xgap>[125X [27XP := Polyhedron( [ [ 1/2, 1/2 ] ], [ [ 1, 1 ] ] );[127X[104X
    [4X[28X<A polyhedron in |R^2>[128X[104X
    [4X[25Xgap>[125X [27XVerticesOfMainRatPolytope( P );[127X[104X
    [4X[28X[ [ 1/2, 1/2 ] ][128X[104X
    [4X[25Xgap>[125X [27XVerticesOfMainPolytope( P );[127X[104X
    [4X[28X[ [ 1, 1 ] ][128X[104X
    [4X[25Xgap>[125X [27XLatticePointsGenerators( P );[127X[104X
    [4X[28X[ [ [ 1, 1 ] ], [ [ 1, 1 ] ], [  ] ][128X[104X
    [4X[25Xgap>[125X [27XDimension( P );[127X[104X
    [4X[28X1[128X[104X
    [4X[25Xgap>[125X [27XQ := Polyhedron( [ [ 5, 0 ], [ 0, 6 ] ], [ [ 1, 2 ] , [ -1, -2 ] ] );[127X[104X
    [4X[28X<A polyhedron in |R^2>[128X[104X
    [4X[25Xgap>[125X [27XVerticesOfMainRatPolytope( Q );[127X[104X
    [4X[28X[ [ 0, 6 ], [ 5, 0 ] ][128X[104X
    [4X[25Xgap>[125X [27XV := VerticesOfMainPolytope( Q );[127X[104X
    [4X[28X[ [ 0, 6 ], [ 5, 0 ] ][128X[104X
    [4X[25Xgap>[125X [27XL := LatticePointsGenerators( Q );[127X[104X
    [4X[28X[ [ [ 0, -10 ], [ 0, -9 ], [ 0, -8 ], [ 0, -7 ], [ 0, -6 ],[128X[104X
    [4X[28X[ 0, -5 ], [ 0, -4 ], [ 0, -3 ], [ 0, -2 ], [ 0, -1 ],[128X[104X
    [4X[28X[ 0, 0 ], [ 0, 1 ], [ 0, 2 ], [ 0, 3 ], [ 0, 4 ],[128X[104X
    [4X[28X[ 0, 5 ], [ 0, 6 ] ], [  ], [ [ 1, 2 ] ] ][128X[104X
    [4X[25Xgap>[125X [27XDimension( Q );[127X[104X
    [4X[28X2[128X[104X
    [4X[25Xgap>[125X [27XRayGeneratorsOfTailCone( Q );[127X[104X
    [4X[28X[ [ -1, -2 ], [ 1, 2 ] ][128X[104X
    [4X[25Xgap>[125X [27XBasisOfLinealitySpace( Q );[127X[104X
    [4X[28X[ [ 1, 2 ] ][128X[104X
    [4X[25Xgap>[125X [27XDefiningInequalities( Q );[127X[104X
    [4X[28X[ [ 6, 2, -1 ], [ 10, -2, 1 ] ][128X[104X
    [4X[25Xgap>[125X [27XQ;[127X[104X
    [4X[28X<A polyhedron in |R^2 of dimension 2>[128X[104X
  [4X[32X[104X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XP := PolyhedronByInequalities( [ [ -2, 3, 4, -7 ], -[ -2, 3, 4, -7 ] ] );[127X[104X
    [4X[28X<A polyhedron in |R^3 >[128X[104X
    [4X[25Xgap>[125X [27XL := LatticePointsGenerators( P );[127X[104X
    [4X[28X[ [ [ -4, 0, -2 ] ], [  ], [ [ 0, 7, 4 ], [ 1, 1, 1 ] ] ][128X[104X
  [4X[32X[104X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XQ := PolyhedronByInequalities( [ [-3, 4, 6 ], [ 3, -4, -6 ] ] );[127X[104X
    [4X[28X<A polyhedron in |R^2 >[128X[104X
    [4X[25Xgap>[125X [27XLatticePointsGenerators( Q );[127X[104X
    [4X[28X[ [  ], [  ], [ [ 3, -2 ] ] ][128X[104X
  [4X[32X[104X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XP := PolyhedronByInequalities( [ [ -1, 2, 3, 2, 0 ], [ -3, 7, 1, 0, 5 ],[127X[104X
    [4X[25X>[125X [27X      [ 1, -2, -3, -2, 0 ], [ 3, -7, -1, 0, -5 ] ] );[127X[104X
    [4X[28X<A polyhedron in |R^4 >[128X[104X
    [4X[25Xgap>[125X [27XL := LatticePointsGenerators( P );[127X[104X
    [4X[28X[ [ [ -19, 1, 18, 27 ] ], [  ], [ [ 0, 10, -15, -2 ], [ 1, -2, 2, -1 ] ] ][128X[104X
  [4X[32X[104X
  
  
  [1X6.4 [33X[0;0YSolving Linear programs[133X[101X
  
  [33X[0;0YThe  problem  of  solving  linear  programs can be solved in the gap package
  [10XCddInterface[110X, which is required by [10XNConvex[110X.[133X
  
  [1X6.4-1 SolveLinearProgram[101X
  
  [33X[1;0Y[29X[2XSolveLinearProgram[102X( [3XP[103X, [3Xmax_or_min[103X, [3Xtarget_func[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10Ya list or fail[133X
  
  [33X[0;0YThe  input  is a polyhedron [10XP[110X, a string [10Xmax_or_min[110X [23X\in[123X {"max", "min"} and an
  objective  function  [10Xtarget_func[110X,  which we want to maximize or minimize. If
  the  linear program has an optimal solution, the operation returns a list of
  two  entries,  the  solution  vector  and the optimal value of the objective
  function, otherwise it returns fail.[133X
  
  [1X6.4-2 SolveLinearProgram[101X
  
  [33X[1;0Y[29X[2XSolveLinearProgram[102X( [3XP[103X, [3Xmax_or_min[103X, [3Xtarget_func[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10Ya list or fail[133X
  
  [33X[0;0YThe  input  is  a  polytope  [10XP[110X, a string [10Xmax_or_min[110X [23X\in[123X {"max","min"} and an
  objective  function  [10Xtarget_func[110X,  which we want to maximize or minimize. If
  the  linear program has an optimal solution, the operation returns a list of
  two  entries,  the  solution  vector  and the optimal value of the objective
  function, otherwise it returns fail.[133X
  
  [33X[0;0Y[23X\newline[123X  To illustrate the using of this operation, let us solve the linear
  program: [23X\\P(x,y)= 1-2x+5y[123X, with [23X\newline[123X [23X100\leq x \leq 200 \newline[123X [23X80\leq
  y\leq  170  \newline[123X [23Xy \geq -x+200\newline\newline[123X We bring the inequalities
  to  the form [23Xb+AX\geq 0[123X, we get: [23X\newline -100+x\geq 0 \newline[123X [23X200-x \geq 0
  \newline[123X  [23X-80+y  \geq  0  \newline[123X  [23X170  -y \geq 0 \newline[123X [23X-200 +x+y \geq 0
  \newline[123X[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XP := PolyhedronByInequalities( [ [ -100, 1, 0 ], [ 200, -1, 0 ],[127X[104X
    [4X[25X>[125X [27X[ -80, 0, 1 ], [ 170, 0, -1 ], [ -200, 1, 1 ] ] );;[127X[104X
    [4X[25Xgap>[125X [27Xmax := SolveLinearProgram( P, "max", [ 1, -2, 5 ] );[127X[104X
    [4X[28X[ [ 100, 170 ], 651 ][128X[104X
    [4X[25Xgap>[125X [27Xmin := SolveLinearProgram( P, "min", [ 1, -2, 5 ] );[127X[104X
    [4X[28X[ [ 200, 80 ], 1 ][128X[104X
    [4X[25Xgap>[125X [27XVerticesOfMainRatPolytope( P );[127X[104X
    [4X[28X[ [ 100, 100 ], [ 100, 170 ], [ 120, 80 ], [ 200, 80 ], [ 200, 170 ] ][128X[104X
  [4X[32X[104X
  
  [33X[0;0YSo   the   optimal   solutions   are   [23X(x=100,y=170)[123X   with   maximal  value
  [23Xp=1-2(100)+5(170)=651[123X     and     [23X(x=200,y=80)[123X     with     minimal    value
  [23Xp=1-2(200)+5(80)=1[123X.[133X
  
  
  [1X6.5 [33X[0;0YZSolve[133X[101X
  
  [1X6.5-1 SolveEqualitiesAndInequalitiesOverIntergers[101X
  
  [33X[1;0Y[29X[2XSolveEqualitiesAndInequalitiesOverIntergers[102X( [3Xeqs[103X, [3Xeqs_rhs[103X, [3Xineqs[103X, [3Xineqs_rhs[103X[, [3Xsigns[103X] ) [32X function[133X
  [6XReturns:[106X  [33X[0;10Ya list of three matrices[133X
  
  [33X[0;0YThis  function  produces  a  basis  of the system [3Xeqs[103X = [3Xeqs_rhs[103X and [3Xineqs[103X >=
  [3Xineqs_rhs[103X.  It  outputs a list containing three matrices. The first one is a
  list of points in a polytope, the second is the hilbert basis of a cone. The
  set  of solutions is then the minkowski sum of the polytope generated by the
  points  in the first list and the cone generated by the hilbert basis in the
  second  matrix.  The  third one is the free part of the solution polyhedron.
  The optional argument [3Xsigns[103X must be a list of zeros and ones which length is
  the  number  of variables. If the ith entry is one, the ith variable must be
  >= 0. If the entry is 0, the number is arbitraty. Default is all zero.[133X
  
  [33X[0;0Y[23X\newline[123X  To  illustrate  the  using  of  this  function, let us compute the
  integers   solutions   of   the  system:  [23X\newline3x+5y=8\newline[123X  [23X4x-2y\geq
  2\newline[123X [23X 3x+y\geq 3\newline[123X[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XSolveEqualitiesAndInequalitiesOverIntergers( [ [ 3, 5 ] ], [ 8 ],[127X[104X
    [4X[25X>[125X [27X[ [ 4, -2 ], [ 3, 1 ] ], [ 2, 3 ] );[127X[104X
    [4X[28X[ [ [ 1, 1 ] ], [ [ 5, -3 ] ], [  ] ][128X[104X
    [4X[25Xgap>[125X [27XSolveEqualitiesAndInequalitiesOverIntergers( [ [ 3, 5 ] ], [ 8 ],[127X[104X
    [4X[25X>[125X [27X[ [ 4, -2 ], [ 3, 1 ] ], [ 2, 3 ], [ 1, 1 ] );[127X[104X
    [4X[28X[ [ [ 1, 1 ] ], [  ], [  ] ][128X[104X
  [4X[32X[104X
  
  [33X[0;0YSo  the  set  of all solutions is given by [23X\{(1,1)+y*(5,-3),y\geq 0\}[123X and it
  has only one positive solution [23X(1,1)[123X.[133X
  
