<#GAPDoc Label="intersection">
<Example><![CDATA[
gap> A := Cdd_PolyhedronByInequalities( [ [ 3, 4, 5 ] ], [ 1 ] );;
gap> B := Cdd_PolyhedronByInequalities( [ [ 9, 7, 2 ] ], [ 1 ] );;
gap> C := Cdd_Intersection( A, B );;
gap> Display( Cdd_V_Rep( A ) );
V-representation
linearity 1, [ 2 ]
begin
2 X 3 rational
1 -3/4 0
0 -5 4
end
gap> Display( Cdd_V_Rep( B ) );
V-representation
linearity 1, [ 2 ]
begin
2 X 3 rational
1 -9/7 0
0 -2 7
end
gap> Display( Cdd_V_Rep( C ) );
V-representation
begin
1 X 3 rational
1 -13/9 5/9
end
]]></Example>
<#/GAPDoc>
<#GAPDoc Label="Increment">
<Listing Type="Code"><![CDATA[
H-representation
linearity t, [i_1, i_2, ...,i_t]
begin
m x (d+1) numbertype
b A
end
]]></Listing>
<#/GAPDoc>
<#GAPDoc Label="Example1">
<Example><![CDATA[
gap> A:= Cdd_PolyhedronByInequalities( [ [ 0, 1, 0 ], [ 0, 1, -1 ] ] );
<Polyhedron given by its H-representation>
gap> Display( A );
H-representation
begin
2 X 3 rational
0 1 0
0 1 -1
end
gap> B:= Cdd_PolyhedronByInequalities( [ [ 0, 1, 0 ], [ 0, 1, -1 ] ], [ 2 ] );
<Polyhedron given by its H-representation>
gap> Display( B );
H-representation
linearity 1, [ 2 ]
begin
2 X 3 rational
0 1 0
0 1 -1
end
]]></Example>
<#/GAPDoc>
<#GAPDoc Label="Example2">
<Example><![CDATA[
gap> A:= Cdd_PolyhedronByGenerators( [ [ 0, 1, 3 ], [ 1, 4, 5 ] ] );
<Polyhedron given by its V-representation>
gap> Display( A );
V-representation
begin
2 X 3 rational
0 1 3
1 4 5
end
gap> B:= Cdd_PolyhedronByGenerators( [ [ 0, 1, 3 ] ], [ 1 ] );
<Polyhedron given by its V-representation>
gap> Display( B );
V-representation
linearity 1, [ 1 ]
begin
1 X 3 rational
0 1 3
end
]]></Example>
<#/GAPDoc>
<#GAPDoc Label="Fourier">
To illustrate this projection, Let <Math>P= \mathrm{conv}( (1,2), (4,5) )</Math> in <Math>\mathbb{Q}^2</Math>.
<Math>\newline</Math>
To find its projection on the subspace <Math>(O, x_1)</Math>, we apply the Fourier elemination to get rid of <Math>x_2</Math>
<Example><![CDATA[
gap> P := Cdd_PolyhedronByGenerators( [ [ 1, 1, 2 ], [ 1, 4, 5 ] ] );
<Polyhedron given by its V-representation>
gap> H := Cdd_H_Rep( P );
<Polyhedron given by its H-representation>
gap> Display( H );
H-representation
linearity 1, [ 3 ]
begin
3 X 3 rational
4 -1 0
-1 1 0
-1 -1 1
end
gap> P_x1 := Cdd_FourierProjection( H, 2);
<Polyhedron given by its H-representation>
gap> Display( P_x1 );
H-representation
linearity 1, [ 3 ]
begin
3 X 3 rational
4 -1 0
-1 1 0
0 0 1
end
gap> Display( Cdd_V_Rep( P_x1 ) );
V-representation
begin
2 X 3 rational
1 1 0
1 4 0
end
]]></Example>
Let again <Math>Q= Conv( (2,3,4), (2,4,5) )+ nonneg( (1,1,1) )</Math>, and let us compute its projection on <Math>(O,x_2,x_3)</Math>
<Example><![CDATA[
gap> Q := Cdd_PolyhedronByGenerators( [ [ 1, 2, 3, 4 ],[ 1, 2, 4, 5 ], [ 0, 1, 1, 1 ] ] );
<Polyhedron given by its V-representation>
gap> R := Cdd_H_Rep( Q );
<Polyhedron given by its H-representation>
gap> Display( R );
H-representation
linearity 1, [ 4 ]
begin
4 X 4 rational
2 1 -1 0
-2 1 0 0
-1 -1 1 0
-1 0 -1 1
end
gap> P_x2_x3 := Cdd_FourierProjection( R, 1);
<Polyhedron given by its H-representation>
gap> Display( P_x2_x3 );
H-representation
linearity 2, [ 1, 3 ]
begin
3 X 4 rational
-1 0 -1 1
-3 0 1 0
0 1 0 0
end
gap> Display( Cdd_V_Rep( last ) ) ;
V-representation
begin
2 X 4 rational
0 0 1 1
1 0 3 4
end
]]></Example>
<#/GAPDoc>
<#GAPDoc Label="comparing_polyhedrons">
<Example><![CDATA[
gap> A := Cdd_PolyhedronByInequalities( [ [ 10, -1, 1, 0 ],
> [ -24, 9, 2, 0 ], [ 1, 1, -1, 0 ], [ -23, -12, 1, 11 ] ], [ 4 ] );
<Polyhedron given by its H-representation>
gap> B := Cdd_PolyhedronByInequalities( [ [ 1, 0, 0, 0 ],
> [ -4, 1, 0, 0 ], [ 10, -1, 1, 0 ], [ -3, -1, 0, 1 ] ], [ 3, 4 ] );
<Polyhedron given by its H-representation>
gap> Cdd_IsContained( B, A );
true
gap> Display( Cdd_V_Rep( A ) );
V-representation
begin
3 X 4 rational
1 2 3 4
1 4 -6 7
0 1 1 1
end
gap> Display( Cdd_V_Rep( B ) );
V-representation
begin
2 X 4 rational
1 4 -6 7
0 1 1 1
end
]]></Example>
<#/GAPDoc>
<#GAPDoc Label="minkuwski">
<Example><![CDATA[
gap> P := Cdd_PolyhedronByGenerators( [ [ 1, 2, 5 ], [ 0, 1, 2 ] ] );
< Polyhedron given by its V-representation >
gap> Q := Cdd_PolyhedronByGenerators( [ [ 1, 4, 6 ], [ 1, 3, 7 ], [ 0, 3, 1 ] ] );
< Polyhedron given by its V-representation >
gap> S := P+Q;
< Polyhedron given by its H-representation >
gap> V := Cdd_V_Rep( S );
< Polyhedron given by its V-representation >
gap> Display( V );
V-representation
begin
4 X 3 rational
<#/GAPDoc>
<#GAPDoc Label="Example5">
To illustrate the using of these functions, let us solve the linear program given by:
<Display>\textbf{Maximize}\;\;P(x,y)= 1-2x+5y,\;\mathrm{with}</Display>
<Display>100\leq x \leq 200,80\leq y\leq 170,y \geq -x+200.</Display>
We bring the inequalities to the form <Math>b+AX\geq 0</Math> and get:
<Display>-100+x\geq 0, 200-x \geq 0, -80+y \geq 0, 170 -y \geq 0,-200 +x+y \geq 0.</Display>
<Example><![CDATA[
gap> A:= Cdd_PolyhedronByInequalities( [ [ -100, 1, 0 ], [ 200, -1, 0 ],
> [ -80, 0, 1 ], [ 170, 0, -1 ], [ -200, 1, 1 ] ] );
<Polyhedron given by its H-representation>
gap> lp1:= Cdd_LinearProgram( A, "max", [1, -2, 5 ] );
<Linear program>
gap> Display( lp1 );
Linear program given by:
H-representation
begin
5 X 3 rational
-100 1 0
200 -1 0
-80 0 1
170 0 -1
-200 1 1
end
max [ 1, -2, 5 ]
gap> Cdd_SolveLinearProgram( lp1 );
[ [ 100, 170 ], 651 ]
gap> lp2:= Cdd_LinearProgram( A, "min", [ 1, -2, 5 ] );
<Linear program>
gap> Display( lp2 );
Linear program given by:
H-representation
begin
5 X 3 rational
-100 1 0
200 -1 0
-80 0 1
170 0 -1
-200 1 1
end
min [ 1, -2, 5 ]
gap> Cdd_SolveLinearProgram( lp2 );
[ [ 200, 80 ], 1 ]
gap> B:= Cdd_V_Rep( A );
<Polyhedron given by its V-representation>
gap> Display( B );
V-representation
begin
5 X 3 rational
So the optimal solution for <Math>\texttt{lp1}</Math> is <Math>(x=100,y=170)</Math> with optimal value <Math>p=1-2(100)+5(170)=651</Math> and for <Math>\texttt{lp2}</Math> is
<Math>(x=200,y=80)</Math> with optimal value <Math>p=1-2(200)+5(80)=1</Math>.
<#/GAPDoc>
<#GAPDoc Label="Example3">
<Example><![CDATA[
gap> A:= Cdd_PolyhedronByInequalities( [ [ 0, 2, 6 ], [ 0, 1, 3 ], [1, 4, 10 ] ] );
<Polyhedron given by its H-representation>
gap> B:= Cdd_Canonicalize( A );
<Polyhedron given by its H-representation>
gap> Display( B );
H-representation
begin
2 X 3 rational
0 1 3
1 4 10
end
]]></Example>
<#/GAPDoc>
<#GAPDoc Label="Example4">
<Example><![CDATA[
gap> A:= Cdd_PolyhedronByInequalities( [ [ 0, 1, 1 ], [ 0, 5, 5 ] ] );
<Polyhedron given by its H-representation>
gap> B:= Cdd_V_Rep( A );
<Polyhedron given by its V-representation>
gap> Display( B );
V-representation
linearity 1, [ 2 ]
begin
2 X 3 rational
0 1 0
0 -1 1
end
gap> C:= Cdd_H_Rep( B );
<Polyhedron given by its H-representation>
gap> Display( C );
H-representation
begin
1 X 3 rational
0 1 1
end
gap> D:= Cdd_PolyhedronByInequalities( [ [ 0, 1, 1, 34, 22, 43 ],
> [ 11, 2, 2, 54, 53, 221 ], [33, 23, 45, 2, 40, 11 ] ] );
<Polyhedron given by its H-representation>
gap> Cdd_V_Rep( D );
<Polyhedron given by its V-representation>
gap> Display( last );
V-representation
linearity 2, [ 5, 6 ]
begin
6 X 6 rational
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.