class_docstr: An LSA class, inherited from Optimizer.
  
  This is the designed class to define LSA-related
  variables and methods.
  
  References:
      H. Shareef, A. Ibrahim and A. Mutlag. Lightning search algorithm.
      Applied Soft Computing (2015).
class_docstr_tok: ["An","LSA","class",",","inherited","from","Optimizer",".","This","is","the","designed","class","to","define","LSA-related","variables","and","methods",".","References",":","H.","Shareef",",","A.","Ibrahim","and","A.","Mutlag",".","Lightning","search","algorithm",".","Applied","Soft","Computing","(","2015",")","."]
docstr: Updates the direction array by shaking agent's direction.
  
  Args:
      agent: An agent instance.
      function: A Function object that will be used as the objective function.
docstr_tok: ["Updates","the","direction","array","by","shaking","agent","'s","direction",".","Args",":","agent",":","An","agent","instance",".","function",":","A","Function","object","that","will","be","used","as","the","objective","function","."]
code: def _update_direction(self, agent: Agent, function: Function) -> None:
      """Updates the direction array by shaking agent's direction.
  
      Args:
          agent: An agent instance.
          function: A Function object that will be used as the objective function.
  
      """
  
      for j in range(agent.n_variables):
          direction = copy.deepcopy(agent)
          direction.position[j] += (
              self.direction[j] * 0.005 * (agent.ub[j] - agent.lb[j])
          )
          direction.clip_by_bound()
  
          direction.fit = function(direction.position)
          if direction.fit > agent.fit:
              self.direction[j] *= -1
  
imports: import copy
  from typing import Any, Dict, Optional
  import numpy
  import opytimizer.math.random
  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 LSA obj's underlying member method code with example usage: obj._update_direction(agent, function) without return types