lp_cplex.cc: bugfix in _setColName, _getColName implemented
authorklao
Fri, 03 Feb 2006 12:20:10 +0000
changeset 1950a1a6f5b788bd
parent 1949 5db4ff8d69de
child 1951 cb7a6e0573bc
lp_cplex.cc: bugfix in _setColName, _getColName implemented
lemon/lp_cplex.cc
     1.1 --- a/lemon/lp_cplex.cc	Fri Feb 03 09:18:17 2006 +0000
     1.2 +++ b/lemon/lp_cplex.cc	Fri Feb 03 12:20:10 2006 +0000
     1.3 @@ -83,13 +83,26 @@
     1.4    
     1.5    void LpCplex::_getColName(int col, std::string &name)
     1.6    {
     1.7 -    ///\bug Unimplemented
     1.8 +    ///\bug Untested
     1.9 +    int storespace;
    1.10 +    CPXgetcolname(env, lp, 0, 0, 0, &storespace, col, col);
    1.11 +
    1.12 +    storespace *= -1;
    1.13 +    char buf[storespace];
    1.14 +    char *names[1];
    1.15 +    int dontcare;
    1.16 +    ///\bug return code unchecked for error
    1.17 +    CPXgetcolname(env, lp, names, buf, storespace, &dontcare, col, col);
    1.18 +    name = names[0];
    1.19    }
    1.20    
    1.21    void LpCplex::_setColName(int col, const std::string &name)
    1.22    {
    1.23      ///\bug Untested
    1.24 -    CPXchgcolname(env, lp, 1, &col, const_cast<char*>(name.c_str()));
    1.25 +    char *names[1];
    1.26 +    names[0] = const_cast<char*>(name.c_str());
    1.27 +    ///\bug return code unchecked for error
    1.28 +    CPXchgcolname(env, lp, 1, &col, names);    
    1.29    }
    1.30    
    1.31    ///\warning Data at index 0 is ignored in the arrays.