Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimising with bounds only lead to instabilities #340

Closed
icze opened this issue Sep 30, 2020 · 7 comments
Closed

Optimising with bounds only lead to instabilities #340

icze opened this issue Sep 30, 2020 · 7 comments

Comments

@icze
Copy link

icze commented Sep 30, 2020

Hi,

using the Cbc C interface (of Cbc 2.10.3) to solve a small model leads to an exception Corrupted start stamp for heap block. in void ClpModel::gutsOfDelete(int type) (called by ClpModel::~ClpModel()) when debugging my program. The method seem to try to delete an already deleted or not initalised ray:

delete[] ray_;

Here the model:

NAME          BLANK   
ROWS
 N  OBJROW
COLUMNS
    C0000001  OBJROW    0.0043124177
    C0000003  OBJROW    -0.00121674 
    C0000005  OBJROW    0.0013171039
    C0000007  OBJROW    0.0499413387
    C0000009  OBJROW    0.0138910224
    C0000013  OBJROW    0.0037925901
    C0000017  OBJROW    0.0199867314
    C0000019  OBJROW    -0.014416763
    C0000021  OBJROW    0.0508741733
RHS
BOUNDS
 FR BOUND     C0000001         1e+30
 FR BOUND     C0000003         1e+30
 FR BOUND     C0000005         1e+30
 FR BOUND     C0000007         1e+30
 FR BOUND     C0000009         1e+30
 FR BOUND     C0000013         1e+30
 FR BOUND     C0000017         1e+30
 FR BOUND     C0000019         1e+30
 FR BOUND     C0000021         1e+30
ENDATA

and the code:

  Cbc_Model* model = CBC_newModel();
  int error = CBC_readMps(model, "D:\\m.mps");
  if (error) {
    CBC_deleteModel(model);
    return;
  }
  error = CBC_solve(model);
  CBC_deleteModel(model);

Regards!
Ingo

@jjhforrest
Copy link
Contributor

jjhforrest commented Oct 1, 2020 via email

@icze
Copy link
Author

icze commented Oct 2, 2020

Hi Mr. Forrest,

thanks for your help. I re-tested it on a newly build of Cbc 2.10.5 but problem is still there.
So, I started debugging and probably found the heap corruption:

Within the function ClpModel::emptyProblem() I found the following lines:

  if (returnCode == 2) {
    // create ray
    delete[] ray_;
    ray_ = new double[numberColumns_];
    CoinZeroN(ray_, numberColumns_);
    ray_[badColumn] = badValue;
  }

With the given example badColumn is -1 and therefore the heap is corrupted.

Regards!
Ingo

@odow
Copy link

odow commented Oct 7, 2020

Fixed in latest Clp: coin-or/Clp#142

@icze
Copy link
Author

icze commented Oct 8, 2020

Thanks Oscar.

So, will the upcoming Cbc 2.10.6 use the new Clp 1.17.6 ?

@tkralphs
Copy link
Member

tkralphs commented Oct 8, 2020

Yes, the upcoming Cbc 2.10.6 use the Clp 1.17.6 (or whatever its latest release is by then), but I did want to also point out that coinbrew makes it easy to check out the latest compatible releases of dependencies to obviate the need for making releases of downstream projects solely for the purpose of incorporating changes in upstream projects. This is in concert with our effort to de-couple the projects in the Optimization Suite and in concert with the way package managers work generally. The incantation

coinbrew fetch Cbc --latest-release

should fetch Cbc 2.10.5, along with Clp 1.17.6. With that said, there should be a 2.10.6 release soonish.

@icze
Copy link
Author

icze commented Oct 13, 2020

Hi Ted, thanks for your answer. I'll see if I get it run on Windows ...

@tkralphs
Copy link
Member

Building on Windows is a bit more challenging, but if you follow the links to documentation in the README, there are pretty detailed instructions. You can also grab pre-built binaries on Bintray. I just kicked off a new build of 2.10, which should incorporate the fix. In a few hours, you can grab fresh binaries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants