COIN-OR::LEMON - Graph Library

Changeset 902:d2bc45e8f6f2 in lemon for lemon/glpk.h


Ignore:
Timestamp:
02/14/10 23:14:09 (15 years ago)
Author:
Balazs Dezso <deba@…>
Branch:
default
Parents:
899:cc9e0c15d747 (diff), 900:5100072d83ca (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Phase:
public
Message:

Merge bugfix #337

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • lemon/glpk.h

    r793 r902  
    2626#include <lemon/lp_base.h>
    2727
    28 // forward declaration
    29 #if !defined _GLP_PROB && !defined GLP_PROB
    30 #define _GLP_PROB
    31 #define GLP_PROB
    32 typedef struct { double _opaque_prob; } glp_prob;
    33 /* LP/MIP problem object */
    34 #endif
    35 
    3628namespace lemon {
    3729
     30  namespace _solver_bits {
     31    class VoidPtr {
     32    private:
     33      void *_ptr;     
     34    public:
     35      VoidPtr() : _ptr(0) {}
     36
     37      template <typename T>
     38      VoidPtr(T* ptr) : _ptr(reinterpret_cast<void*>(ptr)) {}
     39
     40      template <typename T>
     41      VoidPtr& operator=(T* ptr) {
     42        _ptr = reinterpret_cast<void*>(ptr);
     43        return *this;
     44      }
     45
     46      template <typename T>
     47      operator T*() const { return reinterpret_cast<T*>(_ptr); }
     48    };
     49  }
    3850
    3951  /// \brief Base interface for the GLPK LP and MIP solver
     
    4456  protected:
    4557
    46     typedef glp_prob LPX;
    47     glp_prob* lp;
     58    _solver_bits::VoidPtr lp;
    4859
    4960    GlpkBase();
     
    124135
    125136    ///Pointer to the underlying GLPK data structure.
    126     LPX *lpx() {return lp;}
     137    _solver_bits::VoidPtr lpx() {return lp;}
    127138    ///Const pointer to the underlying GLPK data structure.
    128     const LPX *lpx() const {return lp;}
     139    _solver_bits::VoidPtr lpx() const {return lp;}
    129140
    130141    ///Returns the constraint identifier understood by GLPK.
  • lemon/glpk.h

    r900 r902  
    6666    virtual int _addCol();
    6767    virtual int _addRow();
     68    virtual int _addRow(Value l, ExprIterator b, ExprIterator e, Value u);
    6869
    6970    virtual void _eraseCol(int i);
Note: See TracChangeset for help on using the changeset viewer.