# Copyright (c) 1997-2006
# Ewgenij Gawrilow, Michael Joswig (Technische Universitaet Berlin, Germany)
# http://www.math.tu-berlin.de/polymake, mailto:polymake@math.tu-berlin.de
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2, or (at your option) any
# later version: http://www.gnu.org/licenses/gpl.txt.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#-----------------------------------------------------------------------------
# $Project: polymake $$Id: rational.rules 7576 2007-01-20 11:11:07Z joswig $
# A pointed polyhedron realized in `Q^d`.
object RationalPolytope : Polytope
# Category: Convex hull computation
# Use the double description method as implemented in @see external.cddlib.
# It is the default algorithm for computation of facets from points or dually.
# It operates with arbitrary precision arithmetic (@see external.GMP).
label cdd
# Category: Convex hull computation
# Use the reverse search method, as implemented in @see external.lrslib.
label lrs
# Category: Convex hull computation
# Use the sequential (beneath-beyond) convex hull algorithm. It performs well at lower dimensions
# and produces a triangulation of the polytope as a byproduct. There is no dual (vertex enumeration)
# implementation of this algorithm.
label beneath_beyond
cdd.convex_hull.primal: FACETS, AFFINE_HULL : VERTICES | POINTS
WEIGHT 4.10
client("cdd_ch_client", $this, "-primal");
cdd.convex_hull.dual: VERTICES, POINTED, FEASIBLE : FACETS | INEQUALITIES
WEIGHT 4.10
client("cdd_ch_client", $this, "-dual");
cdd.convex_hull.redund: VERTICES, VERTEX_NORMALS : POINTS
WEIGHT 3.20
client("cdd_redund_client", $this);
cdd.convex_hull.redund: VERTEX_NORMALS : VERTICES
WEIGHT 3.10
client("cdd_redund_client", $this, "-fromvertices");
lrs.convex_hull.primal: FACETS, AFFINE_HULL : VERTICES | POINTS
WEIGHT 4.10
client("lrs_ch_client", $this, "-primal");
lrs.convex_hull.dual: VERTICES, POINTED, FEASIBLE : FACETS | INEQUALITIES
WEIGHT 4.10
client("lrs_ch_client", $this, "-dual");
lrs.valid_point: VALID_POINT, FEASIBLE : FACETS | INEQUALITIES
WEIGHT 3.10
client("lrs_lp_client", $this, "-valid");
lrs.convex_hull.redund: VERTICES, AFFINE_HULL : POINTS
WEIGHT 3.20
client("lrs_redund_client", $this);
lrs.convex_hull.count: N_FACETS : VERTICES | POINTS
WEIGHT 4.5
PRECONDITION: BOUNDED
$this->BOUNDED
BODY:
client("lrs_ch_client", $this, "-primal", "-count");
lrs.convex_hull.count: N_VERTICES, N_BOUNDED_VERTICES, POINTED, FEASIBLE : FACETS | INEQUALITIES
WEIGHT 4.5
client("lrs_ch_client", $this, "-dual", "-count");
lrs.convex_hull.count: N_BOUNDED_VERTICES, POINTED, FEASIBLE : FACETS | INEQUALITIES
WEIGHT 4.3
client("lrs_ch_client", $this, "-dual", "-count", "-only-bounded");
GRAPH : VERTICES
WEIGHT 3.30
PRECONDITION: BOUNDED
$this->BOUNDED
BODY:
client("graph_from_vertices", $this);
beneath_beyond.convex_hull.primal, default.triangulation: \
FACETS, VERTICES, AFFINE_HULL, VERTICES_IN_FACETS, DUAL_GRAPH, TRIANGULATION_INT : POINTS
WEIGHT 4.10
client("beneath_beyond", $this, "POINTS");
beneath_beyond.convex_hull.primal, default.triangulation: \
FACETS, AFFINE_HULL, VERTICES_IN_FACETS, DUAL_GRAPH, TRIANGULATION, ESSENTIALLY_GENERIC : VERTICES
WEIGHT 4.10
client("beneath_beyond", $this, "VERTICES");
CENTROID, VOLUME : VERTICES, TRIANGULATION
WEIGHT 2.30
PRECONDITION: BOUNDED
$this->BOUNDED
BODY:
client("centroid", $this, "VERTICES", "TRIANGULATION");
default.volume: VOLUME : VERTICES, TRIANGULATION
WEIGHT 2.20
PRECONDITION: BOUNDED
$this->BOUNDED
BODY:
client("pvolume", $this, "VERTICES", "TRIANGULATION");
default.volume: VOLUME : POINTS, TRIANGULATION_INT
WEIGHT 2.30
PRECONDITION: BOUNDED
$this->BOUNDED
BODY:
client("pvolume", $this, "POINTS", "TRIANGULATION_INT");
prefer *.convex_hull cdd, lrs, beneath_beyond
# Special computation of VERTICES for zonotopes:
# In each iteration, add one zone and eliminate the interior points via solving LP
# This way we avoid the explicit creation of 2^#{ZONOTOPE_INPUT_VECTORS} points at once.
VERTICES : ZONOTOPE_INPUT_VECTORS
WEIGHT 3.50
my $P;
foreach my $vec (@{$this->ZONOTOPE_INPUT_VECTORS}) {
my $Z=new Apps::polytope::RationalPolytope(VERTICES => [ $vec, negative_homogeneous($vec) ]);
if (defined($P)) {
my $Pprime=new Apps::polytope::RationalPolytope;
client("minkowski_sum", $Pprime, $P, $Z);
$P=$Pprime;
my $nv=@{$P->VERTICES}; # enforce computation of VERTICES
$P->remove("POINTS"); # save memory
} else {
$P=$Z;
}
}
$this->VERTICES=$P->VERTICES;
# intrinsic rules
INCLUDE
lp_rational.rules
# self-configuring rules interfacing external software
INCLUDE
porta.rules
bastat.rules
# Local Variables:
# c-basic-offset:3
# mode: perl
# End: