[FlopCpp] FlopC++ contributes/question

Gaetano Mendola mendola at gmail.com
Wed Feb 24 18:20:55 EST 2010


Hi all,
I'm using FlopC++ and I'm facing some problems and I'm solving them in my
checkout. What is the procedure to submit those changes ?

Some questions related to code.

MP_set has a static member named Empty, and this is initialized dereferencing a
an MP_set allocated on the heap:

 MP_set MP_set::Empty = *new MP_set(1);

 MP_set &MP_set::getEmpty() {
   return Empty;
 }

why using the heap?
why do not get rid of the static Empty member? And then rewrite the
getEmpty like this

 MP_set &MP_set::getEmpty() {
   static MP_set Empty(1);
   return Empty;
 }

also if that set represent an empty set why do not return it as a const?

Same concept is valid for MP_index.

I have already modified MP_set and MP_index and now valgrind has some
less complains.

I think also that MP_Model is missing the following method:

const OsiSolverInterface* operator->() const {
 return Solver;
}

indeed I had to make a MP_model member inside one of my application
classes as mutable in order
to call that operator (I was going to call a const method of
OsiSolverInterface).


I'm facing also some crashes, I haven't still understood why but I
think is due the fact that a MP_model
instance is destroyed (it exit from the scope) and then declaring a
MP_constraint it still (somehow) to use
that old MP_model.

I think as first post in this list is long enough :D

Regards
Gaetano Mendola

-- 
cpp-today.blogspot.com



More information about the FlopCpp mailing list