lemon/cplex.cc
changeset 754 2de0fc630899
parent 576 745e182d0139
child 877 141f9c0db4a3
equal deleted inserted replaced
4:6743144e9c8f 5:6dea27210095
   109     const char s = 'L';
   109     const char s = 'L';
   110     CPXnewrows(cplexEnv(), _prob, 1, &ub, &s, 0, 0);
   110     CPXnewrows(cplexEnv(), _prob, 1, &ub, &s, 0, 0);
   111     return i;
   111     return i;
   112   }
   112   }
   113 
   113 
       
   114   int CplexBase::_addRow(Value lb, ExprIterator b, 
       
   115                          ExprIterator e, Value ub) {
       
   116     int i = CPXgetnumrows(cplexEnv(), _prob);
       
   117     if (lb == -INF) {
       
   118       const char s = 'L';
       
   119       CPXnewrows(cplexEnv(), _prob, 1, &ub, &s, 0, 0);
       
   120     } else if (ub == INF) {
       
   121       const char s = 'G';
       
   122       CPXnewrows(cplexEnv(), _prob, 1, &lb, &s, 0, 0);
       
   123     } else if (lb == ub){
       
   124       const char s = 'E';
       
   125       CPXnewrows(cplexEnv(), _prob, 1, &lb, &s, 0, 0);
       
   126     } else {
       
   127       const char s = 'R';
       
   128       double len = ub - lb;
       
   129       CPXnewrows(cplexEnv(), _prob, 1, &lb, &s, &len, 0);
       
   130     }
       
   131 
       
   132     std::vector<int> indices;
       
   133     std::vector<int> rowlist;
       
   134     std::vector<Value> values;
       
   135 
       
   136     for(ExprIterator it=b; it!=e; ++it) {
       
   137       indices.push_back(it->first);
       
   138       values.push_back(it->second);
       
   139       rowlist.push_back(i);
       
   140     }
       
   141 
       
   142     CPXchgcoeflist(cplexEnv(), _prob, values.size(),
       
   143                    &rowlist.front(), &indices.front(), &values.front());
       
   144 
       
   145     return i;
       
   146   }
   114 
   147 
   115   void CplexBase::_eraseCol(int i) {
   148   void CplexBase::_eraseCol(int i) {
   116     CPXdelcols(cplexEnv(), _prob, i, i);
   149     CPXdelcols(cplexEnv(), _prob, i, i);
   117   }
   150   }
   118 
   151