[Lemon-commits] [lemon_svn] athos: r1822 - hugo/trunk/src/lemon

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


Author: athos
Date: Wed Apr 20 17:06:42 2005
New Revision: 1822

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

Log:
_clearObj instead of _setObj.

Modified: hugo/trunk/src/lemon/lp_base.h
==============================================================================
--- hugo/trunk/src/lemon/lp_base.h	(original)
+++ hugo/trunk/src/lemon/lp_base.h	Wed Apr 20 17:06:42 2005
@@ -434,9 +434,10 @@
     virtual void _setRowLowerBound(int i, Value value) = 0;
     virtual void _setRowUpperBound(int i, Value value) = 0;
     virtual void _setObjCoeff(int i, Value obj_coef) = 0;
-    virtual void _setObj(int length,
-                         int  const * indices, 
-                         Value  const * values ) = 0;
+    virtual void _clearObj()=0;
+//     virtual void _setObj(int length,
+//                          int  const * indices, 
+//                          Value  const * values ) = 0;
     virtual SolveExitStatus _solve() = 0;
     virtual Value _getPrimal(int i) = 0;
     virtual Value _getPrimalValue() = 0;
@@ -449,10 +450,8 @@
     //Constant component of the objective function
     Value obj_const_comp;
     
-    ///\e
-    
-    ///\bug Unimplemented
-    void clearObj() {}
+
+
     
   public:
 
@@ -667,7 +666,7 @@
     ///\param e is a linear expression of type \ref Expr.
     ///\bug The previous objective function is not cleared!
     void setObj(Expr e) {
-      clearObj();
+      _clearObj();
       for (Expr::iterator i=e.begin(); i!=e.end(); ++i)
 	objCoeff((*i).first,(*i).second);
       obj_const_comp=e.constComp();

Modified: hugo/trunk/src/lemon/lp_glpk.cc
==============================================================================
--- hugo/trunk/src/lemon/lp_glpk.cc	(original)
+++ hugo/trunk/src/lemon/lp_glpk.cc	Wed Apr 20 17:06:42 2005
@@ -267,22 +267,28 @@
     lpx_set_obj_coef(lp, i, obj_coef);
   }
 
-  void LpGlpk::_setObj(int length,
-		       int  const * indices, 
-		       Value  const * values )
-  {
-    Value new_values[1+lpx_num_cols()];
-    for (i=0;i<=lpx_num_cols();++i){
-      new_values[i]=0;
-    }
-    for (i=1;i<=length;++i){
-      new_values[indices[i]]=values[i];
-    }
-    
-    for (i=0;i<=lpx_num_cols();++i){
-      lpx_set_obj_coef(lp, i, new_values[i]);
+  void LpGlpk::_clearObj()
+  {
+    for (int i=0;i<=lpx_get_num_cols(lp);++i){
+      lpx_set_obj_coef(lp, i, 0);
     }
   }
+//   void LpGlpk::_setObj(int length,
+// 		       int  const * indices, 
+// 		       Value  const * values )
+//   {
+//     Value new_values[1+lpx_num_cols()];
+//     for (i=0;i<=lpx_num_cols();++i){
+//       new_values[i]=0;
+//     }
+//     for (i=1;i<=length;++i){
+//       new_values[indices[i]]=values[i];
+//     }
+    
+//     for (i=0;i<=lpx_num_cols();++i){
+//       lpx_set_obj_coef(lp, i, new_values[i]);
+//     }
+//   }
 
   LpGlpk::SolveExitStatus LpGlpk::_solve()
   {

Modified: hugo/trunk/src/lemon/lp_glpk.h
==============================================================================
--- hugo/trunk/src/lemon/lp_glpk.h	(original)
+++ hugo/trunk/src/lemon/lp_glpk.h	Wed Apr 20 17:06:42 2005
@@ -63,9 +63,10 @@
     virtual void _setRowLowerBound(int i, Value value);
     virtual void _setRowUpperBound(int i, Value value);
     virtual void _setObjCoeff(int i, Value obj_coef);
-    virtual void _setObj(int length,
-                         int  const * indices, 
-                         Value  const * values ) = 0;
+    virtual void _clearObj();
+//     virtual void _setObj(int length,
+//                          int  const * indices, 
+//                          Value  const * values ) = 0;
 
     ///\e
     



More information about the Lemon-commits mailing list