COIN-OR::LEMON - Graph Library

Changeset 2386:81b47fc5c444 in lemon-0.x for lemon/lp_glpk.cc


Ignore:
Timestamp:
03/02/07 19:04:28 (17 years ago)
Author:
Balazs Dezso
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@3217
Message:

Hard Warning checking

  • based on the remark of the ZIB user
  • we do not use -Winline
File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/lp_glpk.cc

    r2368 r2386  
    104104 
    105105  void LpGlpk::_eraseCol(int i) {
    106     int cols[2];
    107     cols[1]=i;
    108     lpx_del_cols(lp, 1, cols);
     106    int ca[2];
     107    ca[1]=i;
     108    lpx_del_cols(lp, 1, ca);
    109109  }
    110110 
    111111  void LpGlpk::_eraseRow(int i) {
    112     int rows[2];
    113     rows[1]=i;
    114     lpx_del_rows(lp, 1, rows);
    115   }
    116 
    117   void LpGlpk::_getColName(int col, std::string & name) const
    118   {
    119    
    120     char *n = lpx_get_col_name(lp,col);
     112    int ra[2];
     113    ra[1]=i;
     114    lpx_del_rows(lp, 1, ra);
     115  }
     116
     117  void LpGlpk::_getColName(int c, std::string & name) const
     118  {
     119   
     120    char *n = lpx_get_col_name(lp,c);
    121121    name = n?n:"";
    122122  }
    123123 
    124124 
    125   void LpGlpk::_setColName(int col, const std::string & name)
    126   {
    127     lpx_set_col_name(lp,col,const_cast<char*>(name.c_str()));
     125  void LpGlpk::_setColName(int c, const std::string & name)
     126  {
     127    lpx_set_col_name(lp,c,const_cast<char*>(name.c_str()));
    128128
    129129  }
     
    152152  }
    153153
    154   void LpGlpk::_getRowCoeffs(int i, RowIterator b) const
    155   {
    156     int length = lpx_get_mat_row(lp, i, 0, 0);
     154  void LpGlpk::_getRowCoeffs(int ix, RowIterator b) const
     155  {
     156    int length = lpx_get_mat_row(lp, ix, 0, 0);
    157157   
    158158    std::vector<int> indices(length + 1);
    159159    std::vector<Value> values(length + 1);
    160160   
    161     lpx_get_mat_row(lp, i, &indices[0], &values[0]);
     161    lpx_get_mat_row(lp, ix, &indices[0], &values[0]);
    162162   
    163163    for (int i = 1; i <= length; ++i) {
     
    167167  }
    168168 
    169   void LpGlpk::_setColCoeffs(int i, ConstColIterator b, ConstColIterator e) {
     169  void LpGlpk::_setColCoeffs(int ix, ConstColIterator b, ConstColIterator e) {
    170170
    171171    std::vector<int> indices;
     
    180180    }
    181181   
    182     lpx_set_mat_col(lp, i, values.size() - 1, &indices[0], &values[0]);
    183   }
    184 
    185   void LpGlpk::_getColCoeffs(int i, ColIterator b) const
    186   {
    187     int length = lpx_get_mat_col(lp, i, 0, 0);
     182    lpx_set_mat_col(lp, ix, values.size() - 1, &indices[0], &values[0]);
     183  }
     184
     185  void LpGlpk::_getColCoeffs(int ix, ColIterator b) const
     186  {
     187    int length = lpx_get_mat_col(lp, ix, 0, 0);
    188188   
    189189    std::vector<int> indices(length + 1);
    190190    std::vector<Value> values(length + 1);
    191191   
    192     lpx_get_mat_col(lp, i, &indices[0], &values[0]);
     192    lpx_get_mat_col(lp, ix, &indices[0], &values[0]);
    193193   
    194194    for (int i = 1; i <= length; ++i) {
     
    198198  }
    199199
    200   void LpGlpk::_setCoeff(int row, int col, Value value)
     200  void LpGlpk::_setCoeff(int ix, int jx, Value value)
    201201  {
    202202
    203203    if (lpx_get_num_cols(lp) < lpx_get_num_rows(lp)) {
    204204
    205       int length=lpx_get_mat_row(lp, row, 0, 0);
     205      int length=lpx_get_mat_row(lp, ix, 0, 0);
    206206     
    207207      std::vector<int> indices(length + 2);
    208208      std::vector<Value> values(length + 2);
    209209     
    210       lpx_get_mat_row(lp, row, &indices[0], &values[0]);
     210      lpx_get_mat_row(lp, ix, &indices[0], &values[0]);
    211211     
    212212      //The following code does not suppose that the elements of the
     
    214214      bool found=false;
    215215      for (int i = 1; i <= length; ++i) {
    216         if (indices[i]==col){
     216        if (indices[i]==jx){
    217217          found=true;
    218218          values[i]=value;
     
    222222      if (!found){
    223223        ++length;
    224         indices[length]=col;
     224        indices[length]=jx;
    225225        values[length]=value;
    226226      }
    227227   
    228       lpx_set_mat_row(lp, row, length, &indices[0], &values[0]);
     228      lpx_set_mat_row(lp, ix, length, &indices[0], &values[0]);
    229229
    230230    } else {
    231231
    232       int length=lpx_get_mat_col(lp, col, 0, 0);
     232      int length=lpx_get_mat_col(lp, jx, 0, 0);
    233233     
    234234      std::vector<int> indices(length + 2);
    235235      std::vector<Value> values(length + 2);
    236236     
    237       lpx_get_mat_col(lp, col, &indices[0], &values[0]);
     237      lpx_get_mat_col(lp, jx, &indices[0], &values[0]);
    238238     
    239239      //The following code does not suppose that the elements of the
     
    241241      bool found=false;
    242242      for (int i = 1; i <= length; ++i) {
    243         if (indices[i]==col){
     243        if (indices[i]==jx){
    244244          found=true;
    245245          values[i]=value;
     
    249249      if (!found){
    250250        ++length;
    251         indices[length]=row;
     251        indices[length]=ix;
    252252        values[length]=value;
    253253      }
    254254   
    255       lpx_set_mat_col(lp, col, length, &indices[0], &values[0]);
    256     }
    257   }
    258 
    259   LpGlpk::Value LpGlpk::_getCoeff(int row, int col) const
    260   {
    261 
    262     int length=lpx_get_mat_row(lp, row, 0, 0);
     255      lpx_set_mat_col(lp, jx, length, &indices[0], &values[0]);
     256    }
     257  }
     258
     259  LpGlpk::Value LpGlpk::_getCoeff(int ix, int jx) const
     260  {
     261
     262    int length=lpx_get_mat_row(lp, ix, 0, 0);
    263263   
    264264    std::vector<int> indices(length + 1);
    265265    std::vector<Value> values(length + 1);
    266266   
    267     lpx_get_mat_row(lp, row, &indices[0], &values[0]);
     267    lpx_get_mat_row(lp, ix, &indices[0], &values[0]);
    268268   
    269269    //The following code does not suppose that the elements of the
    270270    //array indices are sorted
    271271    for (int i = 1; i <= length; ++i) {
    272       if (indices[i]==col){
     272      if (indices[i]==jx){
    273273        return values[i];
    274274      }
Note: See TracChangeset for help on using the changeset viewer.