[FlopCpp] Model->writeLp("OsiSchedule"); crashes om CoinAll 1.3.0

Peter Sels sels.peter at gmail.com
Thu Nov 26 05:26:35 EST 2009


Hello All,

I am trying to debug my FlopCpp model, by dumping it as a lp file
(which is an easier read than the mps format).
However I get a EXC_BAD_ACCESS when I come at M.writeLp("MyOsiModel", "txt");
M.Solver->writeLp("MyOsiModel", "txt"); has the same problem.
Leaving out the "txt" argument makes no difference.

The code is as follows:

#define OSI_SOLVER OsiCbcSolverInterface
//#define OSI_SOLVER OsiSymSolverInterface
//#define OSI_SOLVER OsiVolSolverInterface
//#define OSI_SOLVER OsiDylpSolverInterface

#include "OsiSolverInterface.hpp"

#include "OsiCbcSolverInterface.hpp"
#include "OsiSymSolverInterface.hpp"
#include "OsiVolSolverInterface.hpp"
#include "OsiDylpSolverInterface.hpp"
#include "OsiClpSolverInterface.hpp"

// MP_set definitions ...
// MP_subset definitions ...
// MP_data definitions ...
// MP_variable definitions ...

MP_model M(new OSI_SOLVER);
M.verbose(); // silent or verbose

// MP_index definitions
// MP_constraints like
  MP_constraint runTime(prSubSet);
  runTime(prSubSet(p,ri)) =
  		bVar(prSubSet(p,ri)) + mData(p) == eVar(prSubSet(p,ri));
  M.add(runTime);

// and then

  MP_expression obj;
  obj = sum(cSet(c)*sSet(s), connCostData(c, s) * sBoolVar(c, s));

  cerr << "NOT Writing mps model file ..." << endl;
  //M->writeMps("OsiSchedule");
  //cerr << "Done writing mps" << endl;

  cerr << "Writing lp model file ..." << endl;
  M->writeLp("OsiSchedule"); /* run stops here with EXC_BAD_ACCESS
when it tries to access Solver */
  cerr << "Done writing lp" << endl;

  // minimize goal function
  M.minimize(obj);

--

So the compile and build goes fine,
but the run stops at M->writeLp("OsiSchedule");
with EXC_BAD_ACCESS when it tries to access Solver.
Solver seems to be valid however, and if I leave the writeLp out the
solver correctly solves
the problem.

I found similar code, also for FlopCpp calling Cbc via OSI, at
https://projects.coin-or.org/FlopC++/browser/trunk/FlopCpp/examples/CEPFlopCppModel.cpp?rev=110
where I suppose this lp dump works fine...

So I wonder if the calls have changed somehow or otherwise, what I am
doing wrong?
I am using version 1.3.0 of CoinAll for Linux/Mac.
All help is very welcome.

thanks,

-- 
Peter



More information about the FlopCpp mailing list