COIN-OR::LEMON - Graph Library

Changeset 1405:3626c7f10f14 in lemon-0.x


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()).

Location:
src/lemon
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • src/lemon/lp_base.h

    r1397 r1405  
    432432    virtual void _setColLowerBound(int i, Value value) = 0;
    433433    virtual void _setColUpperBound(int i, Value value) = 0;
    434     virtual void _setRowLowerBound(int i, Value value) = 0;
    435     virtual void _setRowUpperBound(int i, Value value) = 0;
     434//     virtual void _setRowLowerBound(int i, Value value) = 0;
     435//     virtual void _setRowUpperBound(int i, Value value) = 0;
    436436    virtual void _setRowBounds(int i, Value lower, Value upper) = 0;
    437437    virtual void _setObjCoeff(int i, Value obj_coef) = 0;
     
    568568      _setRowCoeffs(rows.floatingId(r.id),indices.size()-1,
    569569                    &indices[0],&values[0]);
    570       _setRowLowerBound(rows.floatingId(r.id),l-e.constComp());
    571       _setRowUpperBound(rows.floatingId(r.id),u-e.constComp());
     570//       _setRowLowerBound(rows.floatingId(r.id),l-e.constComp());
     571//       _setRowUpperBound(rows.floatingId(r.id),u-e.constComp());
     572       _setRowBounds(rows.floatingId(r.id),l-e.constComp(),u-e.constComp());
    572573    }
    573574
     
    634635    }
    635636   
    636     /// Set the lower bound of a row (i.e a constraint)
    637 
    638     /// The lower bound of a linear expression (row) has to be given by an
    639     /// extended number of type Value, i.e. a finite number of type
    640     /// Value or -\ref INF.
    641     void rowLowerBound(Row r, Value value) {
    642       _setRowLowerBound(rows.floatingId(r.id),value);
    643     };
    644     /// Set the upper bound of a row (i.e a constraint)
    645 
    646     /// The upper bound of a linear expression (row) has to be given by an
    647     /// extended number of type Value, i.e. a finite number of type
    648     /// Value or \ref INF.
    649     void rowUpperBound(Row r, Value value) {
    650       _setRowUpperBound(rows.floatingId(r.id),value);
    651     };
    652     /// Set the lower and the upper bounds of a row (i.e a variable)
     637//     /// Set the lower bound of a row (i.e a constraint)
     638
     639//     /// The lower bound of a linear expression (row) has to be given by an
     640//     /// extended number of type Value, i.e. a finite number of type
     641//     /// Value or -\ref INF.
     642//     void rowLowerBound(Row r, Value value) {
     643//       _setRowLowerBound(rows.floatingId(r.id),value);
     644//     };
     645//     /// Set the upper bound of a row (i.e a constraint)
     646
     647//     /// The upper bound of a linear expression (row) has to be given by an
     648//     /// extended number of type Value, i.e. a finite number of type
     649//     /// Value or \ref INF.
     650//     void rowUpperBound(Row r, Value value) {
     651//       _setRowUpperBound(rows.floatingId(r.id),value);
     652//     };
     653
     654    /// Set the lower and the upper bounds of a row (i.e a constraint)
    653655
    654656    /// The lower and the upper bounds of
  • 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 
  • src/lemon/lp_cplex.h

    r1398 r1405  
    6666    virtual void _setColLowerBound(int i, Value value);
    6767    virtual void _setColUpperBound(int i, Value value);
    68     virtual void _setRowLowerBound(int i, Value value);
    69     virtual void _setRowUpperBound(int i, Value value);
     68//     virtual void _setRowLowerBound(int i, Value value);
     69//     virtual void _setRowUpperBound(int i, Value value);
    7070    virtual void _setRowBounds(int i, Value lower, Value upper);
    7171    virtual void _setObjCoeff(int i, Value obj_coef);
  • src/lemon/lp_glpk.cc

    r1379 r1405  
    176176  }
    177177 
    178   void LpGlpk::_setRowLowerBound(int i, Value lo)
    179   {
    180     if (lo==INF) {
    181       //FIXME error
    182     }
    183     int b=lpx_get_row_type(lp, i);
    184     double up=lpx_get_row_ub(lp, i);   
    185     if (lo==-INF) {
    186       switch (b) {
    187       case LPX_FR:
    188       case LPX_LO:
    189         lpx_set_row_bnds(lp, i, LPX_FR, lo, up);
    190         break;
    191       case LPX_UP:
    192         break;
    193       case LPX_DB:
    194       case LPX_FX:
    195         lpx_set_row_bnds(lp, i, LPX_UP, lo, up);
    196         break;
    197       default: ;
    198         //FIXME error
    199       }
    200     } else {
    201       switch (b) {
    202       case LPX_FR:
    203       case LPX_LO:
    204         lpx_set_row_bnds(lp, i, LPX_LO, lo, up);
    205         break;
    206       case LPX_UP:       
    207       case LPX_DB:
    208       case LPX_FX:
    209         if (lo==up)
    210           lpx_set_row_bnds(lp, i, LPX_FX, lo, up);
    211         else
    212           lpx_set_row_bnds(lp, i, LPX_DB, lo, up);
    213         break;
    214       default: ;
    215         //FIXME error
    216       }
    217     }
    218   }
    219  
    220   void LpGlpk::_setRowUpperBound(int i, Value up)
    221   {
    222     if (up==-INF) {
    223       //FIXME error
    224     }
    225     int b=lpx_get_row_type(lp, i);
    226     double lo=lpx_get_row_lb(lp, i);
    227     if (up==INF) {
    228       switch (b) {
    229       case LPX_FR:
    230       case LPX_LO:
    231         break;
    232       case LPX_UP:
    233         lpx_set_row_bnds(lp, i, LPX_FR, lo, up);
    234         break;
    235       case LPX_DB:
    236       case LPX_FX:
    237         lpx_set_row_bnds(lp, i, LPX_LO, lo, up);
    238         break;
    239       default: ;
    240         //FIXME error
    241       }
    242     } else {
    243       switch (b) {
    244       case LPX_FR:
    245         lpx_set_row_bnds(lp, i, LPX_UP, lo, up);
    246         break;
    247       case LPX_UP:
    248         lpx_set_row_bnds(lp, i, LPX_UP, lo, up);
    249         break;
    250       case LPX_LO:
    251       case LPX_DB:
    252       case LPX_FX:
    253         if (lo==up)
    254           lpx_set_row_bnds(lp, i, LPX_FX, lo, up);
    255         else
    256           lpx_set_row_bnds(lp, i, LPX_DB, lo, up);
    257         break;
    258       default: ;
    259         //FIXME error
    260       }
    261     }
    262   }
     178//   void LpGlpk::_setRowLowerBound(int i, Value lo)
     179//   {
     180//     if (lo==INF) {
     181//       //FIXME error
     182//     }
     183//     int b=lpx_get_row_type(lp, i);
     184//     double up=lpx_get_row_ub(lp, i);
     185//     if (lo==-INF) {
     186//       switch (b) {
     187//       case LPX_FR:
     188//       case LPX_LO:
     189//      lpx_set_row_bnds(lp, i, LPX_FR, lo, up);
     190//      break;
     191//       case LPX_UP:
     192//      break;
     193//       case LPX_DB:
     194//       case LPX_FX:
     195//      lpx_set_row_bnds(lp, i, LPX_UP, lo, up);
     196//      break;
     197//       default: ;
     198//      //FIXME error
     199//       }
     200//     } else {
     201//       switch (b) {
     202//       case LPX_FR:
     203//       case LPX_LO:
     204//      lpx_set_row_bnds(lp, i, LPX_LO, lo, up);
     205//      break;
     206//       case LPX_UP:     
     207//       case LPX_DB:
     208//       case LPX_FX:
     209//      if (lo==up)
     210//        lpx_set_row_bnds(lp, i, LPX_FX, lo, up);
     211//      else
     212//        lpx_set_row_bnds(lp, i, LPX_DB, lo, up);
     213//      break;
     214//       default: ;
     215//      //FIXME error
     216//       }
     217//     }
     218//   }
     219 
     220//   void LpGlpk::_setRowUpperBound(int i, Value up)
     221//   {
     222//     if (up==-INF) {
     223//       //FIXME error
     224//     }
     225//     int b=lpx_get_row_type(lp, i);
     226//     double lo=lpx_get_row_lb(lp, i);
     227//     if (up==INF) {
     228//       switch (b) {
     229//       case LPX_FR:
     230//       case LPX_LO:
     231//      break;
     232//       case LPX_UP:
     233//      lpx_set_row_bnds(lp, i, LPX_FR, lo, up);
     234//      break;
     235//       case LPX_DB:
     236//       case LPX_FX:
     237//      lpx_set_row_bnds(lp, i, LPX_LO, lo, up);
     238//      break;
     239//       default: ;
     240//      //FIXME error
     241//       }
     242//     } else {
     243//       switch (b) {
     244//       case LPX_FR:
     245//      lpx_set_row_bnds(lp, i, LPX_UP, lo, up);
     246//      break;
     247//       case LPX_UP:
     248//      lpx_set_row_bnds(lp, i, LPX_UP, lo, up);
     249//      break;
     250//       case LPX_LO:
     251//       case LPX_DB:
     252//       case LPX_FX:
     253//      if (lo==up)
     254//        lpx_set_row_bnds(lp, i, LPX_FX, lo, up);
     255//      else
     256//        lpx_set_row_bnds(lp, i, LPX_DB, lo, up);
     257//      break;
     258//       default: ;
     259//      //FIXME error
     260//       }
     261//     }
     262//   }
    263263
    264264  void LpGlpk::_setRowBounds(int i, Value lb, Value ub)
  • src/lemon/lp_glpk.h

    r1398 r1405  
    6161    virtual void _setColLowerBound(int i, Value value);
    6262    virtual void _setColUpperBound(int i, Value value);
    63     virtual void _setRowLowerBound(int i, Value value);
    64     virtual void _setRowUpperBound(int i, Value value);
     63//     virtual void _setRowLowerBound(int i, Value value);
     64//     virtual void _setRowUpperBound(int i, Value value);
    6565    virtual void _setRowBounds(int i, Value lower, Value upper);
    6666    virtual void _setObjCoeff(int i, Value obj_coef);
  • src/lemon/lp_skeleton.cc

    r1390 r1405  
    6666  }
    6767 
    68   void LpSkeleton::_setRowLowerBound(int, Value)
    69   {
    70   }
     68//   void LpSkeleton::_setRowLowerBound(int, Value)
     69//   {
     70//   }
    7171 
    72   void LpSkeleton::_setRowUpperBound(int, Value)
    73   {
    74   }
     72//   void LpSkeleton::_setRowUpperBound(int, Value)
     73//   {
     74//   }
    7575
    7676  void LpSkeleton::_setRowBounds(int, Value, Value)
  • src/lemon/lp_skeleton.h

    r1390 r1405  
    6969    /// \e
    7070
    71     /// The lower bound of a linear expression (row) have to be given by an
     71//     /// The lower bound of a linear expression (row) have to be given by an
     72//     /// extended number of type Value, i.e. a finite number of type
     73//     /// Value or -\ref INF.
     74//     virtual void _setRowLowerBound(int i, Value value);
     75//     /// \e
     76
     77//     /// The upper bound of a linear expression (row) have to be given by an
     78//     /// extended number of type Value, i.e. a finite number of type
     79//     /// Value or \ref INF.
     80//     virtual void _setRowUpperBound(int i, Value value);
     81
     82    /// The lower and upper bound of a linear expression (row) have to be
     83    /// given by an
    7284    /// extended number of type Value, i.e. a finite number of type
    73     /// Value or -\ref INF.
    74     virtual void _setRowLowerBound(int i, Value value);
    75     /// \e
    76 
    77     /// \e
     85    /// Value or +/-\ref INF.
    7886    virtual void _setRowBounds(int i, Value lb, Value ub);
    7987    /// \e
    8088
    81     /// The upper bound of a linear expression (row) have to be given by an
    82     /// extended number of type Value, i.e. a finite number of type
    83     /// Value or \ref INF.
    84     virtual void _setRowUpperBound(int i, Value value);
    8589
    8690    /// \e
Note: See TracChangeset for help on using the changeset viewer.