class_docstr: A JS class, inherited from Optimizer.
  
  This is the designed class to define JS-related
  variables and methods.
  
  References:
      J.-S. Chou and D.-N. Truong. A novel metaheuristic optimizer inspired by behavior of jellyfish in ocean.
      Applied Mathematics and Computation (2020).
class_docstr_tok: ["A","JS","class",",","inherited","from","Optimizer",".","This","is","the","designed","class","to","define","JS-related","variables","and","methods",".","References",":","J.-S.","Chou","and","D.-N.","Truong",".","A","novel","metaheuristic","optimizer","inspired","by","behavior","of","jellyfish","in","ocean",".","Applied","Mathematics","and","Computation","(","2020",")","."]
docstr: Calculates type B motion (eq. 15).
  
  Args:
      agent_i: Current agent to be updated.
      agent_j: Selected agent.
  
  Returns:
      (np.ndarray): A type B motion array.
docstr_tok: ["Calculates","type","B","motion","(","eq",".","15",")",".","Args",":","agent_i",":","Current","agent","to","be","updated",".","agent_j",":","Selected","agent",".","Returns",":","(","np.ndarray",")",":","A","type","B","motion","array","."]
code: def _motion_b(self, agent_i: Agent, agent_j: Agent) -> np.ndarray:
      """Calculates type B motion (eq. 15).
  
      Args:
          agent_i: Current agent to be updated.
          agent_j: Selected agent.
  
      Returns:
          (np.ndarray): A type B motion array.
  
      """
  
      r1 = r.generate_uniform_random_number()
  
      if agent_i.fit >= agent_j.fit:
          # Determines its direction (eq. 15 - top)
          d = agent_j.position - agent_i.position
      else:
          # Determines its direction (eq. 15 - bottom)
          d = agent_i.position - agent_j.position
  
      motion = r1 * d
  
      return motion
  
imports: from typing import Any, Dict, List, 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.space import Space
  from opytimizer.utils import logging
label_desc: Use image node_id 12 for calling the JS obj's underlying member method code with example usage: obj._motion_b(agent_i, agent_j) and returns: motion