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: deba@2363: 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@2366: virtual void _getColName(int col, std::string & name) const; alpar@1895: /// \e alpar@1895: virtual void _setColName(int col, const std::string & name); deba@2366: /// \e deba@2366: virtual int _colByName(const std::string& name) const; alpar@1895: alpar@1895: /// \e deba@2364: virtual void _setRowCoeffs(int i, ConstRowIterator b, ConstRowIterator e); alpar@1294: /// \e deba@2366: virtual void _getRowCoeffs(int i, RowIterator b) const; deba@2364: /// \e deba@2364: virtual void _setColCoeffs(int i, ConstColIterator b, ConstColIterator e); deba@2364: /// \e deba@2366: virtual void _getColCoeffs(int i, ColIterator b) const; 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 deba@2366: virtual Value _getCoeff(int row, int col) const; 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: athos@2328: /// The lower bound of a variable (column) is an athos@2328: /// extended number of type Value, i.e. a finite number of type athos@2328: /// Value or -\ref INF. deba@2366: virtual Value _getColLowerBound(int i) const; athos@2328: 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@2328: /// The upper bound of a variable (column) is an athos@2328: /// extended number of type Value, i.e. a finite number of type athos@2328: /// Value or \ref INF. deba@2366: virtual Value _getColUpperBound(int i) const; athos@2328: 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: athos@2328: /// The lower and the upper bound of athos@2328: /// a constraint (row) are athos@2328: /// extended numbers of type Value, i.e. finite numbers of type athos@2328: /// Value, -\ref INF or \ref INF. deba@2366: virtual void _getRowBounds(int i, Value &lb, Value &ub) const; athos@2328: /// \e athos@2328: athos@2328: 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 deba@2366: virtual Value _getObjCoeff(int i) const; 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: /// deba@2366: virtual Value _getPrimal(int i) const; klao@1796: klao@1796: ///\e klao@1796: klao@1796: ///\bug Wrong interface klao@1796: /// deba@2366: virtual Value _getDual(int i) const; klao@1796: alpar@1294: ///\e alpar@1294: alpar@1294: ///\bug Wrong interface alpar@1294: /// deba@2366: virtual Value _getPrimalValue() const; klao@1796: alpar@1312: ///\e alpar@1312: alpar@1312: ///\bug Wrong interface alpar@1312: /// deba@2366: virtual SolutionStatus _getPrimalStatus() const; alpar@1312: athos@1460: ////e deba@2366: virtual SolutionStatus _getDualStatus() const; athos@1460: athos@1460: athos@1460: ///\e deba@2366: virtual ProblemTypes _getProblemType() const; athos@1460: alpar@1312: ///\e alpar@1312: virtual void _setMax(); alpar@1312: ///\e alpar@1312: virtual void _setMin(); alpar@1843: alpar@1843: ///\e deba@2366: virtual bool _isMax() const; athos@2324: athos@2324: athos@2324: athos@2324: ///\e deba@2366: virtual bool _isBasicCol(int i) const; 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