[Lemon-commits] [lemon_svn] marci: r2325 - hugo/trunk/lemon

Lemon SVN svn at lemon.cs.elte.hu
Mon Nov 6 20:51:49 CET 2006


Author: marci
Date: Sun Nov 13 21:01:17 2005
New Revision: 2325

Modified:
   hugo/trunk/lemon/lp_base.h
   hugo/trunk/lemon/lp_cplex.cc
   hugo/trunk/lemon/lp_cplex.h
   hugo/trunk/lemon/lp_glpk.cc
   hugo/trunk/lemon/lp_glpk.h

Log:
bugfix in setCol, getting dual values


Modified: hugo/trunk/lemon/lp_base.h
==============================================================================
--- hugo/trunk/lemon/lp_base.h	(original)
+++ hugo/trunk/lemon/lp_base.h	Sun Nov 13 21:01:17 2005
@@ -36,6 +36,7 @@
   ///\todo This might be implemented to be also usable in other places.
   class _FixId 
   {
+  protected:
     std::vector<int> index;
     std::vector<int> cross;
     int first_free;
@@ -592,6 +593,7 @@
 //                          Value  const * values ) = 0;
     virtual SolveExitStatus _solve() = 0;
     virtual Value _getPrimal(int i) = 0;
+    virtual Value _getDual(int i) = 0;
     virtual Value _getPrimalValue() = 0;
     virtual SolutionStatus _getPrimalStatus() = 0;
     virtual SolutionStatus _getDualStatus() = 0;
@@ -708,7 +710,7 @@
       values.push_back(0);
       for(DualExpr::const_iterator i=e.begin(); i!=e.end(); ++i)
 	if((*i).second!=0) { ///\bug EPSILON would be necessary here!!!
-	  indices.push_back(cols.floatingId((*i).first.id));
+	  indices.push_back(rows.floatingId((*i).first.id));
 	  values.push_back((*i).second);
 	}
       _setColCoeffs(cols.floatingId(c.id),indices.size()-1,
@@ -1001,6 +1003,9 @@
     Value primal(Col c) { return _getPrimal(cols.floatingId(c.id)); }
 
     ///\e
+    Value dual(Row r) { return _getDual(rows.floatingId(r.id)); }
+
+    ///\e
 
     ///\return
     ///- \ref INF or -\ref INF means either infeasibility or unboundedness

Modified: hugo/trunk/lemon/lp_cplex.cc
==============================================================================
--- hugo/trunk/lemon/lp_cplex.cc	(original)
+++ hugo/trunk/lemon/lp_cplex.cc	Sun Nov 13 21:01:17 2005
@@ -267,6 +267,13 @@
     CPXgetx(env, lp, &x, i, i);
     return x;
   }
+
+  LpCplex::Value LpCplex::_getDual(int i)
+  {
+    Value y;
+    CPXgety(env, lp, &y, i, i);
+    return y;
+  }
   
   LpCplex::Value LpCplex::_getPrimalValue()
   {

Modified: hugo/trunk/lemon/lp_cplex.h
==============================================================================
--- hugo/trunk/lemon/lp_cplex.h	(original)
+++ hugo/trunk/lemon/lp_cplex.h	Sun Nov 13 21:01:17 2005
@@ -78,7 +78,7 @@
     virtual SolveExitStatus _solve();
 
     virtual Value _getPrimal(int i);
-
+    virtual Value _getDual(int i);
     
     virtual Value _getPrimalValue();
     

Modified: hugo/trunk/lemon/lp_glpk.cc
==============================================================================
--- hugo/trunk/lemon/lp_glpk.cc	(original)
+++ hugo/trunk/lemon/lp_glpk.cc	Sun Nov 13 21:01:17 2005
@@ -409,6 +409,11 @@
   {
     return lpx_get_col_prim(lp,i);
   }
+
+  LpGlpk::Value LpGlpk::_getDual(int i)
+  {
+    return lpx_get_row_dual(lp,i);
+  }
   
   LpGlpk::Value LpGlpk::_getPrimalValue()
   {

Modified: hugo/trunk/lemon/lp_glpk.h
==============================================================================
--- hugo/trunk/lemon/lp_glpk.h	(original)
+++ hugo/trunk/lemon/lp_glpk.h	Sun Nov 13 21:01:17 2005
@@ -79,6 +79,7 @@
     ///
     virtual SolveExitStatus _solve();
     virtual Value _getPrimal(int i);
+    virtual Value _getDual(int i);
     virtual Value _getPrimalValue();
     ///\e
     



More information about the Lemon-commits mailing list