[Cbc] copying a linear program

John Perry john.perry at usm.edu
Mon Dec 12 14:46:14 EST 2011


Hi

My apologies if I've sent this to the wrong list; let me know if so. (I tried 
Osi, but they didn't answer, so maybe that was the wrong place.)

I want to copy a linear program many times (several hundred). An examination 
of the source code suggests that this is the right approach:

#include "include/coin/OsiCbcSolverInterface.hpp"

int main() {
  OsiCbcSolverInterface * si = new OsiCbcSolverInterface(NULL);
  OsiCbcSolverInterface * newsi;
  
  for (int i = 0; i < 13; i++) {
    newsi = new OsiCbcSolverInterface(si);
    delete si;
    si = newsi;
  }
  
  while (true) {}
}

but even this empty linear program, copied only 13 times, causes exponential 
memory consumption, to the tune of hundreds of megabytes.

Am I going about this the wrong way, or is it a bug?

regards
john perry
-- 
John Perry
Associate Professor
Department of Mathematics, Box 5045
University of Southern Mississippi
Hattiesburg MS 39406
john.perry at usm.edu


More information about the Cbc mailing list