[FlopCpp] Which MP_model statement?

Michal Kaut mail at michalkaut.net
Mon Jun 11 02:35:38 EDT 2007


Hello,

I looked at the FlopC++ examples and found (at least) four different 
ways of defining an MP_model object. Is there any difference between 
these methods, esp. in compilation/runtime speed?
Is there a recommended way of doing things or, put it different way, are 
some of the examples "cleaner" than others?

1. (for ex. coex.cpp): Using statement
MP_model::getDefaultModel().setSolver(new OsiCbcSolverInterface);
at the beginning of the file. No ".add" statements are needed - and 
indeed possible, since the object does not have a name(?)

2. (for ex. ampl.cpp): Using statement
MP_model &model = MP_model::getDefaultModel();
Like before, except that the object has a name.

3. (for ex. bid.cpp): Using statement
MP_model bid(new OsiCbcSolverInterface);
at the start of the file. Like 2., except that it uses a different 
constructor(?)

4. (for ex. aircraft.cpp): Using the same construction as in 3., i.e.
MP_model m1(new OsiCbcSolverInterface);
but this time AFTER the definitions of variables and constraints. In 
this case, all the constraints have to be added using ".add()".
I have also noticed that in this case, all the constraints are reported 
twice (during the runtime, to stdout).


Thanks a lot in advance.


Regards,
Michal Kaut


More information about the FlopCpp mailing list