alpar@1254: /* -*- C++ -*- alpar@1254: * alpar@1956: * This file is a part of LEMON, a generic C++ optimization library alpar@1956: * alpar@1956: * Copyright (C) 2003-2006 alpar@1956: * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport alpar@1359: * (Egervary Research Group on Combinatorial Optimization, EGRES). alpar@1254: * alpar@1254: * Permission to use, modify and distribute this software is granted alpar@1254: * provided that this copyright notice appears in all copies. For alpar@1254: * precise terms see the accompanying LICENSE file. alpar@1254: * alpar@1254: * This software is provided "AS IS" with no warranty of any kind, alpar@1254: * express or implied, and with no claim as to its suitability for any alpar@1254: * purpose. alpar@1254: * alpar@1254: */ alpar@1254: alpar@1313: #ifndef LEMON_LP_SKELETON alpar@1313: #define LEMON_LP_SKELETON alpar@1254: ladanyi@1356: #include alpar@1254: alpar@1254: ///\file alpar@1254: ///\brief A skeleton file to implement LP solver interfaces alpar@1254: namespace lemon { athos@1508: alpar@1254: ///A skeleton class to implement LP solver interfaces alpar@1313: class LpSkeleton :public LpSolverBase { alpar@1273: int col_num,row_num; alpar@1273: alpar@1254: protected: alpar@1364: ///\e alpar@1364: virtual LpSolverBase &_newLp(); alpar@1364: ///\e alpar@1364: virtual LpSolverBase &_copyLp(); alpar@1294: /// \e alpar@1254: virtual int _addCol(); alpar@1294: /// \e alpar@1254: virtual int _addRow(); alpar@1294: /// \e athos@1432: virtual void _eraseCol(int i); athos@1432: /// \e athos@1432: virtual void _eraseRow(int i); athos@1432: /// \e deba@2312: virtual void _getColName(int col, std::string & name); alpar@1895: /// \e alpar@1895: virtual void _setColName(int col, const std::string & name); alpar@1895: alpar@1895: /// \e deba@2312: virtual void _setRowCoeffs(int i, LpRowIterator b, LpRowIterator e); alpar@1294: /// \e deba@2312: virtual void _setColCoeffs(int i, LpColIterator b, LpColIterator e); alpar@1294: athos@1431: /// Set one element of the coefficient matrix athos@1431: virtual void _setCoeff(int row, int col, Value value); alpar@1294: athos@2324: /// Get one element of the coefficient matrix athos@2324: virtual Value _getCoeff(int row, int col); athos@2324: alpar@1294: /// The lower bound of a variable (column) have to be given by an alpar@1294: /// extended number of type Value, i.e. a finite number of type alpar@1294: /// Value or -\ref INF. alpar@1254: virtual void _setColLowerBound(int i, Value value); alpar@1294: /// \e alpar@1294: alpar@1294: /// The upper bound of a variable (column) have to be given by an alpar@1294: /// extended number of type Value, i.e. a finite number of type alpar@1294: /// Value or \ref INF. alpar@1254: virtual void _setColUpperBound(int i, Value value); alpar@1294: /// \e alpar@1294: athos@1405: // /// The lower bound of a linear expression (row) have to be given by an athos@1405: // /// extended number of type Value, i.e. a finite number of type athos@1405: // /// Value or -\ref INF. athos@1405: // virtual void _setRowLowerBound(int i, Value value); athos@1405: // /// \e athos@1405: athos@1405: // /// The upper bound of a linear expression (row) have to be given by an athos@1405: // /// extended number of type Value, i.e. a finite number of type athos@1405: // /// Value or \ref INF. athos@1405: // virtual void _setRowUpperBound(int i, Value value); athos@1405: athos@1405: /// The lower and upper bound of a linear expression (row) have to be athos@1405: /// given by an alpar@1294: /// extended number of type Value, i.e. a finite number of type athos@1405: /// Value or +/-\ref INF. athos@1389: virtual void _setRowBounds(int i, Value lb, Value ub); athos@1389: /// \e athos@1389: alpar@1294: alpar@1294: /// \e alpar@1390: virtual void _clearObj(); alpar@1390: /// \e alpar@1254: virtual void _setObjCoeff(int i, Value obj_coef); alpar@1294: athos@2324: /// \e athos@2324: virtual Value _getObjCoeff(int i); athos@2324: alpar@1294: ///\e alpar@1294: alpar@1294: ///\bug Wrong interface alpar@1294: /// alpar@1303: virtual SolveExitStatus _solve(); alpar@1294: alpar@1294: ///\e alpar@1294: alpar@1294: ///\bug Wrong interface alpar@1294: /// alpar@1293: virtual Value _getPrimal(int i); klao@1796: klao@1796: ///\e klao@1796: klao@1796: ///\bug Wrong interface klao@1796: /// klao@1796: virtual Value _getDual(int i); klao@1796: alpar@1294: ///\e alpar@1294: alpar@1294: ///\bug Wrong interface alpar@1294: /// alpar@1312: virtual Value _getPrimalValue(); klao@1796: alpar@1312: ///\e alpar@1312: alpar@1312: ///\bug Wrong interface alpar@1312: /// alpar@1312: virtual SolutionStatus _getPrimalStatus(); alpar@1312: athos@1460: ////e athos@1460: virtual SolutionStatus _getDualStatus(); athos@1460: athos@1460: athos@1460: ///\e athos@1460: virtual ProblemTypes _getProblemType(); athos@1460: alpar@1312: ///\e alpar@1312: virtual void _setMax(); alpar@1312: ///\e alpar@1312: virtual void _setMin(); alpar@1843: alpar@1843: ///\e athos@2324: virtual bool _isMax(); athos@2324: athos@2324: athos@2324: athos@2324: ///\e alpar@1843: virtual bool _isBasicCol(int i); alpar@1843: alpar@1312: alpar@1294: alpar@1273: public: alpar@1313: LpSkeleton() : LpSolverBase(), col_num(0), row_num(0) {} alpar@1254: }; alpar@1254: alpar@1254: } //namespace lemon alpar@1254: alpar@1313: #endif // LEMON_LP_SKELETON