lemon/lp_cplex.cc
changeset 1542 0219ee65ffcc
parent 1508 389a94a1d9eb
child 1787 932b8490caf0
     1.1 --- a/lemon/lp_cplex.cc	Thu Jul 07 09:04:39 2005 +0000
     1.2 +++ b/lemon/lp_cplex.cc	Thu Jul 07 15:00:04 2005 +0000
     1.3 @@ -242,6 +242,7 @@
     1.4    {
     1.5      //CPX_PARAM_LPMETHOD 
     1.6      status = CPXlpopt(env, lp);
     1.7 +    //status = CPXprimopt(env, lp);
     1.8      if (status == 0){
     1.9        //We want to exclude some cases
    1.10        switch (CPXgetstat(env, lp)){
    1.11 @@ -327,11 +328,40 @@
    1.12  // ??case CPX_ABORT_DUAL_INFEAS           
    1.13  // ??case CPX_ABORT_CROSSOVER             
    1.14  // ??case CPX_INForUNBD                   
    1.15 -// ??case CPX_PIVOT                       
    1.16 +// ??case CPX_PIVOT              
    1.17 +         
    1.18 +//Some more interesting stuff:
    1.19 +
    1.20 +// CPX_PARAM_LPMETHOD  1062  int  LPMETHOD
    1.21 +// 0 Automatic 
    1.22 +// 1 Primal Simplex 
    1.23 +// 2 Dual Simplex 
    1.24 +// 3 Network Simplex 
    1.25 +// 4 Standard Barrier 
    1.26 +// Default: 0 
    1.27 +// Description: Method for linear optimization. 
    1.28 +// Determines which algorithm is used when CPXlpopt() (or "optimize" in the Interactive Optimizer) is called. Currently the behavior of the "Automatic" setting is that CPLEX simply invokes the dual simplex method, but this capability may be expanded in the future so that CPLEX chooses the method based on problem characteristics 
    1.29 +  //Hulye cplex
    1.30 +  void statusSwitch(CPXENVptr env,int& stat){
    1.31 +    int lpmethod;
    1.32 +    CPXgetintparam (env,CPX_PARAM_LPMETHOD,&lpmethod);
    1.33 +    if (lpmethod==2){
    1.34 +      if (stat==CPX_UNBOUNDED){
    1.35 +	stat=CPX_INFEASIBLE;
    1.36 +      }
    1.37 +      else{
    1.38 +	if (stat==CPX_INFEASIBLE)
    1.39 +	  stat=CPX_UNBOUNDED;
    1.40 +      }
    1.41 +    }
    1.42 +  }
    1.43  
    1.44    LpCplex::SolutionStatus LpCplex::_getPrimalStatus()
    1.45    {
    1.46 +    
    1.47      int stat = CPXgetstat(env, lp);
    1.48 +    statusSwitch(env,stat);
    1.49 +    //CPXgetstat(env, lp);
    1.50      //printf("A primal status: %d, CPX_OPTIMAL=%d \n",stat,CPX_OPTIMAL);
    1.51      switch (stat) {
    1.52      case 0:
    1.53 @@ -339,7 +369,8 @@
    1.54      case CPX_OPTIMAL://Optimal
    1.55        return OPTIMAL;
    1.56      case CPX_UNBOUNDED://Unbounded
    1.57 -      return INFINITE;
    1.58 +      return INFEASIBLE;//In case of dual simplex
    1.59 +      //return INFINITE;
    1.60      case CPX_INFEASIBLE://Infeasible 
    1.61   //    case CPX_IT_LIM_INFEAS:
    1.62  //     case CPX_TIME_LIM_INFEAS:
    1.63 @@ -348,7 +379,8 @@
    1.64  //     case CPX_ABORT_INFEAS:                
    1.65  //     case CPX_ABORT_PRIM_INFEAS:           
    1.66  //     case CPX_ABORT_PRIM_DUAL_INFEAS:      
    1.67 -      return INFEASIBLE;
    1.68 +      return INFINITE;//In case of dual simplex
    1.69 +      //return INFEASIBLE;
    1.70  //     case CPX_OBJ_LIM:                    
    1.71  //     case CPX_IT_LIM_FEAS:             
    1.72  //     case CPX_TIME_LIM_FEAS:                
    1.73 @@ -383,6 +415,7 @@
    1.74    LpCplex::SolutionStatus LpCplex::_getDualStatus()
    1.75    {
    1.76      int stat = CPXgetstat(env, lp);
    1.77 +    statusSwitch(env,stat);
    1.78      switch (stat) {
    1.79      case 0:
    1.80        return UNDEFINED; //Undefined