summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdoardo Pasca <edo.paskino@gmail.com>2019-03-11 13:27:58 -0400
committerEdoardo Pasca <edo.paskino@gmail.com>2019-03-11 13:27:58 -0400
commit431cc82f3b09c337ec4d46e7c1d21a0a1b0dbc35 (patch)
tree7202dfd000c0dd0d1f8c83af676c8b953cf578d8
parentfa64464acfb747c4e606a28193514711e4eefcc6 (diff)
downloadframework-431cc82f3b09c337ec4d46e7c1d21a0a1b0dbc35.tar.gz
framework-431cc82f3b09c337ec4d46e7c1d21a0a1b0dbc35.tar.bz2
framework-431cc82f3b09c337ec4d46e7c1d21a0a1b0dbc35.tar.xz
framework-431cc82f3b09c337ec4d46e7c1d21a0a1b0dbc35.zip
run default verbose True excludes callback
-rwxr-xr-xWrappers/Python/ccpi/optimisation/algorithms/Algorithm.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/Wrappers/Python/ccpi/optimisation/algorithms/Algorithm.py b/Wrappers/Python/ccpi/optimisation/algorithms/Algorithm.py
index 680b268..cc99344 100755
--- a/Wrappers/Python/ccpi/optimisation/algorithms/Algorithm.py
+++ b/Wrappers/Python/ccpi/optimisation/algorithms/Algorithm.py
@@ -140,7 +140,7 @@ class Algorithm(object):
raise ValueError('Update objective interval must be an integer >= 1')
else:
raise ValueError('Update objective interval must be an integer >= 1')
- def run(self, iterations, verbose=False, callback=None):
+ def run(self, iterations, verbose=True, callback=None):
'''run n iterations and update the user with the callback if specified'''
if self.should_stop():
print ("Stop cryterion has been reached.")
@@ -149,8 +149,9 @@ class Algorithm(object):
if verbose:
print ("Iteration {}/{}, objective {}".format(self.iteration,
self.max_iteration, self.get_last_objective()) )
- if callback is not None:
- callback(self.iteration, self.get_last_objective())
+ else:
+ if callback is not None:
+ callback(self.iteration, self.get_last_objective())
i += 1
if i == iterations:
break