lemon/lp_cplex.cc
changeset 2364 3a5e67bd42d2
parent 2363 2aabce558574
child 2366 bfbdded3763a
equal deleted inserted replaced
20:0bef5c84984e 21:9940554549da
   107     ///\bug return code unchecked for error
   107     ///\bug return code unchecked for error
   108     CPXchgcolname(env, lp, 1, &col, names);    
   108     CPXchgcolname(env, lp, 1, &col, names);    
   109   }
   109   }
   110   
   110   
   111   ///\warning Data at index 0 is ignored in the arrays.
   111   ///\warning Data at index 0 is ignored in the arrays.
   112   void LpCplex::_setRowCoeffs(int i, LpRowIterator b, LpRowIterator e)
   112   void LpCplex::_setRowCoeffs(int i, ConstRowIterator b, ConstRowIterator e)
   113   {
   113   {
   114     std::vector<int> indices;
   114     std::vector<int> indices;
   115     std::vector<int> rowlist;
   115     std::vector<int> rowlist;
   116     std::vector<Value> values;
   116     std::vector<Value> values;
   117 
   117 
   118     for(LpRowIterator it=b; it!=e; ++it) {
   118     for(ConstRowIterator it=b; it!=e; ++it) {
   119       indices.push_back(it->first);
   119       indices.push_back(it->first);
   120       values.push_back(it->second);
   120       values.push_back(it->second);
   121       rowlist.push_back(i);
   121       rowlist.push_back(i);
   122     }
   122     }
   123 
   123 
   124     status = CPXchgcoeflist(env, lp, values.size(), 
   124     status = CPXchgcoeflist(env, lp, values.size(), 
   125 			    &rowlist[0], &indices[0], &values[0]); 
   125 			    &rowlist[0], &indices[0], &values[0]); 
   126   }
   126   }
   127   
   127 
   128   void LpCplex::_setColCoeffs(int i, LpColIterator b, LpColIterator e)
   128   void LpSoplex::_getRowCoeffs(int i, RowIterator b) {
       
   129     /// \todo implement
       
   130   }
       
   131   
       
   132   void LpCplex::_setColCoeffs(int i, ConstColIterator b, ConstColIterator e)
   129   {
   133   {
   130     std::vector<int> indices;
   134     std::vector<int> indices;
   131     std::vector<int> collist;
   135     std::vector<int> collist;
   132     std::vector<Value> values;
   136     std::vector<Value> values;
   133 
   137 
   134     for(LpColIterator it=b; it!=e; ++it) {
   138     for(ConstColIterator it=b; it!=e; ++it) {
   135       indices.push_back(it->first);
   139       indices.push_back(it->first);
   136       values.push_back(it->second);
   140       values.push_back(it->second);
   137       collist.push_back(i);
   141       collist.push_back(i);
   138     }
   142     }
   139 
   143 
   140     status = CPXchgcoeflist(env, lp, values.size(), 
   144     status = CPXchgcoeflist(env, lp, values.size(), 
   141 			    &indices[0], &collist[0], &values[0]); 
   145 			    &indices[0], &collist[0], &values[0]); 
       
   146   }
       
   147 
       
   148   void LpSoplex::_getColCoeffs(int i, ColIterator b) {
       
   149     /// \todo implement
   142   }
   150   }
   143   
   151   
   144   void LpCplex::_setCoeff(int row, int col, Value value) 
   152   void LpCplex::_setCoeff(int row, int col, Value value) 
   145   {
   153   {
   146     CPXchgcoef(env, lp, row, col, value);
   154     CPXchgcoef(env, lp, row, col, value);