From 7be7bd25c40323fe982db47db6a221fd68ed83de Mon Sep 17 00:00:00 2001 From: jaredhuling Date: Thu, 10 Jan 2019 09:55:49 -0500 Subject: [PATCH] small changes --- src/ADMMogLassoTall.h | 12 ++++++------ src/FADMMBase.h | 26 +++++++++++++------------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/ADMMogLassoTall.h b/src/ADMMogLassoTall.h index d8fdbd3..a4aeba9 100644 --- a/src/ADMMogLassoTall.h +++ b/src/ADMMogLassoTall.h @@ -320,8 +320,8 @@ class ADMMogLassoTall: public FADMMBase()); - eps_primal = 0.0; - eps_dual = 0.0; + eps_primal = 1e-15; + eps_dual = 1e-15; resid_primal = 1e99; resid_dual = 1e99; @@ -365,10 +365,10 @@ class ADMMogLassoTall: public FADMMBase()); - eps_primal = 0.0; - eps_dual = 0.0; - resid_primal = 1e30; - resid_dual = 1e30; + eps_primal = 1e-15; + eps_dual = 1e-15; + resid_primal = 1e99; + resid_dual = 1e99; // adj_a = 1.0; // adj_c = 9999; diff --git a/src/FADMMBase.h b/src/FADMMBase.h index 72361e6..6052e88 100644 --- a/src/FADMMBase.h +++ b/src/FADMMBase.h @@ -16,6 +16,12 @@ class FADMMBase { protected: typedef typename VecTypeNu::RealScalar Yscalar; + + double eps_primal; // tolerance for primal residual + double eps_dual; // tolerance for dual residual + + double resid_primal; // primal residual + double resid_dual; // dual residual const int dim_main; // dimension of x const int dim_aux; // dimension of z @@ -36,12 +42,6 @@ class FADMMBase const double eps_abs; // absolute tolerance const double eps_rel; // relative tolerance - double eps_primal; // tolerance for primal residual - double eps_dual; // tolerance for dual residual - - double resid_primal; // primal residual - double resid_dual; // dual residual - virtual void A_mult (VecTypeNu &res, VecTypeBeta &x) = 0; // operation res -> Ax, x can be overwritten virtual void At_mult(VecTypeNu &res, VecTypeNu &y) = 0; // operation res -> A'y, y can be overwritten virtual void B_mult (VecTypeNu &res, VecTypeGamma &z) = 0; // operation res -> Bz, z can be overwritten @@ -105,14 +105,14 @@ class FADMMBase // increase or decrease rho in iterations virtual void update_rho() { - if(resid_primal / eps_primal > 10 * resid_dual / eps_dual) + if(resid_primal / eps_primal > 10.0 * resid_dual / eps_dual) { - rho *= 2; + rho *= 2.0; rho_changed_action(); } - else if(resid_dual / eps_dual > 10 * resid_primal / eps_primal) + else if(resid_dual / eps_dual > 10.0 * resid_primal / eps_primal) { - rho /= 2; + rho /= 2.0; rho_changed_action(); } @@ -169,14 +169,14 @@ class FADMMBase public: FADMMBase(int n_, int m_, int p_, double eps_abs_ = 1e-6, double eps_rel_ = 1e-6) : + eps_primal(1e-15), eps_dual(1e-15), + resid_primal(1e99), resid_dual(1e99), dim_main(n_), dim_aux(m_), dim_dual(p_), main_beta(n_), aux_gamma(m_), dual_nu(p_), // allocate space but do not set values adj_gamma(m_), adj_nu(p_), old_gamma(m_), old_nu(p_), adj_a(1.0), adj_c(1e99), - eps_abs(eps_abs_), eps_rel(eps_rel_), - eps_primal(0.0), eps_dual(0.0), - resid_primal(1e99), resid_dual(1e99) + eps_abs(eps_abs_), eps_rel(eps_rel_) {}