class_docstr: A PSO class, inherited from Optimizer.
  
  This is the designed class to define PSO-related
  variables and methods.
  
  References:
      J. Kennedy, R. C. Eberhart and Y. Shi. Swarm intelligence.
      Artificial Intelligence (2001).
class_docstr_tok: ["A","PSO","class",",","inherited","from","Optimizer",".","This","is","the","designed","class","to","define","PSO-related","variables","and","methods",".","References",":","J.","Kennedy",",","R.","C.","Eberhart","and","Y.","Shi",".","Swarm","intelligence",".","Artificial","Intelligence","(","2001",")","."]
docstr: Evaluates the search space according to the objective function.
  
  Args:
      space: A Space object that will be evaluated.
      function: A Function object that will be used as the objective function.
docstr_tok: ["Evaluates","the","search","space","according","to","the","objective","function",".","Args",":","space",":","A","Space","object","that","will","be","evaluated",".","function",":","A","Function","object","that","will","be","used","as","the","objective","function","."]
code: def evaluate(self, space: Space, function: Function) -> None:
      """Evaluates the search space according to the objective function.
  
      Args:
          space: A Space object that will be evaluated.
          function: A Function object that will be used as the objective function.
  
      """
  
      for i, agent in enumerate(space.agents):
          fit = function(agent.position)
          if fit < agent.fit:
              agent.fit = fit
              self.local_position[i] = copy.deepcopy(agent.position)
  
          if agent.fit < space.best_agent.fit:
              space.best_agent.position = copy.deepcopy(
                  self.local_position[i]
              )
              space.best_agent.fit = copy.deepcopy(agent.fit)
              space.best_agent.ts = int(time.time())
  
imports: import copy
  import time
  from typing import Any, Dict, List, Optional
  import numpy
  import opytimizer.math.random
  import opytimizer.utils.constant
  import opytimizer.utils.exception
  from opytimizer.core import Optimizer
  from opytimizer.core.agent import Agent
  from opytimizer.core.function import Function
  from opytimizer.core.space import Space
  from opytimizer.utils import logging
label_desc: Use image node_id 13 for calling the PSO obj's underlying member method code with example usage: obj.evaluate(space, function) without return types