COIN-OR::LEMON - Graph Library

Changeset 1405:3626c7f10f14 in lemon-0.x for src/lemon/lp_cplex.cc


Ignore:
Timestamp:
05/05/05 17:43:43 (19 years ago)
Author:
athos
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1867
Message:

Deleted _setRowLowerBound() and _setRowUpperBound() functions. Cplex worked (now it does not because of _getPrimalStatus()).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/lemon/lp_cplex.cc

    r1381 r1405  
    1515 *
    1616 */
    17 
    18 #include"lp_cplex.h"
     17#include <iostream>
     18#include<lemon/lp_cplex.h>
    1919
    2020///\file
     
    6666  }
    6767 
    68   LpSolverBase &LpCplex::_newLp() {return *(LpSolverBase*)0;}
    69   LpSolverBase &LpCplex::_copyLp() {return *(LpSolverBase*)0;}
     68  LpSolverBase &LpCplex::_newLp()
     69  {
     70    return *(LpSolverBase*)0;
     71  }
     72  LpSolverBase &LpCplex::_copyLp() {
     73    return *(LpSolverBase*)0;
     74    //Ez lesz majd CPXcloneprob (env, lp, &status);
     75  }
    7076
    7177  int LpCplex::_addCol()
     
    156162      //FIXME error
    157163    }
    158 
     164   
    159165    int cnt=1;
    160166    int indices[1];
     
    166172      CPXchgsense (env, lp, cnt, indices, sense);
    167173      CPXchgcoef (env, lp, i, -1, ub);
     174     
    168175    }
    169176    else{
     
    189196  }
    190197
    191   void LpCplex::_setRowLowerBound(int i, Value value)
    192   {
    193     //Not implemented, obsolete
    194   }
    195  
    196   void LpCplex::_setRowUpperBound(int i, Value value)
    197   {
    198     //Not implemented, obsolete
    199 //     //TODO Ezt kell meg megirni
    200 //     //type of the problem
    201 //     char sense[1];
    202 //     status = CPXgetsense (env, lp, sense, i, i);
    203 //     Value rhs[1];
    204 //     status = CPXgetrhs (env, lp, rhs, i, i);
    205 
    206 //     switch (sense[0]) {
    207 //     case 'L'://<= constraint
    208 //       break;
    209 //     case 'E'://= constraint
    210 //       break;
    211 //     case 'G'://>= constraint
    212 //       break;
    213 //     case 'R'://ranged constraint
    214 //       break;
    215 //     default: ;
    216 //       //FIXME error
    217 //     }
    218 
    219 //     status = CPXchgcoef (env, lp, i, -2, value_rng);
    220   }
     198//   void LpCplex::_setRowLowerBound(int i, Value value)
     199//   {
     200//     //Not implemented, obsolete
     201//   }
     202 
     203//   void LpCplex::_setRowUpperBound(int i, Value value)
     204//   {
     205//     //Not implemented, obsolete
     206// //     //TODO Ezt kell meg megirni
     207// //     //type of the problem
     208// //     char sense[1];
     209// //     status = CPXgetsense (env, lp, sense, i, i);
     210// //     Value rhs[1];
     211// //     status = CPXgetrhs (env, lp, rhs, i, i);
     212
     213// //     switch (sense[0]) {
     214// //     case 'L'://<= constraint
     215// //       break;
     216// //     case 'E'://= constraint
     217// //       break;
     218// //     case 'G'://>= constraint
     219// //       break;
     220// //     case 'R'://ranged constraint
     221// //       break;
     222// //     default: ;
     223// //       //FIXME error
     224// //     }
     225
     226// //     status = CPXchgcoef (env, lp, i, -2, value_rng);
     227//   }
    221228 
    222229  void LpCplex::_setObjCoeff(int i, Value obj_coef)
     
    255262  LpCplex::SolutionStatus LpCplex::_getPrimalStatus()
    256263  {
     264// CPX_STAT_ABORT_DUAL_OBJ_LIM
     265// CPX_STAT_ABORT_IT_LIM
     266// CPX_STAT_ABORT_OBJ_LIM
     267// CPX_STAT_ABORT_PRIM_OBJ_LIM
     268// CPX_STAT_ABORT_TIME_LIM
     269// CPX_STAT_ABORT_USER
     270// CPX_STAT_FEASIBLE_RELAXED
     271// CPX_STAT_INFEASIBLE
     272// CPX_STAT_INForUNBD
     273// CPX_STAT_NUM_BEST
     274// CPX_STAT_OPTIMAL
     275// CPX_STAT_OPTIMAL_FACE_UNBOUNDED
     276// CPX_STAT_OPTIMAL_INFEAS
     277// CPX_STAT_OPTIMAL_RELAXED
     278// CPX_STAT_UNBOUNDED
     279
    257280    //Unimplemented
    258     return OPTIMAL;
    259 //     int stat=  lpx_get_status(lp);
    260 //     switch (stat) {
    261 //     case LPX_UNDEF://Undefined (no solve has been run yet)
    262 //       return UNDEFINED;
    263 //       break;
    264 //     case LPX_NOFEAS://There is no feasible solution (primal, I guess)
    265 //     case LPX_INFEAS://Infeasible
    266 //       return INFEASIBLE;
    267 //       break;
    268 //     case LPX_UNBND://Unbounded
    269 //       return INFINITE;
    270 //       break;
    271 //     case LPX_FEAS://Feasible
    272 //       return FEASIBLE;
    273 //       break;
    274 //     case LPX_OPT://Feasible
    275 //       return OPTIMAL;
    276 //       break;
    277 //     default:
    278 //       return UNDEFINED; //to avoid gcc warning
    279 //       //FIXME error
    280 //     }
     281    int stat = CPXgetstat (env, lp);
     282    switch (stat) {
     283    case CPX_STAT_OPTIMAL://Optimal
     284      return OPTIMAL;
     285      break;
     286    case CPX_STAT_INFEASIBLE://Infeasible
     287      return INFEASIBLE;
     288      break;
     289    case CPX_STAT_UNBOUNDED://Unbounded
     290      return INFINITE;
     291      break;
     292    case CPX_STAT_NUM_BEST://Feasible
     293      return FEASIBLE;
     294      break;
     295    default:
     296      return UNDEFINED; //Everything else comes here
     297      //FIXME error
     298    }
    281299  }
    282300
     
    290308  LpCplex::Value LpCplex::_getPrimalValue()
    291309  {
    292     //Unimplemented
    293     return 0;
     310    Value objval;
     311    //method = CPXgetmethod (env, lp);
     312    status = CPXgetobjval (env, lp, &objval);
     313    return objval;
    294314  }
    295315 
Note: See TracChangeset for help on using the changeset viewer.