docstr: Initialize the Search
  
  Attributes
  ----------
  optimizer: pyswarms.single
      either LocalBestPSO or GlobalBestPSO
  n_particles : int
      number of particles in the swarm.
  dimensions : int
      number of dimensions in the space.
  options : dict with keys :code:`{'c1', 'c2', 'w', 'k', 'p'}`
      a dictionary containing the parameters for the specific
      optimization technique
  
          * c1 : float
              cognitive parameter
          * c2 : float
              social parameter
          * w : float
              inertia parameter
          * k : int
              number of neighbors to be considered. Must be a
              positive integer less than :code:`n_particles`
          * p: int {1,2}
              the Minkowski p-norm to use. 1 is the
              sum-of-absolute values (or L1 distance) while 2 is
              the Euclidean (or L2) distance.
  
  objective_func: function
      objective function to be evaluated
  iters: int
      number of iterations
  bounds : tuple of np.ndarray, optional (default is None)
      a tuple of size 2 where the first entry is the minimum bound
      while the second entry is the maximum bound. Each array must
      be of shape :code:`(dimensions,)`.
  velocity_clamp : tuple (default is :code:`None`)
      a tuple of size 2 where the first entry is the minimum velocity
      and the second entry is the maximum velocity. It
      sets the limits for velocity clamping.
docstr_tok: ["Initialize","the","Search","Attributes","--","--","--","--","--","optimizer",":","pyswarms.single","either","LocalBestPSO","or","GlobalBestPSO","n_particles",":","int","number","of","particles","in","the","swarm",".","dimensions",":","int","number","of","dimensions","in","the","space",".","options",":","dict","with","keys",":","code",":","`","{","'c1","'",",","'c2","'",",","'","w","'",",","'","k","'",",","'","p","'","}","`","a","dictionary","containing","the","parameters","for","the","specific","optimization","technique","*","c1",":","float","cognitive","parameter","*","c2",":","float","social","parameter","*","w",":","float","inertia","parameter","*","k",":","int","number","of","neighbors","to","be","considered",".","Must","be","a","positive","integer","less","than",":","code",":","`","n_particles","`","*","p",":","int","{","1,2","}","the","Minkowski","p-norm","to","use",".","1","is","the","sum-of-absolute","values","(","or","L1","distance",")","while","2","is","the","Euclidean","(","or","L2",")","distance",".","objective_func",":","function","objective","function","to","be","evaluated","iters",":","int","number","of","iterations","bounds",":","tuple","of","np.ndarray",",","optional","(","default","is","None",")","a","tuple","of","size","2","where","the","first","entry","is","the","minimum","bound","while","the","second","entry","is","the","maximum","bound",".","Each","array","must","be","of","shape",":","code",":","`","(","dimensions",",",")","`",".","velocity_clamp",":","tuple","(","default","is",":","code",":","`","None","`",")","a","tuple","of","size","2","where","the","first","entry","is","the","minimum","velocity","and","the","second","entry","is","the","maximum","velocity",".","It","sets","the","limits","for","velocity","clamping","."]
code: def __init__(
      self,
      optimizer,
      n_particles,
      dimensions,
      options,
      objective_func,
      iters,
      bounds=None,
      velocity_clamp=(0, 1),
  ):
      """Initialize the Search
  
      Attributes
      ----------
      optimizer: pyswarms.single
          either LocalBestPSO or GlobalBestPSO
      n_particles : int
          number of particles in the swarm.
      dimensions : int
          number of dimensions in the space.
      options : dict with keys :code:`{'c1', 'c2', 'w', 'k', 'p'}`
          a dictionary containing the parameters for the specific
          optimization technique
  
              * c1 : float
                  cognitive parameter
              * c2 : float
                  social parameter
              * w : float
                  inertia parameter
              * k : int
                  number of neighbors to be considered. Must be a
                  positive integer less than :code:`n_particles`
              * p: int {1,2}
                  the Minkowski p-norm to use. 1 is the
                  sum-of-absolute values (or L1 distance) while 2 is
                  the Euclidean (or L2) distance.
  
      objective_func: function
          objective function to be evaluated
      iters: int
          number of iterations
      bounds : tuple of np.ndarray, optional (default is None)
          a tuple of size 2 where the first entry is the minimum bound
          while the second entry is the maximum bound. Each array must
          be of shape :code:`(dimensions,)`.
      velocity_clamp : tuple (default is :code:`None`)
          a tuple of size 2 where the first entry is the minimum velocity
          and the second entry is the maximum velocity. It
          sets the limits for velocity clamping.
      """
  
      # Assign attributes
      self.optimizer = optimizer
      self.n_particles = n_particles
      self.dims = dimensions
      self.options = options
      self.bounds = bounds
      self.vclamp = velocity_clamp
      self.objective_func = objective_func
      self.iters = iters
      # Invoke assertions
      self.assertions()
  
file_path: pyswarms/pyswarms/utils/search/base_search.py
imports: from __future__ import absolute_import, print_function, with_statement
  import operator
label_desc: Use image node_id 2 to create a new SearchBase object from inherited base classes: object with example: obj = SearchBase(optimizer, n_particles, dimensions, options, objective_func, iters, bounds, velocity_clamp)