class_docstr: Sampler using brute force.
  
  This sampler performs exhaustive search on the defined search space.
  
  Example:
  
      .. testcode::
  
          import optuna
  
  
          def objective(trial):
              c = trial.suggest_categorical("c", ["float", "int"])
              if c == "float":
                  return trial.suggest_float("x", 1, 3, step=0.5)
              elif c == "int":
                  a = trial.suggest_int("a", 1, 3)
                  b = trial.suggest_int("b", a, 3)
                  return a + b
  
  
          study = optuna.create_study(sampler=optuna.samplers.BruteForceSampler())
          study.optimize(objective)
  
  Note:
      The defined search space must be finite. Therefore, when using
      :class:`~optuna.distributions.FloatDistribution` or
      :func:`~optuna.trial.Trial.suggest_float`, ``step=None`` is not allowed.
  
  Note:
      The sampler may fail to try the entire search space in when the suggestion ranges or
      parameters are changed in the same :class:`~optuna.study.Study`.
  
  Args:
      seed:
          A seed to fix the order of trials as the search order randomly shuffled. Please note
          that it is not recommended using this option in distributed optimization settings since
          this option cannot ensure the order of trials and may increase the number of duplicate
          suggestions during distributed optimization.
class_docstr_tok: ["Sampler","using","brute","force",".","This","sampler","performs","exhaustive","search","on","the","defined","search","space",".","Example",":","..","testcode",":",":","import","optuna","def","objective","(","trial",")",":","c","=","trial.suggest_categorical","(","``","c","''",",","[","``","float","''",",","``","int","''","]",")","if","c","==","``","float","''",":","return","trial.suggest_float","(","``","x","''",",","1",",","3",",","step=0.5",")","elif","c","==","``","int","''",":","a","=","trial.suggest_int","(","``","a","''",",","1",",","3",")","b","=","trial.suggest_int","(","``","b","''",",","a",",","3",")","return","a","+","b","study","=","optuna.create_study","(","sampler=optuna.samplers.BruteForceSampler","(",")",")","study.optimize","(","objective",")","Note",":","The","defined","search","space","must","be","finite",".","Therefore",",","when","using",":","class",":","`","~optuna.distributions.FloatDistribution","`","or",":","func",":","`","~optuna.trial.Trial.suggest_float","`",",","``","step=None","``","is","not","allowed",".","Note",":","The","sampler","may","fail","to","try","the","entire","search","space","in","when","the","suggestion","ranges","or","parameters","are","changed","in","the","same",":","class",":","`","~optuna.study.Study","`",".","Args",":","seed",":","A","seed","to","fix","the","order","of","trials","as","the","search","order","randomly","shuffled",".","Please","note","that","it","is","not","recommended","using","this","option","in","distributed","optimization","settings","since","this","option","can","not","ensure","the","order","of","trials","and","may","increase","the","number","of","duplicate","suggestions","during","distributed","optimization","."]
code: def sample_independent(
      self,
      study: Study,
      trial: FrozenTrial,
      param_name: str,
      param_distribution: BaseDistribution,
  ) -> Any:
      trials = study.get_trials(
          deepcopy=False,
          states=(
              TrialState.COMPLETE,
              TrialState.PRUNED,
              TrialState.RUNNING,
              TrialState.FAIL,
          ),
      )
      tree = _TreeNode()
      candidates = _enumerate_candidates(param_distribution)
      tree.expand(param_name, candidates)
      # Populating must happen after the initialization above to prevent `tree` from
      # being initialized as an empty graph, which is created with n_jobs > 1
      # where we get trials[i].params = {} for some i.
      self._populate_tree(
          tree,
          (t for t in trials if t.number != trial.number),
          trial.params,
      )
      if tree.count_unexpanded() == 0:
          return param_distribution.to_external_repr(
              self._rng.rng.choice(candidates)
          )
      else:
          return param_distribution.to_external_repr(
              tree.sample_child(self._rng.rng)
          )
  
imports: from dataclasses import dataclass
  import decimal
  from typing import Any
  from typing import Dict
  from typing import Iterable
  from typing import List
  from typing import Optional
  from typing import Sequence
  from typing import Tuple
  import numpy
  from optuna._experimental import experimental_class
  from optuna.distributions import BaseDistribution
  from optuna.distributions import CategoricalDistribution
  from optuna.distributions import FloatDistribution
  from optuna.distributions import IntDistribution
  from optuna.samplers import BaseSampler
  from optuna.samplers._lazy_random_state import LazyRandomState
  from optuna.study import Study
  from optuna.trial import create_trial
  from optuna.trial import FrozenTrial
  from optuna.trial import TrialState
label_desc: Use image node_id 5 for calling the BruteForceSampler obj's underlying member method code with example usage: obj.sample_independent(study, trial, param_name, param_distribution) and returns: param_distribution, param_distribution