#ifndef LP_H_INCLUDED
#define LP_H_INCLUDED

#include <stdio.h>

#include "vektor.h"

bool isFacet(const IntegerVectorList &g, IntegerVectorList::const_iterator i);
bool interiorPoint(const IntegerVectorList &g, IntegerVector &result, bool strictlyPositive, IntegerVector const *equalitySet=0);//The program terminates if the interior point could not be cast to an IntegerVector
bool hasInteriorPoint(const IntegerVectorList &g, bool strictlyPositive, IntegerVector const *equalitySet=0);
IntegerVectorList::const_iterator shootRay(const IntegerVectorList &g);
bool positiveVectorInKernel(const IntegerVectorList &g, IntegerVector *result);
int rankOfMatrix(const IntegerVectorList &g);
bool lpSetSolver(const char *name);
IntegerVectorList extremeRaysInequalityIndices(const IntegerVectorList &inequalityList);
void removeRedundantRows(IntegerVectorList *inequalities, IntegerVectorList *equalities, bool removeInequalityRedundancies);
IntegerVector relativeInteriorPoint(const IntegerVectorList &g, IntegerVector const *equalitySet);
void dual(int n, const IntegerVectorList &inequalities, const IntegerVectorList &equations, IntegerVectorList *destInequalities, IntegerVectorList *destEquations);

class LpSolver
{
  static class LpSolver *list;
  class LpSolver *next;
 public:
  LpSolver();
  static LpSolver *find(const char *name);
  static void printList(FILE *f);
  virtual bool isFacet(const IntegerVectorList &g, IntegerVectorList::const_iterator i)=0;
  virtual bool interiorPoint(const IntegerVectorList &g, IntegerVector &result, bool strictlyPositive, IntegerVector const *equalitySet=0);
  virtual bool hasInteriorPoint(const IntegerVectorList &g, bool strictlyPositive, IntegerVector const *equalitySet=0);
  virtual const char *name()=0;
  virtual IntegerVectorList::const_iterator shoot(const IntegerVectorList &g);
  virtual bool positiveVectorInKernel(const IntegerVectorList &g, IntegerVector *result);
  virtual int rankOfMatrix(const IntegerVectorList &g);// in this header file because we use cdd for this
  virtual IntegerVectorList extremeRaysInequalityIndices(const IntegerVectorList &inequalityList);
  virtual void removeRedundantRows(IntegerVectorList *inequalities, IntegerVectorList *equalities, bool removeInequalityRedundancies);
  virtual IntegerVector relativeInteriorPoint(const IntegerVectorList &g, IntegerVector const *equalitySet);
  virtual void dual(int n, const IntegerVectorList &inequalities, const IntegerVectorList &equations, IntegerVectorList *dualInequalities, IntegerVectorList *dualEquations);
};


#endif
