COIN-OR::LEMON - Graph Library

Changeset 1048:38a49245a701 in lemon-0.x for src/work/marci/lp


Ignore:
Timestamp:
01/04/05 18:54:41 (19 years ago)
Author:
marci
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1442
Message:

minor changes for various number types

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/work/marci/lp/lp_solver_wrapper_2.h

    r1031 r1048  
    160160  /*! \e
    161161   */
     162  template <typename _Value>
    162163  class LPSolverBase {
    163164  public:
     165    /// \e
     166    typedef _Value Value;
    164167    /// \e
    165168    typedef IterablePartition<int>::ClassIt RowIt;
     
    192195    /// temporally, glpk style indexing
    193196    virtual void setRowCoeffs(RowIt row_it, int num,
    194                               int* indices, double* doubles) = 0;
    195     //pair<RowIt, double>-bol kell megadni egy std range-et
     197                              int* indices, _Value* doubles) = 0;
     198    //pair<RowIt, _Value>-bol kell megadni egy std range-et
    196199    /// \e
    197200    template <typename Begin, typename End>
     
    199202      int mem_length=1+colNum();
    200203      int* indices = new int[mem_length];
    201       double* doubles = new double[mem_length];
     204      _Value* doubles = new _Value[mem_length];
    202205      int length=0;
    203206      for ( ; begin!=end; ++begin) {
     
    212215    /// temporally, glpk style indexing
    213216    virtual void setColCoeffs(ColIt col_it, int num,
    214                               int* indices, double* doubles) = 0;
    215     //pair<ColIt, double>-bol kell megadni egy std range-et
     217                              int* indices, _Value* doubles) = 0;
     218    //pair<ColIt, _Value>-bol kell megadni egy std range-et
    216219    /// \e
    217220    template <typename Begin, typename End>
     
    219222      int mem_length=1+rowNum();
    220223      int* indices = new int[mem_length];
    221       double* doubles = new double[mem_length];
     224      _Value* doubles = new _Value[mem_length];
    222225      int length=0;
    223226      for ( ; begin!=end; ++begin) {
     
    236239    /// \e
    237240    virtual void setColBounds(const ColIt& col_it, int bound_type,
    238                               double lo, double up) =0;
    239     /// \e
    240     virtual double getObjCoef(const ColIt& col_it) = 0;
     241                              _Value lo, _Value up) =0;
     242    /// \e
     243    virtual _Value getObjCoef(const ColIt& col_it) = 0;
    241244    /// \e
    242245    virtual void setRowBounds(const RowIt& row_it, int bound_type,
    243                               double lo, double up) = 0;
    244     /// \e
    245     virtual void setObjCoef(const ColIt& col_it, double obj_coef) = 0;
     246                              _Value lo, _Value up) = 0;
     247    /// \e
     248    virtual void setObjCoef(const ColIt& col_it, _Value obj_coef) = 0;
    246249    /// \e
    247250    virtual void solveSimplex() = 0;
     
    251254    virtual void solveDualSimplex() = 0;
    252255    /// \e
    253     virtual double getPrimal(const ColIt& col_it) = 0;
    254     /// \e
    255     virtual double getObjVal() = 0;
     256    virtual _Value getPrimal(const ColIt& col_it) = 0;
     257    /// \e
     258    virtual _Value getObjVal() = 0;
    256259    /// \e
    257260    virtual int rowNum() const = 0;
     
    280283  };
    281284 
     285
    282286  /// \brief Wrappers for LP solvers
    283287  ///
     
    287291  /// solvers, i.e. it makes possible to write algorithms using LP's,
    288292  /// in which the solver can be changed to an other one easily.
    289   class LPSolverWrapper : public LPSolverBase {
    290   public:
    291     typedef LPSolverBase Parent;
     293  class LPSolverWrapper : public LPSolverBase<double> {
     294  public:
     295    typedef LPSolverBase<double> Parent;
    292296
    293297    //   class Row {
     
    324328  public:
    325329    /// \e
    326     LPSolverWrapper() : LPSolverBase(),
     330    LPSolverWrapper() : Parent(),
    327331                        lp(lpx_create_prob()) {
    328332      lpx_set_int_parm(lp, LPX_K_DUAL, 1);
Note: See TracChangeset for help on using the changeset viewer.