/* Copyright (c) 1997-2004
   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.
*/

#ifndef _POLYMAKE_CDD_INTERFACE_H
#define _POLYMAKE_CDD_INTERFACE_H "$Project: polymake $$Id: cdd_interface.h,v 1.3 2005/11/10 10:25:16 thilosch Exp $"

#include <Rational.h>
#include <Matrix.h>
#include <ListMatrix.h>
#include <Vector.h>
#include <Bitset.h>
#include <linalg_exceptions.h>

namespace polymake { namespace polytope { namespace cdd_interface {

template <typename Coord>
class solver {
public:
   typedef Coord coord_type;

   solver();

   typedef std::pair< Matrix<coord_type>, Matrix<coord_type> > matrix_pair;

   /// @retval first: facets, second: affine hull
   matrix_pair
   enumerate_facets(const Matrix<coord_type>& Points)
      throw (std::bad_alloc, std::runtime_error);

   Matrix<coord_type>
   enumerate_vertices(const Matrix<coord_type>& Inequalities, const Matrix<coord_type>& Equations, const bool accept_non_pointed = false)
      throw (std::bad_alloc, std::runtime_error);

   typedef std::pair<Bitset, ListMatrix< Vector<coord_type> > > non_redundant;

   /// @retval first: indices of vertices, second: certificates (co-vertices)
   non_redundant
   find_vertices_among_points(const Matrix<coord_type>& Points)
      throw (std::bad_alloc, std::runtime_error);

   typedef std::pair<coord_type, Vector<coord_type> > lp_solution;

   /// @retval first: objective value, second: solution
   lp_solution
   solve_lp(const Matrix<coord_type>& Inequalities, const Matrix<coord_type>& Equations,
	    const Vector<coord_type>& Objective, bool maximize)
      throw (std::bad_alloc, std::runtime_error);

private:
   struct initializer;
};

} } }

#endif // _POLYMAKE_CDD_INTERFACE_H

// Local Variables:
// mode:C++
// c-basic-offset:3
// End:
