diff options
author | epapoutsellis <epapoutsellis@gmail.com> | 2019-04-25 17:48:03 +0100 |
---|---|---|
committer | epapoutsellis <epapoutsellis@gmail.com> | 2019-04-25 17:48:03 +0100 |
commit | 8ef753231e74b4dad339370661b563a57ffe75cf (patch) | |
tree | 4e6b4d9faee83604fb3e166c99781838d39ba07b /Wrappers/Python | |
parent | ef64abf3fdfb72ef21a1f2bcd05bf0349c1d12f9 (diff) | |
download | framework-8ef753231e74b4dad339370661b563a57ffe75cf.tar.gz framework-8ef753231e74b4dad339370661b563a57ffe75cf.tar.bz2 framework-8ef753231e74b4dad339370661b563a57ffe75cf.tar.xz framework-8ef753231e74b4dad339370661b563a57ffe75cf.zip |
fix L2 and ALgo
Diffstat (limited to 'Wrappers/Python')
-rwxr-xr-x | Wrappers/Python/ccpi/optimisation/algorithms/Algorithm.py | 25 | ||||
-rw-r--r-- | Wrappers/Python/ccpi/optimisation/functions/L2NormSquared.py | 8 |
2 files changed, 23 insertions, 10 deletions
diff --git a/Wrappers/Python/ccpi/optimisation/algorithms/Algorithm.py b/Wrappers/Python/ccpi/optimisation/algorithms/Algorithm.py index 3c97480..47376a5 100755 --- a/Wrappers/Python/ccpi/optimisation/algorithms/Algorithm.py +++ b/Wrappers/Python/ccpi/optimisation/algorithms/Algorithm.py @@ -149,23 +149,30 @@ class Algorithm(object): print("Iteration {:<5} Primal {:<5} Dual {:<5} PDgap".format('','','')) for _ in self: + + if self.iteration % self.update_objective_interval == 0: + if verbose: - if verbose and self.iteration % self.update_objective_interval == 0: +# if verbose and self.iteration % self.update_objective_interval == 0: #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])) + # \t for tab +# print( "{:04}/{:04} {:<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 {}/{}, {}".format(self.iteration, + self.max_iteration, self.get_last_objective()) ) + #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(), self.x) + else: + if callback is not None: + callback(self.iteration, self.get_last_objective(), self.x) i += 1 if i == iterations: break diff --git a/Wrappers/Python/ccpi/optimisation/functions/L2NormSquared.py b/Wrappers/Python/ccpi/optimisation/functions/L2NormSquared.py index 20e754e..6cb3d8a 100644 --- a/Wrappers/Python/ccpi/optimisation/functions/L2NormSquared.py +++ b/Wrappers/Python/ccpi/optimisation/functions/L2NormSquared.py @@ -146,7 +146,13 @@ class L2NormSquared(Function): ''' - return ScaledFunction(self, scalar) + return ScaledFunction(self, scalar) + + + def operator_composition(self, operator): + + return FunctionOperatorComposition + if __name__ == '__main__': |