src/work/athos/lp/lp_sample.cc
changeset 1354 5cb32ce3236a
parent 1318 88edb143a87a
equal deleted inserted replaced
1:e21cfab1ceef 2:361a18a3b84b
    35   lp.colLowerBound(x3, 0);
    35   lp.colLowerBound(x3, 0);
    36   //Objective function
    36   //Objective function
    37   lp.setObj(10*x1+6*x2+4*x3);
    37   lp.setObj(10*x1+6*x2+4*x3);
    38   
    38   
    39   lp.solve();
    39   lp.solve();
    40   
    40 
    41   printf("\nZ = %g; x1 = %g; x2 = %g; x3 = %g\n", 
    41   if (lp.primalStatus()==LpSolverBase::OPTIMAL){
    42 	 lp.primalValue(), 
    42     printf("Z = %g; x1 = %g; x2 = %g; x3 = %g\n", 
    43 	 lp.primal(x1), lp.primal(x2), lp.primal(x3));
    43 	   lp.primalValue(), 
       
    44 	   lp.primal(x1), lp.primal(x2), lp.primal(x3));
       
    45   }
       
    46   else{
       
    47     std::cout<<"Optimal solution not found!"<<std::endl;
       
    48   }
       
    49 
    44 
    50 
    45   //Here comes the same problem written in C using GLPK API routines
    51   //Here comes the same problem written in C using GLPK API routines
    46 
    52 
    47 //   LPX *lp;
    53 //   LPX *lp;
    48 //       int ia[1+1000], ja[1+1000];
    54 //       int ia[1+1000], ja[1+1000];