class_docstr: .. include:: /global.rst
  
  Please refer to |pso| for details on this algorithm.
class_docstr_tok: ["..","include",":",":","\/global.rst","Please","refer","to","|pso|","for","details","on","this","algorithm","."]
docstr: Create a configuration for a ParticleSwarm solver.
  
  :param num_evals: number of permitted function evaluations
  :type num_evals: int
  :param kwargs: box constraints
  :type kwargs: {'param': [lb, ub], ...}
  
  >>> config = ParticleSwarm.suggest_from_box(200, x=[-1, 1], y=[0, 1])
  >>> config['x']
  [-1, 1]
  >>> config['y']
  [0, 1]
  >>> config['num_particles'] > 0
  True
  >>> config['num_generations'] > 0
  True
  >>> solver = ParticleSwarm(**config)
  >>> solver.bounds['x']
  [-1, 1]
  >>> solver.bounds['y']
  [0, 1]
docstr_tok: ["Create","a","configuration","for","a","ParticleSwarm","solver",".",":","param","num_evals",":","number","of","permitted","function","evaluations",":","type","num_evals",":","int",":","param","kwargs",":","box","constraints",":","type","kwargs",":","{","'param","'",":","[","lb",",","ub","]",",","...","}",">",">",">","config","=","ParticleSwarm.suggest_from_box","(","200",",","x=","[","-1",",","1","]",",","y=","[","0",",","1","]",")",">",">",">","config","[","'","x","'","]","[","-1",",","1","]",">",">",">","config","[","'","y","'","]","[","0",",","1","]",">",">",">","config","[","'num_particles","'","]",">","0","True",">",">",">","config","[","'num_generations","'","]",">","0","True",">",">",">","solver","=","ParticleSwarm","(","*","*","config",")",">",">",">","solver.bounds","[","'","x","'","]","[","-1",",","1","]",">",">",">","solver.bounds","[","'","y","'","]","[","0",",","1","]"]
code: def suggest_from_box(num_evals, **kwargs):
      """Create a configuration for a ParticleSwarm solver.
  
      :param num_evals: number of permitted function evaluations
      :type num_evals: int
      :param kwargs: box constraints
      :type kwargs: {'param': [lb, ub], ...}
  
      >>> config = ParticleSwarm.suggest_from_box(200, x=[-1, 1], y=[0, 1])
      >>> config['x']
      [-1, 1]
      >>> config['y']
      [0, 1]
      >>> config['num_particles'] > 0
      True
      >>> config['num_generations'] > 0
      True
      >>> solver = ParticleSwarm(**config)
      >>> solver.bounds['x']
      [-1, 1]
      >>> solver.bounds['y']
      [0, 1]
  
      """
      d = dict(kwargs)
      if num_evals > 1000:
          d["num_particles"] = 100
      elif num_evals >= 200:
          d["num_particles"] = 20
      elif num_evals >= 10:
          d["num_particles"] = 10
      else:
          d["num_particles"] = num_evals
      d["num_generations"] = int(
          math.ceil(float(num_evals) / d["num_particles"])
      )
      return d
  
imports: import math
  import operator
  import random
  import array
  import functools
  from .solver_registry import register_solver
  from .util import Solver, _copydoc, uniform_in_bounds
  from .None import util
  from .Sobol import Sobol
label_desc: Use image node_id 6 for calling the ParticleSwarm obj's underlying member method code with example usage: obj.suggest_from_box(num_evals) and returns: d