passagemath-gap-pkg-cddinterface 10.6.23__cp310-cp310-musllinux_1_2_aarch64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of passagemath-gap-pkg-cddinterface might be problematic. Click here for more details.
- gap/pkg/cddinterface/Dockerfile +16 -0
- gap/pkg/cddinterface/LICENSE +344 -0
- gap/pkg/cddinterface/Makefile +14 -0
- gap/pkg/cddinterface/Makefile.gappkg +225 -0
- gap/pkg/cddinterface/Makefile.in +14 -0
- gap/pkg/cddinterface/PackageInfo.g +103 -0
- gap/pkg/cddinterface/README.md +140 -0
- gap/pkg/cddinterface/ToDo.txt +2 -0
- gap/pkg/cddinterface/autogen.sh +5 -0
- gap/pkg/cddinterface/bin/aarch64-unknown-linux-musl-default64-kv9/CddInterface.so +0 -0
- gap/pkg/cddinterface/config.log +316 -0
- gap/pkg/cddinterface/config.status +989 -0
- gap/pkg/cddinterface/configure +4779 -0
- gap/pkg/cddinterface/configure.ac +84 -0
- gap/pkg/cddinterface/etc/download.sh +86 -0
- gap/pkg/cddinterface/examples/30x30.g +5 -0
- gap/pkg/cddinterface/examples/FourierProjection.g +83 -0
- gap/pkg/cddinterface/examples/comparing_polyhedrons.g +32 -0
- gap/pkg/cddinterface/examples/demo.g +65 -0
- gap/pkg/cddinterface/examples/example1.g +115 -0
- gap/pkg/cddinterface/examples/intersection.g +35 -0
- gap/pkg/cddinterface/examples/linear_programs.g +64 -0
- gap/pkg/cddinterface/examples/minkuwski.g +35 -0
- gap/pkg/cddinterface/examples/new.g +5 -0
- gap/pkg/cddinterface/examples/new2.g +8 -0
- gap/pkg/cddinterface/gap/Julia.gd +3 -0
- gap/pkg/cddinterface/gap/Julia.gi +15 -0
- gap/pkg/cddinterface/gap/polyhedra.gd +268 -0
- gap/pkg/cddinterface/gap/polyhedra.gi +871 -0
- gap/pkg/cddinterface/gap/tools.gd +12 -0
- gap/pkg/cddinterface/gap/tools.gi +472 -0
- gap/pkg/cddinterface/init.g +17 -0
- gap/pkg/cddinterface/install.sh +64 -0
- gap/pkg/cddinterface/makedoc.g +19 -0
- gap/pkg/cddinterface/notebook.ipynb +343 -0
- gap/pkg/cddinterface/read.g +12 -0
- gap/pkg/cddinterface/tst/01.tst +37 -0
- gap/pkg/cddinterface/tst/02.tst +36 -0
- gap/pkg/cddinterface/tst/03.tst +50 -0
- gap/pkg/cddinterface/tst/04.tst +51 -0
- gap/pkg/cddinterface/tst/05.tst +41 -0
- gap/pkg/cddinterface/tst/06.tst +44 -0
- gap/pkg/cddinterface/tst/07.tst +46 -0
- gap/pkg/cddinterface/tst/08.tst +66 -0
- gap/pkg/cddinterface/tst/09.tst +28 -0
- gap/pkg/cddinterface/tst/10.tst +56 -0
- gap/pkg/cddinterface/tst/11.tst +70 -0
- gap/pkg/cddinterface/tst/etest_1.tst +6 -0
- gap/pkg/cddinterface/tst/etest_2.tst +33 -0
- gap/pkg/cddinterface/tst/testall.g +10 -0
- passagemath_gap_pkg_cddinterface-10.6.23.dist-info/METADATA +92 -0
- passagemath_gap_pkg_cddinterface-10.6.23.dist-info/METADATA.bak +93 -0
- passagemath_gap_pkg_cddinterface-10.6.23.dist-info/RECORD +60 -0
- passagemath_gap_pkg_cddinterface-10.6.23.dist-info/WHEEL +5 -0
- passagemath_gap_pkg_cddinterface-10.6.23.dist-info/top_level.txt +1 -0
- passagemath_gap_pkg_cddinterface.libs/libcddgmp-ecb88865.so.0.1.3 +0 -0
- passagemath_gap_pkg_cddinterface.libs/libgmp-28992bcb.so.10.5.0 +0 -0
- sage/all__sagemath_gap_pkg_cddinterface.py +1 -0
- sage/libs/all__sagemath_gap_pkg_cddinterface.py +1 -0
- sage/libs/gap_pkg_cddinterface.cpython-310-aarch64-linux-gnu.so +0 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
#
|
|
2
|
+
# CddInterface: Gap interface to Cdd package
|
|
3
|
+
#
|
|
4
|
+
# This file is part of the build system of a GAP kernel extension.
|
|
5
|
+
# Requires GNU autoconf, GNU automake and GNU libtool.
|
|
6
|
+
#
|
|
7
|
+
|
|
8
|
+
dnl ##
|
|
9
|
+
dnl ## Setup autoconf
|
|
10
|
+
dnl ##
|
|
11
|
+
AC_PREREQ([2.68])
|
|
12
|
+
AC_INIT([CddInterface], [package])
|
|
13
|
+
AC_CONFIG_SRCDIR([src/CddInterface.c])
|
|
14
|
+
AC_CONFIG_MACRO_DIR([m4])
|
|
15
|
+
AC_CONFIG_HEADERS([src/config.h])
|
|
16
|
+
m4_include([m4/find_gap.m4])
|
|
17
|
+
|
|
18
|
+
dnl ##
|
|
19
|
+
dnl ## Set the language
|
|
20
|
+
dnl ##
|
|
21
|
+
AC_PROG_CC
|
|
22
|
+
AC_LANG([C])
|
|
23
|
+
|
|
24
|
+
dnl ##
|
|
25
|
+
dnl ## Locate the GAP root dir
|
|
26
|
+
dnl ##
|
|
27
|
+
FIND_GAP
|
|
28
|
+
|
|
29
|
+
dnl ##
|
|
30
|
+
dnl ## Set cdd root dir
|
|
31
|
+
dnl ##
|
|
32
|
+
AC_ARG_WITH([cddlib],
|
|
33
|
+
[AS_HELP_STRING([--with-cddlib=<path>], [specify the path of cdd installation])],
|
|
34
|
+
[], [with_cddlib=yes])
|
|
35
|
+
AS_IF([test "x$with_cddlib" = "xno"], [AC_MSG_ERROR([cddlib is required and cannot be disabled])])
|
|
36
|
+
|
|
37
|
+
# if no path was given. as a special consideration, detect if the user has cddlib
|
|
38
|
+
# installed via Homebrew (on macOS), and if so, use that
|
|
39
|
+
AS_IF([test "x$with_cddlib" = "xyes"],[
|
|
40
|
+
AS_IF([command -v brew >/dev/null 2>&1],[
|
|
41
|
+
AC_MSG_NOTICE([BREW detected])
|
|
42
|
+
with_cddlib=$(brew --prefix)
|
|
43
|
+
])
|
|
44
|
+
])
|
|
45
|
+
|
|
46
|
+
AS_IF([test "x$with_cddlib" != "xyes"],[
|
|
47
|
+
# Debian and Ubuntu put the headers into PREFIX/include/cdd, while on
|
|
48
|
+
# e.g. homebrew the headers are in PREFIX/include/cddlib. Finally in
|
|
49
|
+
# some cases, the headers are directly in PREFIX/include/ -- so we
|
|
50
|
+
# just add all three to the CPPFLAGS
|
|
51
|
+
AS_IF([test -d "$with_cddlib"],[],[AC_MSG_ERROR([the cddlib path is not a directory])])
|
|
52
|
+
CDD_CPPFLAGS="-I$with_cddlib/include/cdd -I$with_cddlib/include/cddlib -I$with_cddlib/include"
|
|
53
|
+
CDD_LDFLAGS="-L$with_cddlib/lib -lcddgmp -lgmp"
|
|
54
|
+
],[
|
|
55
|
+
CDD_CPPFLAGS="-I/usr/include/cdd -I/usr/include/cddlib"
|
|
56
|
+
CDD_LDFLAGS="-lcddgmp -lgmp"
|
|
57
|
+
])
|
|
58
|
+
AC_SUBST(CDD_CPPFLAGS)
|
|
59
|
+
AC_SUBST(CDD_LDFLAGS)
|
|
60
|
+
|
|
61
|
+
dnl check that cddlib actually is usable
|
|
62
|
+
old_CPPFLAGS="$CPPFLAGS"
|
|
63
|
+
old_LDFLAGS="$LDFLAGS"
|
|
64
|
+
CPPFLAGS="$CPPFLAGS $CDD_CPPFLAGS"
|
|
65
|
+
LDFLAGS="$LDFLAGS $CDD_LDFLAGS"
|
|
66
|
+
|
|
67
|
+
AC_CHECK_HEADER(
|
|
68
|
+
[cddlib/setoper.h],
|
|
69
|
+
[AC_DEFINE([HAVE_CDDLIB_SETOPER_H], [1], [setting HAVE_CDDLIB_SETOPER_H=1])],
|
|
70
|
+
[AC_CHECK_HEADER(
|
|
71
|
+
[setoper.h],
|
|
72
|
+
[AC_DEFINE([HAVE_CDDLIB_SETOPER_H], [0], [setting HAVE_CDDLIB_SETOPER_H=0])],
|
|
73
|
+
[AC_MSG_ERROR([could not find setoper.h])])])
|
|
74
|
+
|
|
75
|
+
AC_CHECK_LIB([cddgmp],[dd_SetLinearity])
|
|
76
|
+
CPPFLAGS="$old_CPPFLAGS"
|
|
77
|
+
LDFLAGS="$old_LDFLAGS"
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
dnl ##
|
|
81
|
+
dnl ## Output everything
|
|
82
|
+
dnl ##
|
|
83
|
+
AC_CONFIG_FILES([Makefile])
|
|
84
|
+
AC_OUTPUT
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
#
|
|
3
|
+
# Download a file and verify its checksum; repeat until
|
|
4
|
+
# the checksum matches or the user told us to give up.
|
|
5
|
+
# This nice script is taken from NormalizInterface. (kamal saleh)
|
|
6
|
+
|
|
7
|
+
set -e
|
|
8
|
+
|
|
9
|
+
usage() {
|
|
10
|
+
cat <<EOF
|
|
11
|
+
Usage: $0 URL [SHA256 [FILENAME]]
|
|
12
|
+
EOF
|
|
13
|
+
|
|
14
|
+
exit $1
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if [ $# -lt 1 ]; then
|
|
18
|
+
usage 1
|
|
19
|
+
fi
|
|
20
|
+
if [ $# -gt 3 ]; then
|
|
21
|
+
usage 1
|
|
22
|
+
fi
|
|
23
|
+
|
|
24
|
+
FileURL="$1"
|
|
25
|
+
ExpectedChecksum="$2"
|
|
26
|
+
if [ $# = 3 ]; then
|
|
27
|
+
Filename="$3"
|
|
28
|
+
else
|
|
29
|
+
Filename=$(basename ${FileURL})
|
|
30
|
+
fi
|
|
31
|
+
|
|
32
|
+
while : ; do
|
|
33
|
+
|
|
34
|
+
#
|
|
35
|
+
# Download
|
|
36
|
+
#
|
|
37
|
+
if [ -e ${Filename} ] ; then
|
|
38
|
+
echo "Checking for ${Filename}... found existing file, using that"
|
|
39
|
+
# TODO: add a checksum check?
|
|
40
|
+
elif command -v wget >/dev/null 2>&1 ; then
|
|
41
|
+
echo "Checking for ${Filename}... downloading with wget"
|
|
42
|
+
wget ${FileURL}
|
|
43
|
+
elif command -v curl >/dev/null 2>&1 ; then
|
|
44
|
+
echo "Checking for ${Filename}... downloading with curl"
|
|
45
|
+
curl -L -O ${FileURL}
|
|
46
|
+
else
|
|
47
|
+
echo "Checking for ${Filename}... not found and unable to download"
|
|
48
|
+
echo
|
|
49
|
+
echo "Please manually download the following file:"
|
|
50
|
+
echo " ${FileURL}"
|
|
51
|
+
echo "Put it into the current directory and re-run this script."
|
|
52
|
+
exit 1
|
|
53
|
+
fi
|
|
54
|
+
|
|
55
|
+
#
|
|
56
|
+
# Compute checksum
|
|
57
|
+
#
|
|
58
|
+
echo "Verifying SHA256 checksum of ${Filename}..."
|
|
59
|
+
if command -v sha256sum >/dev/null 2>&1 ; then
|
|
60
|
+
ActualChecksum=$(sha256sum ${Filename})
|
|
61
|
+
elif command -v shasum >/dev/null 2>&1 ; then
|
|
62
|
+
ActualChecksum=$(shasum -a 256 ${Filename})
|
|
63
|
+
elif command -v openssl >/dev/null 2>&1 ; then
|
|
64
|
+
ActualChecksum=$(openssl sha256 ${Filename})
|
|
65
|
+
else
|
|
66
|
+
ActualChecksum=skip
|
|
67
|
+
fi
|
|
68
|
+
|
|
69
|
+
#
|
|
70
|
+
# Compare checksum
|
|
71
|
+
#
|
|
72
|
+
case ${ActualChecksum} in
|
|
73
|
+
*${ExpectedChecksum}* )
|
|
74
|
+
echo " valid SHA256 checksum"
|
|
75
|
+
break
|
|
76
|
+
;;
|
|
77
|
+
*) echo " invalid SHA256 checksum, expected ${ExpectedChecksum} but got ${ActualChecksum}"
|
|
78
|
+
echo " retrying in 30 seconds..."
|
|
79
|
+
sleep 30
|
|
80
|
+
rm -f ${Filename}
|
|
81
|
+
;;
|
|
82
|
+
esac
|
|
83
|
+
|
|
84
|
+
done;
|
|
85
|
+
|
|
86
|
+
exit 0
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
LoadPackage( "CddInterface" );
|
|
2
|
+
|
|
3
|
+
#! @Chunk Fourier
|
|
4
|
+
#! To illustrate this projection, Let $P= \mathrm{conv}( (1,2), (4,5) )$ in $\mathbb{Q}^2$.
|
|
5
|
+
#! $\newline$
|
|
6
|
+
#! To find its projection on the subspace $(O, x_1)$, we apply the Fourier elemination to get rid of $x_2$
|
|
7
|
+
#! @Example
|
|
8
|
+
P := Cdd_PolyhedronByGenerators( [ [ 1, 1, 2 ], [ 1, 4, 5 ] ] );
|
|
9
|
+
#! <Polyhedron given by its V-representation>
|
|
10
|
+
H := Cdd_H_Rep( P );
|
|
11
|
+
#! <Polyhedron given by its H-representation>
|
|
12
|
+
Display( H );
|
|
13
|
+
#! H-representation
|
|
14
|
+
#! linearity 1, [ 3 ]
|
|
15
|
+
#! begin
|
|
16
|
+
#! 3 X 3 rational
|
|
17
|
+
#!
|
|
18
|
+
#! 4 -1 0
|
|
19
|
+
#! -1 1 0
|
|
20
|
+
#! -1 -1 1
|
|
21
|
+
#! end
|
|
22
|
+
P_x1 := Cdd_FourierProjection( H, 2);
|
|
23
|
+
#! <Polyhedron given by its H-representation>
|
|
24
|
+
Display( P_x1 );
|
|
25
|
+
#! H-representation
|
|
26
|
+
#! linearity 1, [ 3 ]
|
|
27
|
+
#! begin
|
|
28
|
+
#! 3 X 3 rational
|
|
29
|
+
#!
|
|
30
|
+
#! 4 -1 0
|
|
31
|
+
#! -1 1 0
|
|
32
|
+
#! 0 0 1
|
|
33
|
+
#! end
|
|
34
|
+
Display( Cdd_V_Rep( P_x1 ) );
|
|
35
|
+
#! V-representation
|
|
36
|
+
#! begin
|
|
37
|
+
#! 2 X 3 rational
|
|
38
|
+
#!
|
|
39
|
+
#! 1 1 0
|
|
40
|
+
#! 1 4 0
|
|
41
|
+
#! end
|
|
42
|
+
|
|
43
|
+
#! @EndExample
|
|
44
|
+
#! Let again $Q= Conv( (2,3,4), (2,4,5) )+ nonneg( (1,1,1) )$, and let us compute its projection on $(O,x_2,x_3)$
|
|
45
|
+
#! @Example
|
|
46
|
+
Q := Cdd_PolyhedronByGenerators( [ [ 1, 2, 3, 4 ],[ 1, 2, 4, 5 ], [ 0, 1, 1, 1 ] ] );
|
|
47
|
+
#! <Polyhedron given by its V-representation>
|
|
48
|
+
R := Cdd_H_Rep( Q );
|
|
49
|
+
#! <Polyhedron given by its H-representation>
|
|
50
|
+
Display( R );
|
|
51
|
+
#! H-representation
|
|
52
|
+
#! linearity 1, [ 4 ]
|
|
53
|
+
#! begin
|
|
54
|
+
#! 4 X 4 rational
|
|
55
|
+
#!
|
|
56
|
+
#! 2 1 -1 0
|
|
57
|
+
#! -2 1 0 0
|
|
58
|
+
#! -1 -1 1 0
|
|
59
|
+
#! -1 0 -1 1
|
|
60
|
+
#! end
|
|
61
|
+
P_x2_x3 := Cdd_FourierProjection( R, 1);
|
|
62
|
+
#! <Polyhedron given by its H-representation>
|
|
63
|
+
Display( P_x2_x3 );
|
|
64
|
+
#! H-representation
|
|
65
|
+
#! linearity 2, [ 1, 3 ]
|
|
66
|
+
#! begin
|
|
67
|
+
#! 3 X 4 rational
|
|
68
|
+
#!
|
|
69
|
+
#! -1 0 -1 1
|
|
70
|
+
#! -3 0 1 0
|
|
71
|
+
#! 0 1 0 0
|
|
72
|
+
#! end
|
|
73
|
+
Display( Cdd_V_Rep( last ) ) ;
|
|
74
|
+
#! V-representation
|
|
75
|
+
#! begin
|
|
76
|
+
#! 2 X 4 rational
|
|
77
|
+
#!
|
|
78
|
+
#! 0 0 1 1
|
|
79
|
+
#! 1 0 3 4
|
|
80
|
+
#! end
|
|
81
|
+
#! @EndExample
|
|
82
|
+
#! @EndChunk
|
|
83
|
+
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
|
|
2
|
+
LoadPackage( "CddInterface" );
|
|
3
|
+
|
|
4
|
+
#! @BeginChunk comparing_polyhedrons
|
|
5
|
+
#! @BeginExample
|
|
6
|
+
A := Cdd_PolyhedronByInequalities( [ [ 10, -1, 1, 0 ],
|
|
7
|
+
[ -24, 9, 2, 0 ], [ 1, 1, -1, 0 ], [ -23, -12, 1, 11 ] ], [ 4 ] );
|
|
8
|
+
#! <Polyhedron given by its H-representation>
|
|
9
|
+
B := Cdd_PolyhedronByInequalities( [ [ 1, 0, 0, 0 ],
|
|
10
|
+
[ -4, 1, 0, 0 ], [ 10, -1, 1, 0 ], [ -3, -1, 0, 1 ] ], [ 3, 4 ] );
|
|
11
|
+
#! <Polyhedron given by its H-representation>
|
|
12
|
+
Cdd_IsContained( B, A );
|
|
13
|
+
#! true
|
|
14
|
+
Display( Cdd_V_Rep( A ) );
|
|
15
|
+
#! V-representation
|
|
16
|
+
#! begin
|
|
17
|
+
#! 3 X 4 rational
|
|
18
|
+
#!
|
|
19
|
+
#! 1 2 3 4
|
|
20
|
+
#! 1 4 -6 7
|
|
21
|
+
#! 0 1 1 1
|
|
22
|
+
#! end
|
|
23
|
+
Display( Cdd_V_Rep( B ) );
|
|
24
|
+
#! V-representation
|
|
25
|
+
#! begin
|
|
26
|
+
#! 2 X 4 rational
|
|
27
|
+
#!
|
|
28
|
+
#! 1 4 -6 7
|
|
29
|
+
#! 0 1 1 1
|
|
30
|
+
#! end
|
|
31
|
+
#! @EndExample
|
|
32
|
+
#! @EndChunk
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
LoadPackage( "CddInterface" );
|
|
4
|
+
|
|
5
|
+
#! @Chunk demo
|
|
6
|
+
#! @Example
|
|
7
|
+
poly:= Cdd_PolyhedronByInequalities( [ [ 1, 3, 4, 5, 7 ], [ 1, 3, 5, 12, 34 ],
|
|
8
|
+
[ 9, 3, 0, 2, 13 ] ], [ 1 ] );
|
|
9
|
+
#! <Polyhedron given by its H-representation>
|
|
10
|
+
Cdd_InteriorPoint( poly );
|
|
11
|
+
#! [ -194/75, 46/25, -3/25, 0 ]
|
|
12
|
+
|
|
13
|
+
Cdd_FacesWithInteriorPoints( poly );
|
|
14
|
+
#! [ [ 3, [ 1 ], [ -194/75, 46/25, -3/25, 0 ] ], [ 2, [ 1, 2 ],
|
|
15
|
+
#! [ -62/25, 49/25, -7/25, 0 ] ], [ 1, [ 1, 2, 3 ],
|
|
16
|
+
#! [ -209/75, 56/25, -8/25, 0 ] ], [ 2, [ 1, 3 ], [ -217/75, 53/25, -4/25, 0 ] ] ]
|
|
17
|
+
|
|
18
|
+
Cdd_Dimension( poly );
|
|
19
|
+
#! 3
|
|
20
|
+
Cdd_IsPointed( poly );
|
|
21
|
+
#! false
|
|
22
|
+
Cdd_IsEmpty( poly );
|
|
23
|
+
#! false
|
|
24
|
+
Cdd_Faces( poly );
|
|
25
|
+
#! [ [ 3, [ 1 ] ], [ 2, [ 1, 2 ] ], [ 1, [ 1, 2, 3 ] ], [ 2, [ 1, 3 ] ] ]
|
|
26
|
+
poly1 := Cdd_ExtendLinearity( poly, [ 1, 2, 3 ] );
|
|
27
|
+
#! <Polyhedron given by its H-representation>
|
|
28
|
+
Display( poly1 );
|
|
29
|
+
#! H-representation
|
|
30
|
+
#! linearity 3, [ 1, 2, 3 ]
|
|
31
|
+
#! begin
|
|
32
|
+
#! 3 X 5 rational
|
|
33
|
+
#!
|
|
34
|
+
#! 1 3 4 5 7
|
|
35
|
+
#! 1 3 5 12 34
|
|
36
|
+
#! 9 3 0 2 13
|
|
37
|
+
#! end
|
|
38
|
+
Cdd_Dimension( poly1 );
|
|
39
|
+
#! 1
|
|
40
|
+
Cdd_Facets( poly );
|
|
41
|
+
#! [ [ 1, 2 ], [ 1, 3 ] ]
|
|
42
|
+
Cdd_GeneratingVertices( poly );
|
|
43
|
+
#! [ [ -209/75, 56/25, -8/25, 0 ] ]
|
|
44
|
+
Cdd_GeneratingRays( poly );
|
|
45
|
+
#! [ [ -97, 369, -342, 75 ], [ -8, -9, 12, 0 ],
|
|
46
|
+
#! [ 23, -21, 3, 0 ], [ 97, -369, 342, -75 ] ]
|
|
47
|
+
Cdd_Inequalities( poly );
|
|
48
|
+
#! [ [ 1, 3, 5, 12, 34 ], [ 9, 3, 0, 2, 13 ] ]
|
|
49
|
+
Cdd_Equalities( poly );
|
|
50
|
+
#! [ [ 1, 3, 4, 5, 7 ] ]
|
|
51
|
+
P := Cdd_FourierProjection( poly, 2);
|
|
52
|
+
#! <Polyhedron given by its H-representation>
|
|
53
|
+
Display( P );
|
|
54
|
+
#! H-representation
|
|
55
|
+
#! linearity 1, [ 3 ]
|
|
56
|
+
#! begin
|
|
57
|
+
#! 3 X 5 rational
|
|
58
|
+
#!
|
|
59
|
+
#! 9 3 0 2 13
|
|
60
|
+
#! -1 -3 0 23 101
|
|
61
|
+
#! 0 0 1 0 0
|
|
62
|
+
#! end
|
|
63
|
+
#! @EndExample
|
|
64
|
+
#! @EndChunk
|
|
65
|
+
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
LoadPackage("CddInterface");
|
|
2
|
+
|
|
3
|
+
#! @Chunk Example1
|
|
4
|
+
#! @Example
|
|
5
|
+
A:= Cdd_PolyhedronByInequalities( [ [ 0, 1, 0 ], [ 0, 1, -1 ] ] );
|
|
6
|
+
#! <Polyhedron given by its H-representation>
|
|
7
|
+
Display( A );
|
|
8
|
+
#! H-representation
|
|
9
|
+
#! begin
|
|
10
|
+
#! 2 X 3 rational
|
|
11
|
+
#!
|
|
12
|
+
#! 0 1 0
|
|
13
|
+
#! 0 1 -1
|
|
14
|
+
#! end
|
|
15
|
+
B:= Cdd_PolyhedronByInequalities( [ [ 0, 1, 0 ], [ 0, 1, -1 ] ], [ 2 ] );
|
|
16
|
+
#! <Polyhedron given by its H-representation>
|
|
17
|
+
Display( B );
|
|
18
|
+
#! H-representation
|
|
19
|
+
#! linearity 1, [ 2 ]
|
|
20
|
+
#! begin
|
|
21
|
+
#! 2 X 3 rational
|
|
22
|
+
#!
|
|
23
|
+
#! 0 1 0
|
|
24
|
+
#! 0 1 -1
|
|
25
|
+
#! end
|
|
26
|
+
#! @EndExample
|
|
27
|
+
#! @EndChunk
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
#! @Chunk Example2
|
|
31
|
+
#! @Example
|
|
32
|
+
A:= Cdd_PolyhedronByGenerators( [ [ 0, 1, 3 ], [ 1, 4, 5 ] ] );
|
|
33
|
+
#! <Polyhedron given by its V-representation>
|
|
34
|
+
Display( A );
|
|
35
|
+
#! V-representation
|
|
36
|
+
#! begin
|
|
37
|
+
#! 2 X 3 rational
|
|
38
|
+
#!
|
|
39
|
+
#! 0 1 3
|
|
40
|
+
#! 1 4 5
|
|
41
|
+
#! end
|
|
42
|
+
B:= Cdd_PolyhedronByGenerators( [ [ 0, 1, 3 ] ], [ 1 ] );
|
|
43
|
+
#! <Polyhedron given by its V-representation>
|
|
44
|
+
Display( B );
|
|
45
|
+
#! V-representation
|
|
46
|
+
#! linearity 1, [ 1 ]
|
|
47
|
+
#! begin
|
|
48
|
+
#! 1 X 3 rational
|
|
49
|
+
#!
|
|
50
|
+
#! 0 1 3
|
|
51
|
+
#! end
|
|
52
|
+
#! @EndExample
|
|
53
|
+
#! @EndChunk
|
|
54
|
+
|
|
55
|
+
#! @Chunk Example3
|
|
56
|
+
#! @Example
|
|
57
|
+
A:= Cdd_PolyhedronByInequalities( [ [ 0, 2, 6 ], [ 0, 1, 3 ], [1, 4, 10 ] ] );
|
|
58
|
+
#! <Polyhedron given by its H-representation>
|
|
59
|
+
B:= Cdd_Canonicalize( A );
|
|
60
|
+
#! <Polyhedron given by its H-representation>
|
|
61
|
+
Display( B );
|
|
62
|
+
#! H-representation
|
|
63
|
+
#! begin
|
|
64
|
+
#! 2 X 3 rational
|
|
65
|
+
#!
|
|
66
|
+
#! 0 1 3
|
|
67
|
+
#! 1 4 10
|
|
68
|
+
#! end
|
|
69
|
+
#! @EndExample
|
|
70
|
+
#! @EndChunk
|
|
71
|
+
|
|
72
|
+
#! @Chunk Example4
|
|
73
|
+
#! @Example
|
|
74
|
+
A:= Cdd_PolyhedronByInequalities( [ [ 0, 1, 1 ], [ 0, 5, 5 ] ] );
|
|
75
|
+
#! <Polyhedron given by its H-representation>
|
|
76
|
+
B:= Cdd_V_Rep( A );
|
|
77
|
+
#! <Polyhedron given by its V-representation>
|
|
78
|
+
Display( B );
|
|
79
|
+
#! V-representation
|
|
80
|
+
#! linearity 1, [ 2 ]
|
|
81
|
+
#! begin
|
|
82
|
+
#! 2 X 3 rational
|
|
83
|
+
#!
|
|
84
|
+
#! 0 1 0
|
|
85
|
+
#! 0 -1 1
|
|
86
|
+
#! end
|
|
87
|
+
C:= Cdd_H_Rep( B );
|
|
88
|
+
#! <Polyhedron given by its H-representation>
|
|
89
|
+
Display( C );
|
|
90
|
+
#! H-representation
|
|
91
|
+
#! begin
|
|
92
|
+
#! 1 X 3 rational
|
|
93
|
+
#!
|
|
94
|
+
#! 0 1 1
|
|
95
|
+
#! end
|
|
96
|
+
D:= Cdd_PolyhedronByInequalities( [ [ 0, 1, 1, 34, 22, 43 ],
|
|
97
|
+
[ 11, 2, 2, 54, 53, 221 ], [33, 23, 45, 2, 40, 11 ] ] );
|
|
98
|
+
#! <Polyhedron given by its H-representation>
|
|
99
|
+
Cdd_V_Rep( D );
|
|
100
|
+
#! <Polyhedron given by its V-representation>
|
|
101
|
+
Display( last );
|
|
102
|
+
#! V-representation
|
|
103
|
+
#! linearity 2, [ 5, 6 ]
|
|
104
|
+
#! begin
|
|
105
|
+
#! 6 X 6 rational
|
|
106
|
+
#!
|
|
107
|
+
#! 1 -743/14 369/14 11/14 0 0
|
|
108
|
+
#! 0 -1213 619 22 0 0
|
|
109
|
+
#! 0 -1 1 0 0 0
|
|
110
|
+
#! 0 764 -390 -11 0 0
|
|
111
|
+
#! 0 -13526 6772 99 154 0
|
|
112
|
+
#! 0 -116608 59496 1485 0 154
|
|
113
|
+
#! end
|
|
114
|
+
#! @EndExample
|
|
115
|
+
#! @EndChunk
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
LoadPackage( "CddInterface" );
|
|
2
|
+
|
|
3
|
+
#! @BeginChunk intersection
|
|
4
|
+
#! @BeginExample
|
|
5
|
+
A := Cdd_PolyhedronByInequalities( [ [ 3, 4, 5 ] ], [ 1 ] );;
|
|
6
|
+
B := Cdd_PolyhedronByInequalities( [ [ 9, 7, 2 ] ], [ 1 ] );;
|
|
7
|
+
C := Cdd_Intersection( A, B );;
|
|
8
|
+
Display( Cdd_V_Rep( A ) );
|
|
9
|
+
#! V-representation
|
|
10
|
+
#! linearity 1, [ 2 ]
|
|
11
|
+
#! begin
|
|
12
|
+
#! 2 X 3 rational
|
|
13
|
+
#!
|
|
14
|
+
#! 1 -3/4 0
|
|
15
|
+
#! 0 -5 4
|
|
16
|
+
#! end
|
|
17
|
+
Display( Cdd_V_Rep( B ) );
|
|
18
|
+
#! V-representation
|
|
19
|
+
#! linearity 1, [ 2 ]
|
|
20
|
+
#! begin
|
|
21
|
+
#! 2 X 3 rational
|
|
22
|
+
#!
|
|
23
|
+
#! 1 -9/7 0
|
|
24
|
+
#! 0 -2 7
|
|
25
|
+
#! end
|
|
26
|
+
Display( Cdd_V_Rep( C ) );
|
|
27
|
+
#! V-representation
|
|
28
|
+
#! begin
|
|
29
|
+
#! 1 X 3 rational
|
|
30
|
+
#!
|
|
31
|
+
#! 1 -13/9 5/9
|
|
32
|
+
#! end
|
|
33
|
+
#! @EndExample
|
|
34
|
+
#! @EndChunk
|
|
35
|
+
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
LoadPackage( "CddInterface" );
|
|
2
|
+
|
|
3
|
+
#! @Chunk Example5
|
|
4
|
+
#! To illustrate the using of these functions, let us solve the linear program given by:
|
|
5
|
+
#! $$\textbf{Maximize}\;\;P(x,y)= 1-2x+5y,\;\mathrm{with}$$
|
|
6
|
+
#! $$100\leq x \leq 200,80\leq y\leq 170,y \geq -x+200.$$
|
|
7
|
+
#! We bring the inequalities to the form $b+AX\geq 0$ and get:
|
|
8
|
+
#! $$-100+x\geq 0, 200-x \geq 0, -80+y \geq 0, 170 -y \geq 0,-200 +x+y \geq 0.$$
|
|
9
|
+
#! @Example
|
|
10
|
+
A:= Cdd_PolyhedronByInequalities( [ [ -100, 1, 0 ], [ 200, -1, 0 ],
|
|
11
|
+
[ -80, 0, 1 ], [ 170, 0, -1 ], [ -200, 1, 1 ] ] );
|
|
12
|
+
#! <Polyhedron given by its H-representation>
|
|
13
|
+
lp1:= Cdd_LinearProgram( A, "max", [1, -2, 5 ] );
|
|
14
|
+
#! <Linear program>
|
|
15
|
+
Display( lp1 );
|
|
16
|
+
#! Linear program given by:
|
|
17
|
+
#! H-representation
|
|
18
|
+
#! begin
|
|
19
|
+
#! 5 X 3 rational
|
|
20
|
+
#!
|
|
21
|
+
#! -100 1 0
|
|
22
|
+
#! 200 -1 0
|
|
23
|
+
#! -80 0 1
|
|
24
|
+
#! 170 0 -1
|
|
25
|
+
#! -200 1 1
|
|
26
|
+
#! end
|
|
27
|
+
#! max [ 1, -2, 5 ]
|
|
28
|
+
Cdd_SolveLinearProgram( lp1 );
|
|
29
|
+
#! [ [ 100, 170 ], 651 ]
|
|
30
|
+
lp2:= Cdd_LinearProgram( A, "min", [ 1, -2, 5 ] );
|
|
31
|
+
#! <Linear program>
|
|
32
|
+
Display( lp2 );
|
|
33
|
+
#! Linear program given by:
|
|
34
|
+
#! H-representation
|
|
35
|
+
#! begin
|
|
36
|
+
#! 5 X 3 rational
|
|
37
|
+
#!
|
|
38
|
+
#! -100 1 0
|
|
39
|
+
#! 200 -1 0
|
|
40
|
+
#! -80 0 1
|
|
41
|
+
#! 170 0 -1
|
|
42
|
+
#! -200 1 1
|
|
43
|
+
#! end
|
|
44
|
+
#! min [ 1, -2, 5 ]
|
|
45
|
+
Cdd_SolveLinearProgram( lp2 );
|
|
46
|
+
#! [ [ 200, 80 ], 1 ]
|
|
47
|
+
B:= Cdd_V_Rep( A );
|
|
48
|
+
#! <Polyhedron given by its V-representation>
|
|
49
|
+
Display( B );
|
|
50
|
+
#! V-representation
|
|
51
|
+
#! begin
|
|
52
|
+
#! 5 X 3 rational
|
|
53
|
+
#!
|
|
54
|
+
#! 1 100 170
|
|
55
|
+
#! 1 100 100
|
|
56
|
+
#! 1 120 80
|
|
57
|
+
#! 1 200 80
|
|
58
|
+
#! 1 200 170
|
|
59
|
+
#! end
|
|
60
|
+
#! @EndExample
|
|
61
|
+
#! So the optimal solution for $\texttt{lp1}$ is $(x=100,y=170)$ with optimal value $p=1-2(100)+5(170)=651$ and for $\texttt{lp2}$ is
|
|
62
|
+
#! $(x=200,y=80)$ with optimal value $p=1-2(200)+5(80)=1$.
|
|
63
|
+
#! @EndChunk
|
|
64
|
+
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
#! @Chunk minkuwski
|
|
2
|
+
#! @Example
|
|
3
|
+
P := Cdd_PolyhedronByGenerators( [ [ 1, 2, 5 ], [ 0, 1, 2 ] ] );
|
|
4
|
+
#! < Polyhedron given by its V-representation >
|
|
5
|
+
Q := Cdd_PolyhedronByGenerators( [ [ 1, 4, 6 ], [ 1, 3, 7 ], [ 0, 3, 1 ] ] );
|
|
6
|
+
#! < Polyhedron given by its V-representation >
|
|
7
|
+
S := P+Q;
|
|
8
|
+
#! < Polyhedron given by its H-representation >
|
|
9
|
+
V := Cdd_V_Rep( S );
|
|
10
|
+
#! < Polyhedron given by its V-representation >
|
|
11
|
+
Display( V );
|
|
12
|
+
#! V-representation
|
|
13
|
+
#! begin
|
|
14
|
+
#! 4 X 3 rational
|
|
15
|
+
#!
|
|
16
|
+
#! 0 3 1
|
|
17
|
+
#! 1 6 11
|
|
18
|
+
#! 1 5 12
|
|
19
|
+
#! 0 1 2
|
|
20
|
+
#! end
|
|
21
|
+
Cdd_GeneratingVertices( P );
|
|
22
|
+
#! [ [ 2, 5 ] ]
|
|
23
|
+
Cdd_GeneratingVertices( Q );
|
|
24
|
+
#! [ [ 3, 7 ], [ 4, 6 ] ]
|
|
25
|
+
Cdd_GeneratingVertices( S );
|
|
26
|
+
#! [ [ 5, 12 ], [ 6, 11 ] ]
|
|
27
|
+
Cdd_GeneratingRays( P );
|
|
28
|
+
#! [ [ 1, 2 ] ]
|
|
29
|
+
Cdd_GeneratingRays( Q );
|
|
30
|
+
#! [ [ 3, 1 ] ]
|
|
31
|
+
Cdd_GeneratingRays( S );
|
|
32
|
+
#! [ [ 1, 2 ], [ 3, 1 ] ]
|
|
33
|
+
#! @EndExample
|
|
34
|
+
#! @EndChunk
|
|
35
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
##
|
|
2
|
+
InstallGlobalFunction( cdd_PolyhedronByInequalities,
|
|
3
|
+
function( arg )
|
|
4
|
+
|
|
5
|
+
return CallFuncList( Cdd_PolyhedronByInequalities, ConvertJuliaToGAP( arg ) );
|
|
6
|
+
|
|
7
|
+
end );
|
|
8
|
+
|
|
9
|
+
##
|
|
10
|
+
InstallGlobalFunction( cdd_PolyhedronByGenerators,
|
|
11
|
+
function( arg )
|
|
12
|
+
|
|
13
|
+
return CallFuncList( Cdd_PolyhedronByGenerators, ConvertJuliaToGAP( arg ) );
|
|
14
|
+
|
|
15
|
+
end );
|