File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -561,9 +561,6 @@ def _optimize(problem: OptimizationProblem) -> OptimizeResult:
561561 # Strict checking if bounds are required and infinite values in bounds
562562 # ==================================================================================
563563 if problem .algorithm .algo_info .supports_bounds :
564- # NOTE: All-infinite bounds arrays are normalized to None in bounds processing,
565- # so we only need to handle the cases: None bounds, or mixed finite/infinite
566- # bounds
567564 bounds_missing = (
568565 internal_params .lower_bounds is None or internal_params .upper_bounds is None
569566 )
Original file line number Diff line number Diff line change @@ -117,9 +117,14 @@ def calculate_scaling_factor_and_offset(
117117 raw_factor = np .clip (np .abs (x ), options .clipping_value , np .inf )
118118 scaling_offset = None
119119 elif options .method == "bounds" :
120- if lower_bounds is None or upper_bounds is None :
120+ if (
121+ lower_bounds is None
122+ or np .isinf (lower_bounds ).any ()
123+ or upper_bounds is None
124+ or np .isinf (upper_bounds ).any ()
125+ ):
121126 raise ValueError (
122- "Finite bounds must be provided for 'bounds' scaling method."
127+ "To use the 'bounds' scaling method, all bounds must be finite ."
123128 )
124129 raw_factor = upper_bounds - lower_bounds
125130 scaling_offset = lower_bounds
You can’t perform that action at this time.
0 commit comments