[FlopCpp] getStatus return false OPTIMAL

Tim Hultberg Tim.Hultberg at eumetsat.int
Mon May 14 15:21:34 EDT 2007


Hi Vishy,

Try using 

class myMP_model {
public:
    MP_model(OsiSolverInterface* s) : Solver(s) {}

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

in your code below instead of MP_model.  If the OsiCbcSolverInterface
behaves differently when called through the generic interface, you
should post it to the OSI list.

Cheers, Tim

>>> "Vishy Jeet" <vishv.jeet at gmail.com> 05/11/07 9:23 PM >>>
Hi Tim,

I am using an MPS file which is located at the following location:
http://uts.cc.utexas.edu/~jeetv/MIPproblem.mps (too big to be posted
here...)

when I am using the following code it returns the message isAbandoned
regardless
whether branchAndBound() is called or not....but if I use Cbc solver
directly, it returns the primal infeasibility. Could you check if the
status
functions (called in the code below) written OsiCbcSolverInterface() are
working properly..

regards,
vishy

#include "flopc.hpp"
using namespace flopc;
#include "OsiCbcSolverInterface.hpp"

int main() {
  MP_model my_knap(new OsiCbcSolverInterface);
  int num_err = 0;
  num_err = my_knap->readMps("MIPproblem");
  if(num_err != 0)
  cout << "errors reading MPS file\n";

  my_knap->branchAndBound();
//  my_knap.minimize(); // doesn't work and throws segmentation fault;
wonder why?

cout << "Num Cols:=" <<   my_knap->getNumCols()<<endl;
cout << "Num Rows:=" <<   my_knap->getNumRows()<<endl;

  if( my_knap->isProvenPrimalInfeasible() == true)
    cout << "primal infeasible\n";
  else if( my_knap->isProvenDualInfeasible() == true)
    cout << "dual infeasible\n";
  else if( my_knap->isAbandoned() == true)
    cout << "isAbandoned\n";
  else if( my_knap->isProvenOptimal() == true)
    cout << "isProvenOptimal\n";
  else if( my_knap->isDualObjectiveLimitReached() == true)
    cout << "isDualObjectiveLimitReached\n";
  else if( my_knap->isPrimalObjectiveLimitReached() == true)
    cout << "isPrimalObjectiveLimitReached\n";
  else if( my_knap->isIterationLimitReached() == true)
    cout << "isIterationLimitReached\n";
}





On 5/10/07, Tim Hultberg <Tim.Hultberg at eumetsat.int> wrote:
>
> First make sure that the wrong status comes from Cbc by trying
> instance->isProvenOptimal()
> Then post the question to the Cbc mailing list.
>
> You can also try your model with cplex as solver (i.e not via MPS
> file)
> and Cbc on the MPS file...
>
> Cheers, Tim
>
> >>> "Vishy Jeet" <vishv.jeet at gmail.com > 09/05/2007 18:32 >>>
> Hi Everyone,
>
> I am running the following little program. My class "dir" has a set of
> binary variables called "X".
> After minimization getStatus() return "OPTIMAL" while Xs are displayed
> as
> fractional. When I
> solve the mipModel.mps using CPLEX: it tells me the problem is
> infeasible! I
> don't understand
> why cbc solver is returning false message OPTIMAL. Any help on this is
> appreciated.
>
> regards,
> vishy
>
>
> #include "mathModel.h"
>
> typedef enum {SUCCESS = 0, FAILURE = -1};
>
> int main() {
> int retcode = FAILURE;
> container c;                                       /* container
> class
> object that will contains all data*/
> c.readData("c:/dataLocation");
> dir instance(c);                                /* Instantiate an
> object
> of dir class */
> instance.minimize();
> retcode = instance.getStatus();
> if (MP_model::OPTIMAL == retcode){
>    instance->writeMps("mipModel", "mps", 1.0);
>    instance.X.display("instance (X)");
>    cout<<"obj val:="<<instance->getObjValue()<<endl;
> }
> return SUCCESS;
> }// main
>



-- 
Best Regards,
Vishv Jeet, Ph.D.,
Operations Research Scientist,
Gravitant Inc.,
(The Business Governance Company)
http://www.gravitant.com
Austin, TX, USA.
Cell    : 1-512-657-8678
Home : 1-512-788-5795
Work  : 1-512-535-7399
_______________________
Youngest Music Meastro
http://www.mayanksahu.net



More information about the FlopCpp mailing list