diff --git a/pypesto/profile/options.py b/pypesto/profile/options.py index efb131e14..9867c4fa5 100644 --- a/pypesto/profile/options.py +++ b/pypesto/profile/options.py @@ -35,6 +35,9 @@ class ProfileOptions(dict): magic_factor_obj_value: There is this magic factor in the old profiling code which slows down profiling at small ratios (must be >= 0 and < 1). + whole_path: + Whether to profile the whole bounds or only till we get below the + ratio. """ def __init__( @@ -48,6 +51,7 @@ def __init__( reg_points: int = 10, reg_order: int = 4, magic_factor_obj_value: float = 0.5, + whole_path: bool = False, ): super().__init__() @@ -60,6 +64,7 @@ def __init__( self.reg_points = reg_points self.reg_order = reg_order self.magic_factor_obj_value = magic_factor_obj_value + self.whole_path = whole_path def __getattr__(self, key): """Allow usage of keys like attributes.""" diff --git a/pypesto/profile/walk_along_profile.py b/pypesto/profile/walk_along_profile.py index 5d6390450..909863cd8 100644 --- a/pypesto/profile/walk_along_profile.py +++ b/pypesto/profile/walk_along_profile.py @@ -62,15 +62,14 @@ def walk_along_profile( x_now = current_profile.x_path[:, -1] # check if the next profile point needs to be computed - if par_direction == -1: - stop_profile = (x_now[i_par] <= problem.lb_full[[i_par]]) or ( - current_profile.ratio_path[-1] < options.ratio_min - ) - - if par_direction == 1: - stop_profile = (x_now[i_par] >= problem.ub_full[[i_par]]) or ( - current_profile.ratio_path[-1] < options.ratio_min + if options.whole_path: + stop_profile = ( + x_now[i_par] * par_direction >= problem.ub_full[[i_par]] ) + else: + stop_profile = ( + x_now[i_par] * par_direction >= problem.ub_full[[i_par]] + ) or (current_profile.ratio_path[-1] < options.ratio_min) if stop_profile: break