From f1da1e2bda23a978c92b91a5d533c7d4b331acc3 Mon Sep 17 00:00:00 2001 From: epapoutsellis Date: Thu, 25 Apr 2019 10:08:08 +0100 Subject: change verbose format --- .../Python/ccpi/optimisation/algorithms/Algorithm.py | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'Wrappers') diff --git a/Wrappers/Python/ccpi/optimisation/algorithms/Algorithm.py b/Wrappers/Python/ccpi/optimisation/algorithms/Algorithm.py index ed95c3f..3c97480 100755 --- a/Wrappers/Python/ccpi/optimisation/algorithms/Algorithm.py +++ b/Wrappers/Python/ccpi/optimisation/algorithms/Algorithm.py @@ -145,13 +145,27 @@ class Algorithm(object): if self.should_stop(): print ("Stop cryterion has been reached.") i = 0 + + print("Iteration {:<5} Primal {:<5} Dual {:<5} PDgap".format('','','')) for _ in self: + + if verbose and self.iteration % self.update_objective_interval == 0: - print ("Iteration {}/{}, objective {}".format(self.iteration, - self.max_iteration, self.get_last_objective()) ) + #pass + print( "{}/{} {:<5} {:.4f} {:<5} {:.4f} {:<5} {:.4f}".\ + format(self.iteration, self.max_iteration,'', \ + self.get_last_objective()[0],'',\ + self.get_last_objective()[1],'',\ + self.get_last_objective()[2])) + + + #print ("Iteration {}/{}, Primal, Dual, PDgap = {}".format(self.iteration, + # self.max_iteration, self.get_last_objective()) ) + + else: if callback is not None: - callback(self.iteration, self.get_last_objective()) + callback(self.iteration, self.get_last_objective(), self.x) i += 1 if i == iterations: break -- cgit v1.2.3