@@ -75,7 +75,7 @@ def __init__(
7575 def evaluate_true (self , X : Tensor ) -> Tensor :
7676 a , b , c = self .a , self .b , self .c
7777 part1 = - a * torch .exp (- b / math .sqrt (self .dim ) * torch .norm (X , dim = - 1 ))
78- part2 = - torch .exp (torch .mean (torch .cos (c * X ), dim = - 1 ))
78+ part2 = - ( torch .exp (torch .mean (torch .cos (c * X ), dim = - 1 ) ))
7979 return part1 + part2 + a + math .e
8080
8181
@@ -235,8 +235,8 @@ def __init__(
235235 def evaluate_true (self , X : Tensor ) -> Tensor :
236236 part1 = torch .sum (X ** 2 / 4000.0 , dim = 1 )
237237 d = X .shape [1 ]
238- part2 = - torch . prod (
239- torch .cos (X / torch .sqrt (X .new (range (1 , d + 1 ))).view (1 , - 1 ))
238+ part2 = - (
239+ torch .prod ( torch . cos (X / torch .sqrt (X .new (range (1 , d + 1 ))).view (1 , - 1 ) ))
240240 )
241241 return part1 + part2 + 1.0
242242
@@ -325,7 +325,7 @@ def optimizers(self) -> Tensor:
325325 def evaluate_true (self , X : Tensor ) -> Tensor :
326326 self .to (device = X .device , dtype = X .dtype )
327327 inner_sum = torch .sum (self .A * (X .unsqueeze (1 ) - 0.0001 * self .P ) ** 2 , dim = 2 )
328- H = - torch .sum (self .ALPHA * torch .exp (- inner_sum ), dim = 1 )
328+ H = - ( torch .sum (self .ALPHA * torch .exp (- inner_sum ), dim = 1 ) )
329329 if self .dim == 4 :
330330 H = (1.1 + H ) / 0.839
331331 return H
@@ -358,7 +358,9 @@ class HolderTable(SyntheticTestFunction):
358358
359359 def evaluate_true (self , X : Tensor ) -> Tensor :
360360 term = torch .abs (1 - torch .norm (X , dim = 1 ) / math .pi )
361- return - torch .abs (torch .sin (X [..., 0 ]) * torch .cos (X [..., 1 ]) * torch .exp (term ))
361+ return - (
362+ torch .abs (torch .sin (X [..., 0 ]) * torch .cos (X [..., 1 ]) * torch .exp (term ))
363+ )
362364
363365
364366class Levy (SyntheticTestFunction ):
@@ -431,8 +433,10 @@ def optimizers(self) -> Tensor:
431433 def evaluate_true (self , X : Tensor ) -> Tensor :
432434 self .to (device = X .device , dtype = X .dtype )
433435 m = 10
434- return - torch .sum (
435- torch .sin (X ) * torch .sin (self .i * X ** 2 / math .pi ) ** (2 * m ), dim = - 1
436+ return - (
437+ torch .sum (
438+ torch .sin (X ) * torch .sin (self .i * X ** 2 / math .pi ) ** (2 * m ), dim = - 1
439+ )
436440 )
437441
438442
0 commit comments