A little modification: a call for primalStatus().
authorathos
Mon, 11 Apr 2005 14:26:35 +0000
changeset 1338b261caf79ce7
parent 1337 6b2bdd70fe99
child 1339 26a88d12d1a6
A little modification: a call for primalStatus().
src/work/athos/lp/lp_sample.cc
     1.1 --- a/src/work/athos/lp/lp_sample.cc	Sun Apr 10 16:26:26 2005 +0000
     1.2 +++ b/src/work/athos/lp/lp_sample.cc	Mon Apr 11 14:26:35 2005 +0000
     1.3 @@ -37,10 +37,16 @@
     1.4    lp.setObj(10*x1+6*x2+4*x3);
     1.5    
     1.6    lp.solve();
     1.7 -  
     1.8 -  printf("\nZ = %g; x1 = %g; x2 = %g; x3 = %g\n", 
     1.9 -	 lp.primalValue(), 
    1.10 -	 lp.primal(x1), lp.primal(x2), lp.primal(x3));
    1.11 +
    1.12 +  if (lp.primalStatus()==LpSolverBase::OPTIMAL){
    1.13 +    printf("Z = %g; x1 = %g; x2 = %g; x3 = %g\n", 
    1.14 +	   lp.primalValue(), 
    1.15 +	   lp.primal(x1), lp.primal(x2), lp.primal(x3));
    1.16 +  }
    1.17 +  else{
    1.18 +    std::cout<<"Optimal solution not found!"<<std::endl;
    1.19 +  }
    1.20 +
    1.21  
    1.22    //Here comes the same problem written in C using GLPK API routines
    1.23