class_docstr: Penalty 2 objective function.
  
  This class defines the Penalty 2 [1]_ global optimization problem. This is a
  multimodal minimization problem defined as follows:
  
  .. math::
  
      f_{\text{Penalty02}}(x) = 0.1 \left\{\sin^2(3\pi x_1) + \sum_{i=1}^{n-1}
      (x_i - 1)^2 \left[1 + \sin^2(3\pi x_{i+1}) \right ]
      + (x_n - 1)^2 \left [1 + \sin^2(2 \pi x_n) \right ]\right \}
      + \sum_{i=1}^n u(x_i, 5, 100, 4)
  
  Where, in this exercise:
  
  .. math::
  
      u(x_i, a, k, m) = 
      \begin{cases}
      k(x_i - a)^m & \textrm{if} \hspace{5pt} x_i > a \\
      0 & \textrm{if} \hspace{5pt} -a \leq x_i \leq a \\
      k(-x_i - a)^m & \textrm{if} \hspace{5pt} x_i < -a \\
      \end{cases}
  
  
  Here, :math:`n` represents the number of dimensions and
  :math:`x_i \in [-50, 50]` for :math:`i = 1, ..., n`.
  
  *Global optimum*: :math:`f(x) = 0` for :math:`x_i = 1` for
  :math:`i = 1, ..., n`
  
  .. [1] Gavana, A. Global Optimization Benchmarks and AMPGO retrieved 2015
class_docstr_tok: ["Penalty","2","objective","function",".","This","class","defines","the","Penalty","2","[","1","]","_","global","optimization","problem",".","This","is","a","multimodal","minimization","problem","defined","as","follows",":","..","math",":",":","f_","{","\\text","{","Penalty02","}","}","(","x",")","=","0.1","\\left\\","{","\\sin^2","(","3\\pi","x_1",")","+","\\sum_","{","i=1","}","^","{","n-1","}","(","x_i","-","1",")","^2","\\left","[","1","+","\\sin^2","(","3\\pi","x_","{","i+1","}",")","\\right","]","+","(","x_n","-","1",")","^2","\\left","[","1","+","\\sin^2","(","2","\\pi","x_n",")","\\right","]","\\right","\\","}","+","\\sum_","{","i=1","}","^n","u","(","x_i",",","5",",","100",",","4",")","Where",",","in","this","exercise",":","..","math",":",":","u","(","x_i",",","a",",","k",",","m",")","=","\\begin","{","cases","}","k","(","x_i","-","a",")","^m","&","\\textrm","{","if","}","\\hspace","{","5pt","}","x_i",">","a","\\\\","0","&","\\textrm","{","if","}","\\hspace","{","5pt","}","-a","\\leq","x_i","\\leq","a","\\\\","k","(","-x_i","-","a",")","^m","&","\\textrm","{","if","}","\\hspace","{","5pt","}","x_i","<","-a","\\\\","\\end","{","cases","}","Here",",",":","math",":","`","n","`","represents","the","number","of","dimensions","and",":","math",":","`","x_i","\\in","[","-50",",","50","]","`","for",":","math",":","`","i","=","1",",","...",",","n","`",".","*","Global","optimum","*",":",":","math",":","`","f","(","x",")","=","0","`","for",":","math",":","`","x_i","=","1","`","for",":","math",":","`","i","=","1",",","...",",","n","`","..","[","1","]","Gavana",",","A",".","Global","Optimization","Benchmarks","and","AMPGO","retrieved","2015"]
code: def __init__(self, dimensions=2):
      Benchmark.__init__(self, dimensions)
  
      self._bounds = list(zip([-50.0] * self.N, [50.0] * self.N))
      self.custom_bounds = ([-4.0, 4.0], [-4.0, 4.0])
  
      self.global_optimum = [[1.0 for _ in range(self.N)]]
      self.fglob = 0.0
      self.change_dimensionality = True
  
imports: from numpy import abs, sum, sin, cos, sqrt, log, prod, where, pi, exp, arange, floor, log10, atleast_2d, zeros
  from .go_benchmark import Benchmark
label_desc: Use image node_id 1 to create a new Penalty02 object from inherited base classes: Benchmark with example: obj = Penalty02(dimensions)