COIN-OR::LEMON - Graph Library

Changeset 2312:07e46cbb7d85 in lemon-0.x for lemon/lp_cplex.cc


Ignore:
Timestamp:
11/29/06 16:01:13 (17 years ago)
Author:
Balazs Dezso
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@3088
Message:

modified _setColCoeff and _setRowCoeff parameters
const simplify() for expressions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/lp_cplex.cc

    r2218 r2312  
    110110 
    111111  ///\warning Data at index 0 is ignored in the arrays.
    112   void LpCplex::_setRowCoeffs(int i,
    113                               int length,
    114                               int  const * indices,
    115                               Value  const * values )
    116   {
    117     int rowlist[length+1];
    118     int* p=rowlist;
    119     for (int k=1;k<=length;++k){
    120       rowlist[k]=i;
    121     }
    122     status = CPXchgcoeflist(env, lp,
    123                             length,
    124                             p+1,
    125                             const_cast<int * >(indices+1),
    126                             const_cast<Value * >(values+1));
    127   }
    128  
    129   void LpCplex::_setColCoeffs(int i,
    130                               int length,
    131                               int  const * indices,
    132                               Value  const * values)
    133   {
    134     int collist[length+1];
    135     int* p=collist;
    136     for (int k=1;k<=length;++k){
    137       collist[k]=i;
    138     }
    139     status = CPXchgcoeflist(env, lp,
    140                             length,
    141                             const_cast<int * >(indices+1),
    142                             p+1,
    143                             const_cast<Value * >(values+1));
     112  void LpCplex::_setRowCoeffs(int i, LpRowIterator b, LpRowIterator e)
     113  {
     114    std::vector<int> indices;
     115    std::vector<int> rowlist;
     116    std::vector<Value> values;
     117
     118    for(LpRowIterator it=b; it!=e; ++it) {
     119      indices.push_back(it->first);
     120      values.push_back(it->second);
     121      rowlist.push_back(i);
     122    }
     123
     124    status = CPXchgcoeflist(env, lp, values.size(),
     125                            &rowlist[0], &indices[0], &values[0]);
     126  }
     127 
     128  void LpCplex::_setColCoeffs(int i, LpColIterator b, LpColIterator e)
     129  {
     130    std::vector<int> indices;
     131    std::vector<int> collist;
     132    std::vector<Value> values;
     133
     134    for(LpColIterator it=b; it!=e; ++it) {
     135      indices.push_back(it->first);
     136      values.push_back(it->second);
     137      collist.push_back(i);
     138    }
     139
     140    status = CPXchgcoeflist(env, lp, values.size(),
     141                            &indices[0], &collist[0], &values[0]);
    144142  }
    145143 
Note: See TracChangeset for help on using the changeset viewer.