[sdpb] 90/233: Some cosmetic changes to output

Tobias Hansen thansen at moszumanska.debian.org
Thu Mar 9 04:06:23 UTC 2017


This is an automated email from the git hooks/post-receive script.

thansen pushed a commit to branch master
in repository sdpb.

commit df2a4f55082e904e5a2cbcad0c47d73f6eaa7611
Author: David Simmons-Duffin <dsd at minerva.sns.ias.edu>
Date:   Sat Oct 11 18:02:37 2014 -0400

    Some cosmetic changes to output
---
 src/SDPSolver.cpp   |  6 ++----
 src/SDPSolver.h     |  8 ++++++--
 src/SDPSolverIO.cpp | 21 +++++++++++++--------
 3 files changed, 21 insertions(+), 14 deletions(-)

diff --git a/src/SDPSolver.cpp b/src/SDPSolver.cpp
index ff8847c..cd09697 100644
--- a/src/SDPSolver.cpp
+++ b/src/SDPSolver.cpp
@@ -642,8 +642,7 @@ SDPSolverTerminateReason SDPSolver::run(const SDPSolverParameters &parameters,
     computeSearchDirection(betaPredictor, mu, false);
 
     // Mehrotra corrector solution for (dx, dX, dY)
-    Real betaCorrector = correctorCenteringParameter(parameters, X, dX, Y, dY, mu,
-                                                     isPrimalFeasible && isDualFeasible);
+    Real betaCorrector = correctorCenteringParameter(parameters, X, dX, Y, dY, mu, isPrimalFeasible && isDualFeasible);
     computeSearchDirection(betaCorrector, mu, true);
 
     // Step length to preserve positive definiteness
@@ -657,8 +656,7 @@ SDPSolverTerminateReason SDPSolver::run(const SDPSolverParameters &parameters,
       dualStepLength = primalStepLength;
     }
 
-    printSolverInfo(iteration, mu, status, isPrimalFeasible, isDualFeasible,
-                    primalStepLength, dualStepLength, betaCorrector);
+    printSolverInfo(iteration, mu, status, primalStepLength, dualStepLength, betaCorrector);
 
     // Update current point
     scaleVector(dx, primalStepLength);
diff --git a/src/SDPSolver.h b/src/SDPSolver.h
index fabe09d..56b394e 100644
--- a/src/SDPSolver.h
+++ b/src/SDPSolver.h
@@ -140,7 +140,11 @@ public:
 };
 
 void printSolverHeader();
-void printSolverInfo(int iteration, Real mu, SDPSolverStatus status, bool isPrimalFeasible,
-                     bool isDualFeasible, Real primalStepLength, Real dualStepLength, Real betaCorrector);
+void printSolverInfo(int iteration,
+                     Real mu,
+                     SDPSolverStatus status,
+                     Real primalStepLength,
+                     Real dualStepLength,
+                     Real betaCorrector);
 
 #endif  // SDP_BOOTSTRAP_SDPSOLVER_H_
diff --git a/src/SDPSolverIO.cpp b/src/SDPSolverIO.cpp
index 8704f41..b6b7097 100644
--- a/src/SDPSolverIO.cpp
+++ b/src/SDPSolverIO.cpp
@@ -1,41 +1,46 @@
 #include <iostream>
 #include <ostream>
+#include <sstream>
 #include "omp.h"
 #include "boost/archive/text_oarchive.hpp"
 #include "boost/archive/text_iarchive.hpp"
 #include "boost/filesystem.hpp"
 #include "boost/filesystem/fstream.hpp"
+#include "boost/date_time/posix_time/posix_time.hpp"
 #include "SDPSolver.h"
 #include "serialize.h"
 #include "Timers.h"
 
 using boost::filesystem::path;
+using boost::posix_time::time_duration;
+using boost::posix_time::microseconds;
 using std::cout;
 
 void printSolverHeader() {
-  cout << "\n     time    mu        P-obj       D-obj      gap         P-err         D-err       P-step   D-step   beta\n";
-  cout << "-----------------------------------------------------------------------------------------------------------\n";
+  cout << "\n     time      mu        P-obj       D-obj      gap         P-err       D-err      P-step   D-step   beta\n";
+  cout << "---------------------------------------------------------------------------------------------------------\n";
 }
 
 void printSolverInfo(int iteration,
                      Real mu,
                      SDPSolverStatus status,
-                     bool isPrimalFeasible,
-                     bool isDualFeasible,
                      Real primalStepLength,
                      Real dualStepLength,
                      Real betaCorrector) {
   Real time = Real(timers["Run solver"].elapsed().wall)/1000000000;
+  time_duration td(microseconds(timers["Run solver"].elapsed().wall)/1000);
+  std::stringstream ss;
+  ss << td;
   gmp_fprintf(stdout,
-              "%3d  %-7.3Fg %-8.1Fe %-+11.2Fe %-+11.2Fe %-9.2Fe %s%-+10.2Fe%s  %s%-+10.2Fe%s  %-8.3Fg %-8.3Fg %-4.2Fg\n",
+              "%3d  %s  %-8.1Fe %-+11.2Fe %-+11.2Fe %-9.2Fe  %-+10.2Fe  %-+10.2Fe  %-8.3Fg %-8.3Fg %-4.2Fg\n",
               iteration,
-              time.get_mpf_t(),
+              ss.str().substr(0,8).c_str(),
               mu.get_mpf_t(),
               status.primalObjective.get_mpf_t(),
               status.dualObjective.get_mpf_t(),
               status.dualityGap().get_mpf_t(),
-              isPrimalFeasible ? "|" : " ", status.primalError.get_mpf_t(), isPrimalFeasible ? "|" : " ",
-              isDualFeasible   ? "|" : " ", status.dualError.get_mpf_t(),   isDualFeasible   ? "|" : " ",
+              status.primalError.get_mpf_t(),
+              status.dualError.get_mpf_t(),
               primalStepLength.get_mpf_t(),
               dualStepLength.get_mpf_t(),
               betaCorrector.get_mpf_t());

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/sdpb.git



More information about the debian-science-commits mailing list