[mlpack-svn] r16182 - mlpack/trunk/src/mlpack/core/optimizers/aug_lagrangian

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Tue Jan 28 15:20:28 EST 2014


Author: birm
Date: Tue Jan 28 15:20:28 2014
New Revision: 16182

Log:
Added ToString for AugLag Itself.


Modified:
   mlpack/trunk/src/mlpack/core/optimizers/aug_lagrangian/aug_lagrangian.hpp
   mlpack/trunk/src/mlpack/core/optimizers/aug_lagrangian/aug_lagrangian_impl.hpp

Modified: mlpack/trunk/src/mlpack/core/optimizers/aug_lagrangian/aug_lagrangian.hpp
==============================================================================
--- mlpack/trunk/src/mlpack/core/optimizers/aug_lagrangian/aug_lagrangian.hpp	(original)
+++ mlpack/trunk/src/mlpack/core/optimizers/aug_lagrangian/aug_lagrangian.hpp	Tue Jan 28 15:20:28 2014
@@ -118,6 +118,9 @@
   //! Modify the penalty parameter.
   double& Sigma() { return augfunc.Sigma(); }
 
+  // convert the obkect into a string
+  std::string ToString() const;
+
  private:
   //! Function to be optimized.
   LagrangianFunction& function;
@@ -140,3 +143,4 @@
 #include "aug_lagrangian_impl.hpp"
 
 #endif // __MLPACK_CORE_OPTIMIZERS_AUG_LAGRANGIAN_AUG_LAGRANGIAN_HPP
+

Modified: mlpack/trunk/src/mlpack/core/optimizers/aug_lagrangian/aug_lagrangian_impl.hpp
==============================================================================
--- mlpack/trunk/src/mlpack/core/optimizers/aug_lagrangian/aug_lagrangian_impl.hpp	(original)
+++ mlpack/trunk/src/mlpack/core/optimizers/aug_lagrangian/aug_lagrangian_impl.hpp	Tue Jan 28 15:20:28 2014
@@ -49,6 +49,17 @@
   return Optimize(coordinates, maxIterations);
 }
 
+//Convert the Object to a String
+template<typename LagrangianFunction>
+std::string AugLagrangian<LagrangianFunction>::ToString() const{
+  std::ostringstream convert;
+  convert << "AugLagrangian [" << this << "]" << std::endl;
+  // Fix this! Why Only log? Ostream is lonely.
+  Log::Debug  << "Function to be Oprimized: " << function << std::endl;
+  convert << "L-BFGS Selected: " << lbfgs << std::endl;
+  return convert.str();
+}
+
 template<typename LagrangianFunction>
 bool AugLagrangian<LagrangianFunction>::Optimize(arma::mat& coordinates,
                                                  const size_t maxIterations)
@@ -146,3 +157,4 @@
 }; // namespace mlpack
 
 #endif // __MLPACK_CORE_OPTIMIZERS_AUG_LAGRANGIAN_AUG_LAGRANGIAN_IMPL_HPP
+



More information about the mlpack-svn mailing list