Skip to content

Commit e3fdf7a

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent ce641f1 commit e3fdf7a

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

opt/adaptive_moment_estimation.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,7 @@ def search(self) -> tuple[np.ndarray, float]:
113113
best_solution = np.clip(best_solution, self.lower_bound, self.upper_bound)
114114

115115
fitness = self.func(best_solution)
116-
if fitness < best_fitness:
117-
best_fitness = fitness
116+
best_fitness = min(best_fitness, fitness)
118117

119118
return best_solution, best_fitness
120119

opt/augmented_lagrangian_method.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,7 @@ def augmented_lagrangian_func(
122122
123123
"""
124124
constraint_val = self.constraint(x)
125-
if constraint_val < 0:
126-
constraint_val = 0
125+
constraint_val = max(constraint_val, 0)
127126
if np.isnan(constraint_val):
128127
constraint_val = self.static_cost
129128

0 commit comments

Comments
 (0)