[Lemon-commits] [lemon_svn] klao: r2525 - hugo/trunk/lemon

Lemon SVN svn at lemon.cs.elte.hu
Mon Nov 6 20:53:16 CET 2006


Author: klao
Date: Fri Feb  3 13:20:10 2006
New Revision: 2525

Modified:
   hugo/trunk/lemon/lp_cplex.cc

Log:
lp_cplex.cc: bugfix in _setColName, _getColName implemented


Modified: hugo/trunk/lemon/lp_cplex.cc
==============================================================================
--- hugo/trunk/lemon/lp_cplex.cc	(original)
+++ hugo/trunk/lemon/lp_cplex.cc	Fri Feb  3 13:20:10 2006
@@ -83,13 +83,26 @@
   
   void LpCplex::_getColName(int col, std::string &name)
   {
-    ///\bug Unimplemented
+    ///\bug Untested
+    int storespace;
+    CPXgetcolname(env, lp, 0, 0, 0, &storespace, col, col);
+
+    storespace *= -1;
+    char buf[storespace];
+    char *names[1];
+    int dontcare;
+    ///\bug return code unchecked for error
+    CPXgetcolname(env, lp, names, buf, storespace, &dontcare, col, col);
+    name = names[0];
   }
   
   void LpCplex::_setColName(int col, const std::string &name)
   {
     ///\bug Untested
-    CPXchgcolname(env, lp, 1, &col, const_cast<char*>(name.c_str()));
+    char *names[1];
+    names[0] = const_cast<char*>(name.c_str());
+    ///\bug return code unchecked for error
+    CPXchgcolname(env, lp, 1, &col, names);    
   }
   
   ///\warning Data at index 0 is ignored in the arrays.



More information about the Lemon-commits mailing list