diff -r 736a341e604b -r eba5aa390aca lemon/clp.cc --- a/lemon/clp.cc Thu Jan 21 08:36:53 2021 +0100 +++ b/lemon/clp.cc Thu Jan 21 18:58:37 2021 +0100 @@ -227,14 +227,14 @@ } ClpLp::Value ClpLp::_getCoeff(int ix, int jx) const { - CoinBigIndex begin = _prob->clpMatrix()->getVectorStarts()[ix]; - CoinBigIndex end = begin + _prob->clpMatrix()->getVectorLengths()[ix]; + CoinBigIndex begin = _prob->clpMatrix()->getVectorStarts()[jx]; + CoinBigIndex end = begin + _prob->clpMatrix()->getVectorLengths()[jx]; const int* indices = _prob->clpMatrix()->getIndices(); const double* elements = _prob->clpMatrix()->getElements(); - const int* it = std::lower_bound(indices + begin, indices + end, jx); - if (it != indices + end && *it == jx) { + const int* it = std::lower_bound(indices + begin, indices + end, ix); + if (it != indices + end && *it == ix) { return elements[it - indices]; } else { return 0.0; @@ -461,4 +461,14 @@ } } + void ClpLp::_write(std::string file, std::string format) const + { + if(format == "LP") + _prob->writeLp(file.c_str(), "", 1e-5, 10, 5, + sense()==ClpLp::MIN?1:-1, + true + ); + else throw UnsupportedFormatError(format); + } + } //END OF NAMESPACE LEMON