|
43 | 43 | 'EXIT_INPUT_ERROR', 'EXIT_TR_INCREASE_ERROR', 'EXIT_LINALG_ERROR', 'EXIT_FALSE_SUCCESS_WARNING', |
44 | 44 | 'EXIT_AUTO_DETECT_RESTART_WARNING'] |
45 | 45 |
|
| 46 | +module_logger = logging.getLogger(__name__) |
| 47 | + |
46 | 48 | EXIT_TR_INCREASE_WARNING = 5 # warning, TR increase in proj constrained case - likely due to multiple active constraints |
47 | 49 | EXIT_AUTO_DETECT_RESTART_WARNING = 4 # warning, auto-detected restart criteria |
48 | 50 | EXIT_FALSE_SUCCESS_WARNING = 3 # warning, maximum fake successful steps reached |
@@ -134,7 +136,7 @@ def npt(self): |
134 | 136 |
|
135 | 137 | def initialise_coordinate_directions(self, number_of_samples, num_directions, params): |
136 | 138 | if self.do_logging: |
137 | | - logging.debug("Initialising with coordinate directions") |
| 139 | + module_logger.debug("Initialising with coordinate directions") |
138 | 140 | # self.model already has x0 evaluated, so only need to initialise the other points |
139 | 141 | # num_directions = params("growing.ndirs_initial") |
140 | 142 | assert self.model.num_pts <= (self.n() + 1) * (self.n() + 2) // 2, "prelim: must have npt <= (n+1)(n+2)/2" |
@@ -311,7 +313,7 @@ def initialise_coordinate_directions(self, number_of_samples, num_directions, pa |
311 | 313 |
|
312 | 314 | def initialise_random_directions(self, number_of_samples, num_directions, params): |
313 | 315 | if self.do_logging: |
314 | | - logging.debug("Initialising with random orthogonal directions") |
| 316 | + module_logger.debug("Initialising with random orthogonal directions") |
315 | 317 | # self.model already has x0 evaluated, so only need to initialise the other points |
316 | 318 | assert 1 <= num_directions < self.model.num_pts, "Initialisation: must have 1 <= ndirs_initial < npt" |
317 | 319 |
|
@@ -442,7 +444,7 @@ def trust_region_step(self, params): |
442 | 444 |
|
443 | 445 | def geometry_step(self, knew, adelt, number_of_samples, params): |
444 | 446 | if self.do_logging: |
445 | | - logging.debug("Running geometry-fixing step") |
| 447 | + module_logger.debug("Running geometry-fixing step") |
446 | 448 | try: |
447 | 449 | c, g = self.model.lagrange_gradient(knew) |
448 | 450 | # c = 1.0 if knew == self.model.kopt else 0.0 # based at xopt, just like d |
@@ -643,12 +645,12 @@ def terminate_from_slow_iterations(self, current_iter, params): |
643 | 645 | if this_iter_slow: |
644 | 646 | self.num_slow_iters += 1 |
645 | 647 | if self.do_logging: |
646 | | - logging.info("Slow iteration (%g consecutive so far, max allowed %g)" |
| 648 | + module_logger.info("Slow iteration (%g consecutive so far, max allowed %g)" |
647 | 649 | % (self.num_slow_iters, params("slow.max_slow_iters"))) |
648 | 650 | else: |
649 | 651 | self.num_slow_iters = 0 |
650 | 652 | if self.do_logging: |
651 | | - logging.debug("Non-slow iteration") |
| 653 | + module_logger.debug("Non-slow iteration") |
652 | 654 | return this_iter_slow, self.num_slow_iters >= params("slow.max_slow_iters") |
653 | 655 |
|
654 | 656 | def soft_restart(self, number_of_samples, nruns_so_far, params, x_in_abs_coords_to_save=None, rvec_to_save=None, |
@@ -677,7 +679,7 @@ def soft_restart(self, number_of_samples, nruns_so_far, params, x_in_abs_coords_ |
677 | 679 | self.model.nsamples[self.model.kopt], x_in_abs_coords=True) |
678 | 680 |
|
679 | 681 | if self.do_logging: |
680 | | - logging.info("Soft restart [currently, f = %g after %g function evals]" % (self.model.fopt(), self.nf)) |
| 682 | + module_logger.info("Soft restart [currently, f = %g after %g function evals]" % (self.model.fopt(), self.nf)) |
681 | 683 | # Resetting method: reset delta and rho, then move the closest 'num_steps' points to xk to improve geometry |
682 | 684 | # Note: closest points because we are suddenly increasing delta & rho, so we want to encourage spreading out points |
683 | 685 | self.delta = self.rhobeg |
@@ -734,7 +736,7 @@ def soft_restart(self, number_of_samples, nruns_so_far, params, x_in_abs_coords_ |
734 | 736 | self.model.add_new_sample(self.model.npt() - 1, rvec_extra=rvec_list[i, :]) |
735 | 737 |
|
736 | 738 | if self.do_logging: |
737 | | - logging.info("Soft restart: added %g new directions, npt is now %g" % (num_pts_to_add, self.model.npt())) |
| 739 | + module_logger.info("Soft restart: added %g new directions, npt is now %g" % (num_pts_to_add, self.model.npt())) |
738 | 740 |
|
739 | 741 | # Otherwise, we are doing a restart |
740 | 742 | self.last_successful_iter = 0 |
|
0 commit comments