class_docstr: Base class describing what an algorithm can do.
  
  Parameters
  ----------
  space : `orion.algo.space.Space`
     Definition of a problem's parameter space.
  kwargs : dict
     Tunable elements of a particular algorithm, a dictionary from
     hyperparameter names to values.
  
  Notes
  -----
  We are using the No Free Lunch theorem's [1]_[3]_ formulation of an
  `BaseAlgorithm`.
  We treat it as a part of a procedure which in each iteration suggests a
  sample of the parameter space of the problem as a candidate solution and observes
  the results of its evaluation.
  
  **Developer Note**: Each algorithm's complete specification, i.e.  implementation of its methods
  and parameters of its own, lies in a separate concrete algorithm class, which must be an
  **immediate** subclass of `BaseAlgorithm`. [The reason for this is current implementation of
  `orion.core.utils.Factory` metaclass which uses `BaseAlgorithm.__subclasses__()`.] Second, one
  must declare an algorithm's own parameters (tunable elements which could be set by
  configuration). This is done by passing them to `BaseAlgorithm.__init__()` by calling Python's
  super with a `Space` object as a positional argument plus algorithm's own parameters as keyword
  arguments. The keys of the keyword arguments passed to `BaseAlgorithm.__init__()` are
  interpreted as the algorithm's parameter names. So for example, a subclass could be as simple
  as this (regarding the logistics, not an actual algorithm's implementation):
  
  Examples
  --------
  .. code-block:: python
     :linenos:
     :emphasize-lines: 7
  
     from orion.algo.base import BaseAlgorithm
     from orion.algo.space import (Integer, Space)
  
     class MySimpleAlgo(BaseAlgorithm):
  
         def __init__(self, space, multiplier=1, another_param="a string param"):
             super().__init__(space, multiplier=multiplier, another_param=another_param)
  
         def suggest(self, num=1):
             print(self.another_param)
             return list(map(lambda x: tuple(map(lambda y: self.multiplier * y, x)),
                             self.space.sample(num)))
  
         def observe(self, points, results):
             pass
  
     dim = Integer('named_param', 'norm', 3, 2, shape=(2, 3))
     s = Space()
     s.register(dim)
  
     algo = MySimpleAlgo(s, 2, "I am just sampling!")
     algo.suggest()
  
  References
  ----------
  .. [1] D. H. Wolpert and W. G. Macready, “No Free Lunch Theorems for Optimization,”
     IEEE Transactions on Evolutionary Computation, vol. 1, no. 1, pp. 67–82, Apr. 1997.
  .. [2] W. G. Macready and D. H. Wolpert, “What Makes An Optimization Problem Hard?,”
     Complexity, vol. 1, no. 5, pp. 40–46, 1996.
  .. [3] D. H. Wolpert and W. G. Macready, “No Free Lunch Theorems for Search,”
     Technical Report SFI-TR-95-02-010, Santa Fe Institute, 1995.
class_docstr_tok: ["Base","class","describing","what","an","algorithm","can","do",".","Parameters","--","--","--","--","--","space",":","`","orion.algo.space.Space","`","Definition","of","a","problem","'s","parameter","space",".","kwargs",":","dict","Tunable","elements","of","a","particular","algorithm",",","a","dictionary","from","hyperparameter","names","to","values",".","Notes","--","--","-","We","are","using","the","No","Free","Lunch","theorem","'s","[","1","]","_","[","3","]","_","formulation","of","an","`","BaseAlgorithm","`",".","We","treat","it","as","a","part","of","a","procedure","which","in","each","iteration","suggests","a","sample","of","the","parameter","space","of","the","problem","as","a","candidate","solution","and","observes","the","results","of","its","evaluation",".","*","*","Developer","Note","*","*",":","Each","algorithm","'s","complete","specification",",","i.e",".","implementation","of","its","methods","and","parameters","of","its","own",",","lies","in","a","separate","concrete","algorithm","class",",","which","must","be","an","*","*","immediate","*","*","subclass","of","`","BaseAlgorithm","`",".","[","The","reason","for","this","is","current","implementation","of","`","orion.core.utils.Factory","`","metaclass","which","uses","`","BaseAlgorithm.__subclasses__","(",")","`",".","]","Second",",","one","must","declare","an","algorithm","'s","own","parameters","(","tunable","elements","which","could","be","set","by","configuration",")",".","This","is","done","by","passing","them","to","`","BaseAlgorithm.__init__","(",")","`","by","calling","Python's","super","with","a","`","Space","`","object","as","a","positional","argument","plus","algorithm","'s","own","parameters","as","keyword","arguments",".","The","keys","of","the","keyword","arguments","passed","to","`","BaseAlgorithm.__init__","(",")","`","are","interpreted","as","the","algorithm","'s","parameter","names",".","So","for","example",",","a","subclass","could","be","as","simple","as","this","(","regarding","the","logistics",",","not","an","actual","algorithm","'s","implementation",")",":","Examples","--","--","--","--","..","code-block",":",":","python",":","linenos",":",":","emphasize-lines",":","7","from","orion.algo.base","import","BaseAlgorithm","from","orion.algo.space","import","(","Integer",",","Space",")","class","MySimpleAlgo","(","BaseAlgorithm",")",":","def","__init__","(","self",",","space",",","multiplier=1",",","another_param=","''","a","string","param","''",")",":","super","(",")",".__init__","(","space",",","multiplier=multiplier",",","another_param=another_param",")","def","suggest","(","self",",","num=1",")",":","print","(","self.another_param",")","return","list","(","map","(","lambda","x",":","tuple","(","map","(","lambda","y",":","self.multiplier","*","y",",","x",")",")",",","self.space.sample","(","num",")",")",")","def","observe","(","self",",","points",",","results",")",":","pass","dim","=","Integer","(","'named_param","'",",","'norm","'",",","3",",","2",",","shape=","(","2",",","3",")",")","s","=","Space","(",")","s.register","(","dim",")","algo","=","MySimpleAlgo","(","s",",","2",",","``","I","am","just","sampling","!","''",")","algo.suggest","(",")","References","--","--","--","--","--","..","[","1","]","D.","H.","Wolpert","and","W.","G.","Macready",",","\u201c","No","Free","Lunch","Theorems","for","Optimization",",","\u201d","IEEE","Transactions","on","Evolutionary","Computation",",","vol",".","1",",","no",".","1",",","pp",".","67\u201382",",","Apr",".","1997",".","..","[","2","]","W.","G.","Macready","and","D.","H.","Wolpert",",","\u201c","What","Makes","An","Optimization","Problem","Hard","?",",","\u201d","Complexity",",","vol",".","1",",","no",".","5",",","pp",".","40\u201346",",","1996",".","..","[","3","]","D.","H.","Wolpert","and","W.","G.","Macready",",","\u201c","No","Free","Lunch","Theorems","for","Search",",","\u201d","Technical","Report","SFI-TR-95-02-010",",","Santa","Fe","Institute",",","1995","."]
docstr: Returns the name of the first fidelity dimension if there is one, otherwise `None`.
docstr_tok: ["Returns","the","name","of","the","first","fidelity","dimension","if","there","is","one",",","otherwise","`","None","`","."]
code: def fidelity_index(self) -> str | None:
      """Returns the name of the first fidelity dimension if there is one, otherwise `None`."""
      fidelity_dims = [
          dim for dim in self.space.values() if dim.type == "fidelity"
      ]
      if fidelity_dims:
          return fidelity_dims[0].name
      return None
  
imports: from __future__ import annotations
  import inspect
  import logging
  from abc import abstractmethod
  from typing import Any
  from orion.algo.base.registry import Registry
  from orion.algo.space import Space
  from orion.core.utils import GenericFactory
  from orion.core.utils.flatten import flatten
  from orion.core.worker.trial import Trial
label_desc: Use image node_id 6 for calling the BaseAlgorithm obj's underlying member method code with example usage: obj.fidelity_index() and returns: None, fidelity_dims