lp_glpk.h

Go to the documentation of this file.
00001 /* -*- C++ -*-
00002  *
00003  * This file is a part of LEMON, a generic C++ optimization library
00004  *
00005  * Copyright (C) 2003-2006
00006  * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
00007  * (Egervary Research Group on Combinatorial Optimization, EGRES).
00008  *
00009  * Permission to use, modify and distribute this software is granted
00010  * provided that this copyright notice appears in all copies. For
00011  * precise terms see the accompanying LICENSE file.
00012  *
00013  * This software is provided "AS IS" with no warranty of any kind,
00014  * express or implied, and with no claim as to its suitability for any
00015  * purpose.
00016  *
00017  */
00018 
00019 #ifndef LEMON_LP_GLPK_H
00020 #define LEMON_LP_GLPK_H
00021 
00025 
00026 #include <lemon/lp_base.h>
00027 extern "C" {
00028 #include <glpk.h>
00029 }
00030 
00031 namespace lemon {
00032 
00033 
00038   class LpGlpk : public LpSolverBase {
00039   protected:
00040     LPX* lp;
00041     
00042   public:
00043     
00044     typedef LpSolverBase Parent;
00045     
00046     LpGlpk();
00047     ~LpGlpk();
00048     
00049   protected:
00050     virtual LpSolverBase &_newLp();
00051     virtual LpSolverBase &_copyLp();
00052 
00053     virtual int _addCol();
00054     virtual int _addRow();
00055     virtual void _eraseCol(int i);
00056     virtual void _eraseRow(int i);
00057     virtual void _getColName(int col,       std::string & name);
00058     virtual void _setColName(int col, const std::string & name);
00059     virtual void _setRowCoeffs(int i, 
00060                                int length,
00061                                const int   * indices, 
00062                                const Value   * values );
00063     virtual void _setColCoeffs(int i, 
00064                                int length,
00065                                const int   * indices, 
00066                                const Value   * values);
00067     virtual void _setCoeff(int row, int col, Value value);
00068     virtual void _setColLowerBound(int i, Value value);
00069     virtual void _setColUpperBound(int i, Value value);
00070 //     virtual void _setRowLowerBound(int i, Value value);
00071 //     virtual void _setRowUpperBound(int i, Value value);
00072     virtual void _setRowBounds(int i, Value lower, Value upper);
00073     virtual void _setObjCoeff(int i, Value obj_coef);
00074     virtual void _clearObj();
00075 //     virtual void _setObj(int length,
00076 //                          int  const * indices, 
00077 //                          Value  const * values ) = 0;
00078 
00080     
00083     virtual SolveExitStatus _solve();
00084     virtual Value _getPrimal(int i);
00085     virtual Value _getDual(int i);
00086     virtual Value _getPrimalValue();
00087     virtual bool _isBasicCol(int i);
00089     
00092     virtual SolutionStatus _getPrimalStatus();
00093     virtual SolutionStatus _getDualStatus();
00094     virtual ProblemTypes _getProblemType();
00095 
00096     virtual void _setMax();
00097     virtual void _setMin();
00098 
00099   public:
00101 
00110     void messageLevel(int m);
00112 
00116     void presolver(bool b);
00117     
00118   };
00119 } //END OF NAMESPACE LEMON
00120 
00121 #endif //LEMON_LP_GLPK_H
00122 

Generated on Fri Feb 3 18:38:42 2006 for LEMON by  doxygen 1.4.6