// // $Source: /cvsroot/gambit/gambit/sources/tools/lp/lptab.h,v $ // $Date: 2006/01/07 06:37:34 $ // $Revision: 1.6 $ // // DESCRIPTION: // Interface to LP tableaus // // This file is part of Gambit // Copyright (c) 2002, The Gambit Project // // 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 of the License, or // (at your option) any later version. // // 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. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // // --------------------------------------------------------------------------- // LPTableau Stuff (For Linear Programming code) // --------------------------------------------------------------------------- #ifndef LPTAB_H #define LPTAB_H #include "tableau.h" template class LPTableau : public Tableau { private: Gambit::Vector dual; Gambit::Array unitcost; Gambit::Array cost; Gambit::Array UB,LB; // does col have upper/lower bound? Gambit::Array ub,lb; // upper/lower bound void SolveDual(); public: class BadPivot : public Gambit::Exception { public: virtual ~BadPivot(); std::string GetDescription(void) const; }; LPTableau(const Gambit::Matrix &A, const Gambit::Vector &b); LPTableau(const Gambit::Matrix &A, const Gambit::Array &art, const Gambit::Vector &b); LPTableau(const LPTableau&); virtual ~LPTableau(); LPTableau& operator=(const LPTableau&); // cost information void SetCost(const Gambit::Vector& ); // unit column cost := 0 void SetCost(const Gambit::Vector&, const Gambit::Vector& ); Gambit::Vector GetCost() const; Gambit::Vector GetUnitCost() const; T TotalCost(); // cost of current solution T RelativeCost(int) const; // negative index convention void RelativeCostVector(Gambit::Vector &, Gambit::Vector &); void DualVector(Gambit::Vector &) const; // column vector // Redefined functions void Refactor(); void Pivot(int outrow,int col); void ReversePivots(Gambit::List > &); bool IsReversePivot(int i, int j); void DualReversePivots(Gambit::List > &); bool IsDualReversePivot(int i, int j); BFS DualBFS(void) const; // returns the label of the index of the last artificial variable int LastLabel( void ); // select Basis elements according to Tableau rows and cols void BasisSelect(const Gambit::Array&rowv, Gambit::Vector &colv) const; // as above, but unit column elements nonzero void BasisSelect(const Gambit::Array&unitv, const Gambit::Array&rowv, Gambit::Vector&colv) const; }; #endif // LPTAB_H