[Osi] Bug with the problem name in the OsiGlPk

Bertrand Le Cun Bertrand.lecun at prism.uvsq.fr
Wed Oct 31 11:32:27 EDT 2012


I have tried to register and login to the Osi trac system but it makes 
an error.
I would like to write a ticket.
Anyway I have detect a bug in the OsiGlpk. This bug is due to a strange 
Glpk behaviour.

I have a code where I read an LP file where the problem name is empty.
And when you try to set the problem name with setStrParam with an empty 
name (i.e. ""), glpk delete the memory for its internal string and does 
not create a new one. Then many operations after like copy of the 
OsiGlpkSolverInterface object fail.

I correct the bug by using the following code for the setStrParam method
I am agree the problem comes from Glpk and not really from Osi.
But this a way to have a correct code...

Best regards,
Bertrand Le Cun.

bool OGSI::setStrParam (OsiStrParam key,
					  const std::string &value)
{ bool retval = false ;

   switch (key)
   { case OsiProbName:
     { probName_ = value ;
       if ( probName_.length()==0 ) probName_="Pb";
       lpx_set_prob_name(lp_,const_cast<char *>(probName_.c_str())) ;
       retval = true ;
       break ; }
     case OsiSolverName:
     { retval = true ;
       break ; }
     case OsiLastStrParam:
     { break ; } }

   return (retval) ; }

More information about the Osi mailing list