max flow with lp column generation
authormarci
Wed, 30 Nov 2005 17:00:17 +0000
changeset 1840173b53b28d7c
parent 1839 b2dfd32b4895
child 1841 a2dfee683243
max flow with lp column generation
lemon/lp_base.h
lemon/lp_cplex.cc
lemon/lp_cplex.h
lemon/lp_glpk.cc
lemon/lp_glpk.h
     1.1 --- a/lemon/lp_base.h	Wed Nov 30 13:24:37 2005 +0000
     1.2 +++ b/lemon/lp_base.h	Wed Nov 30 17:00:17 2005 +0000
     1.3 @@ -595,6 +595,7 @@
     1.4      virtual Value _getPrimal(int i) = 0;
     1.5      virtual Value _getDual(int i) = 0;
     1.6      virtual Value _getPrimalValue() = 0;
     1.7 +    virtual bool _isBasicCol(int i) = 0;
     1.8      virtual SolutionStatus _getPrimalStatus() = 0;
     1.9      virtual SolutionStatus _getDualStatus() = 0;
    1.10      ///\todo This could be implemented here, too, using _getPrimalStatus() and
    1.11 @@ -1000,6 +1001,9 @@
    1.12      Value dual(Row r) { return _getDual(rows.floatingId(r.id)); }
    1.13  
    1.14      ///\e
    1.15 +    bool isBasicCol(Col c) { return _isBasicCol(cols.floatingId(c.id)); }
    1.16 +
    1.17 +    ///\e
    1.18  
    1.19      ///\return
    1.20      ///- \ref INF or -\ref INF means either infeasibility or unboundedness
     2.1 --- a/lemon/lp_cplex.cc	Wed Nov 30 13:24:37 2005 +0000
     2.2 +++ b/lemon/lp_cplex.cc	Wed Nov 30 17:00:17 2005 +0000
     2.3 @@ -284,7 +284,13 @@
     2.4      //printf("Objective value: %g \n",objval);
     2.5      return objval;
     2.6    }
     2.7 -  
     2.8 +  bool LpCplex::_isBasicCol(int i) {
     2.9 +    int* cstat=new int[CPXgetnumcols(env, lp)];
    2.10 +    return CPXgetbase(env, lp, cstat, NULL);
    2.11 +    bool result=(cstat[i]==CPX_BASIC);
    2.12 +    delete[] cstat;
    2.13 +    return result;
    2.14 +  }  
    2.15  
    2.16  //7.5-os cplex statusai (Vigyazat: a 9.0-asei masok!)
    2.17  // This table lists the statuses, returned by the CPXgetstat() routine, for solutions to LP problems or mixed integer problems. If no solution exists, the return value is zero.
     3.1 --- a/lemon/lp_cplex.h	Wed Nov 30 13:24:37 2005 +0000
     3.2 +++ b/lemon/lp_cplex.h	Wed Nov 30 17:00:17 2005 +0000
     3.3 @@ -76,11 +76,10 @@
     3.4      ///\e
     3.5      
     3.6      virtual SolveExitStatus _solve();
     3.7 -
     3.8      virtual Value _getPrimal(int i);
     3.9      virtual Value _getDual(int i);
    3.10 -    
    3.11      virtual Value _getPrimalValue();
    3.12 +    virtual bool _isBasicCol(int i);
    3.13      
    3.14      virtual SolutionStatus _getPrimalStatus();
    3.15      virtual SolutionStatus _getDualStatus();
     4.1 --- a/lemon/lp_glpk.cc	Wed Nov 30 13:24:37 2005 +0000
     4.2 +++ b/lemon/lp_glpk.cc	Wed Nov 30 17:00:17 2005 +0000
     4.3 @@ -419,6 +419,9 @@
     4.4    {
     4.5      return lpx_get_obj_val(lp);
     4.6    }
     4.7 +  bool LpGlpk::_isBasicCol(int i) {
     4.8 +    return (lpx_get_col_stat(lp, i)==LPX_BS);
     4.9 +  }
    4.10    
    4.11   
    4.12    LpGlpk::SolutionStatus LpGlpk::_getPrimalStatus()
     5.1 --- a/lemon/lp_glpk.h	Wed Nov 30 13:24:37 2005 +0000
     5.2 +++ b/lemon/lp_glpk.h	Wed Nov 30 17:00:17 2005 +0000
     5.3 @@ -81,6 +81,7 @@
     5.4      virtual Value _getPrimal(int i);
     5.5      virtual Value _getDual(int i);
     5.6      virtual Value _getPrimalValue();
     5.7 +    virtual bool _isBasicCol(int i);
     5.8      ///\e
     5.9      
    5.10      ///\todo It should be clarified