[Coin-discuss] Bounds Checking
Joseph Young
josyoun at nmt.edu
Thu Jul 29 16:56:26 EDT 2004
Right now, there does not appear to be any bounds checking in
COIN. For example, you are allowed set the objective coefficient of a a
collumn that doesn't exist. While some solvers recover gracefully, like
glpk, others don't, such as clp. Would this be too difficult to add?
Here is some sample code that will crash clp:
#include"CoinPackedVector.hpp"
#include"OsiClpSolverInterface.hpp"
typedef OsiClpSolverInterface OsiXxxSolverInterface;
int main(){
double rZero = 0;
int iZero = 0;
OsiXxxSolverInterface *clsLp=new OsiXxxSolverInterface;
double inf = clsLp->getInfinity();
clsLp->loadProblem(0, 0, &iZero, &iZero, &rZero,
&rZero, &rZero, &rZero, &rZero, &rZero);
clsLp->addCol(CoinPackedVector(),-inf,inf,0);
clsLp->setObjCoeff(2000,0.); //This line indexes a col that doesn't exist
delete clsLp;
}
Sinc, Joseph Young
More information about the Coin-discuss
mailing list