[Coin-lpsolver] hitMaximumIterations() problems?

Kish Shen kish.shen at crosscoreop.com
Tue Jul 11 18:08:11 EDT 2006


Hi,

I am using ClpModel's hitMaximumIterations() to see if my previous solve was 
aborted due to hitting iteration or maximum time limits. However, it was 
returning false when the problem was definitely stopped due to hitting the 
time limit.

Looking at the code for hitMaximumIterations():

  bool hitMax = (numberIterations_ >= intParam_[ClpMaxNumIteration]);
  if (dblParam_[ClpMaxSeconds]>=0.0&&!hitMax)
    hitMax = (CoinCpuTime()>=dblParam_[ClpMaxSeconds]);
  return hitMax;

the code seem to assume that neither ClpMaxNumIteration or ClpMaxSeconds have 
been changed since the previous solve. However, it is  possible to change 
them, and in my code, I reset the ClpMaxSeconds immediately after the call to 
solve the LP problem (I am doing this because I am using the Clp solver to 
solve both MIP and LP problems (MIP problem with Cbc using the Clp solver), 
and if ClpMaxSeconds is not reset, this can confuse Cbc, as I reported in a 
post to the Coin-discuss  list). 

I can get around this problem by resetting ClpMaxSeconds later, but should 
ClpModel keep a flag to indicate if the previous solve hit some limit, 
instead of trying to compute this as above?

Cheers,

Kish Shen




More information about the Clp mailing list