We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Mention each tutorial page in API pages at least once
<!-- Please write a clear and concise description of what content in https://optuna.readthedocs.io/ is an issue. -->

[Optuna's tutorial](https://optuna.readthedocs.io/en/stable/tutorial/index.html) is a good source to understand Optuna's functionality with concrete examples. However, some tutorial pages might not be mentioned in corresponding Optuna's API pages. 


## Description

Please add a `note section` or `see also section` to mention the following tutorial pages.

- ~[ ] [Lightweight, versatile, and platform agnostic architecture](https://optuna.readthedocs.io/en/stable/tutorial/10_key_features/001_first.html)~
    - ~this is is a little bit conceptual page, so it might not be necessary to be linked.~ 
- [x] [Pythonic Search Space](https://optuna.readthedocs.io/en/stable/tutorial/10_key_features/002_configurations.html)
- [x] [Efficient Optimization Algorithms](https://optuna.readthedocs.io/en/stable/tutorial/10_key_features/003_efficient_optimization_algorithms.html)
- [x] [Easy Parallelization](https://optuna.readthedocs.io/en/stable/tutorial/10_key_features/004_distributed.html)
- [x] [Quick Visualization for Hyperparameter Optimization Analysis](https://optuna.readthedocs.io/en/stable/tutorial/10_key_features/005_visualization.html) 
  - linked from https://optuna.readthedocs.io/en/stable/reference/visualization/index.html
- [x] [Saving/Resuming Study with RDB Backend](https://optuna.readthedocs.io/en/stable/tutorial/20_recipes/001_rdb.html)
  - linked from https://optuna.readthedocs.io/en/stable/reference/generated/optuna.study.create_study.html#optuna.study.create_study
- [x] [Multi-objective Optimization with Optuna] (https://optuna.readthedocs.io/en/stable/tutorial/20_recipes/002_multi_objective.html) https://github.com/optuna/optuna/pull/3339
- [x] [User Attributes](https://optuna.readthedocs.io/en/stable/tutorial/20_recipes/003_attributes.html)
- [x] [Command-Line Interface](https://optuna.readthedocs.io/en/stable/tutorial/20_recipes/004_cli.html)
  - linked from https://optuna.readthedocs.io/en/stable/reference/index.html
- [x] [User-Defined Sampler](https://optuna.readthedocs.io/en/stable/tutorial/20_recipes/005_user_defined_sampler.html)
  - linked from https://optuna.readthedocs.io/en/stable/reference/samplers.html
- [x] [User-Defined Pruner](https://optuna.readthedocs.io/en/stable/tutorial/20_recipes/006_user_defined_pruner.html)
  - linked from https://optuna.readthedocs.io/en/stable/reference/pruners.html
- [x] [Callback for Study.optimize](https://optuna.readthedocs.io/en/stable/tutorial/20_recipes/007_optuna_callback.html)
  - linked from `callbacks`'s section in https://optuna.readthedocs.io/en/stable/reference/generated/optuna.study.Study.html#optuna.study.Study.optimize
- [ ] [Specify Hyperparameters Manually](https://optuna.readthedocs.io/en/stable/tutorial/20_recipes/008_specify_params.html)
  - [x] [the first section](https://optuna.readthedocs.io/en/stable/reference/generated/optuna.study.Study.html#optuna.study.Study.optimize) can be linked from `Study.enqueue_trial` 
  - [ ] [the second section](https://optuna.readthedocs.io/en/stable/tutorial/20_recipes/008_specify_params.html#second-scenario-have-optuna-utilize-already-evaluated-hyperparameters) can be linked from `Study.add_trial`　(see https://github.com/optuna/optuna/pull/3346)
- [x] [Ask-and-Tell Interface](https://optuna.readthedocs.io/en/stable/tutorial/20_recipes/009_ask_and_tell.html)
- [x] [Re-use the best values](https://optuna.readthedocs.io/en/stable/tutorial/20_recipes/010_reuse_best_trial.html) https://github.com/optuna/optuna/pull/3396

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `tutorial/20_recipes/005_user_defined_sampler.py`
Content:
```
1 """
2 .. _sampler:
3 
4 User-Defined Sampler
5 ====================
6 
7 Thanks to user-defined samplers, you can:
8 
9 - experiment your own sampling algorithms,
10 - implement task-specific algorithms to refine the optimization performance, or
11 - wrap other optimization libraries to integrate them into Optuna pipelines (e.g., :class:`~optuna.integration.SkoptSampler`).
12 
13 This section describes the internal behavior of sampler classes and shows an example of implementing a user-defined sampler.
14 
15 
16 Overview of Sampler
17 -------------------
18 
19 A sampler has the responsibility to determine the parameter values to be evaluated in a trial.
20 When a `suggest` API (e.g., :func:`~optuna.trial.Trial.suggest_float`) is called inside an objective function, the corresponding distribution object (e.g., :class:`~optuna.distributions.UniformDistribution`) is created internally. A sampler samples a parameter value from the distribution. The sampled value is returned to the caller of the `suggest` API and evaluated in the objective function.
21 
22 To create a new sampler, you need to define a class that inherits :class:`~optuna.samplers.BaseSampler`.
23 The base class has three abstract methods;
24 :meth:`~optuna.samplers.BaseSampler.infer_relative_search_space`,
25 :meth:`~optuna.samplers.BaseSampler.sample_relative`, and
26 :meth:`~optuna.samplers.BaseSampler.sample_independent`.
27 
28 As the method names imply, Optuna supports two types of sampling: one is **relative sampling** that can consider the correlation of the parameters in a trial, and the other is **independent sampling** that samples each parameter independently.
29 
30 At the beginning of a trial, :meth:`~optuna.samplers.BaseSampler.infer_relative_search_space` is called to provide the relative search space for the trial. Then, :meth:`~optuna.samplers.BaseSampler.sample_relative` is invoked to sample relative parameters from the search space. During the execution of the objective function, :meth:`~optuna.samplers.BaseSampler.sample_independent` is used to sample parameters that don't belong to the relative search space.
31 
32 .. note::
33     Please refer to the document of :class:`~optuna.samplers.BaseSampler` for further details.
34 
35 
36 An Example: Implementing SimulatedAnnealingSampler
37 --------------------------------------------------
38 
39 For example, the following code defines a sampler based on
40 `Simulated Annealing (SA) <https://en.wikipedia.org/wiki/Simulated_annealing>`_:
41 """
42 
43 import numpy as np
44 import optuna
45 
46 
47 class SimulatedAnnealingSampler(optuna.samplers.BaseSampler):
48     def __init__(self, temperature=100):
49         self._rng = np.random.RandomState()
50         self._temperature = temperature  # Current temperature.
51         self._current_trial = None  # Current state.
52 
53     def sample_relative(self, study, trial, search_space):
54         if search_space == {}:
55             return {}
56 
57         # Simulated Annealing algorithm.
58         # 1. Calculate transition probability.
59         prev_trial = study.trials[-2]
60         if self._current_trial is None or prev_trial.value <= self._current_trial.value:
61             probability = 1.0
62         else:
63             probability = np.exp(
64                 (self._current_trial.value - prev_trial.value) / self._temperature
65             )
66         self._temperature *= 0.9  # Decrease temperature.
67 
68         # 2. Transit the current state if the previous result is accepted.
69         if self._rng.uniform(0, 1) < probability:
70             self._current_trial = prev_trial
71 
72         # 3. Sample parameters from the neighborhood of the current point.
73         # The sampled parameters will be used during the next execution of
74         # the objective function passed to the study.
75         params = {}
76         for param_name, param_distribution in search_space.items():
77             if not isinstance(param_distribution, optuna.distributions.UniformDistribution):
78                 raise NotImplementedError("Only suggest_float() is supported")
79 
80             current_value = self._current_trial.params[param_name]
81             width = (param_distribution.high - param_distribution.low) * 0.1
82             neighbor_low = max(current_value - width, param_distribution.low)
83             neighbor_high = min(current_value + width, param_distribution.high)
84             params[param_name] = self._rng.uniform(neighbor_low, neighbor_high)
85 
86         return params
87 
88     # The rest are unrelated to SA algorithm: boilerplate
89     def infer_relative_search_space(self, study, trial):
90         return optuna.samplers.intersection_search_space(study)
91 
92     def sample_independent(self, study, trial, param_name, param_distribution):
93         independent_sampler = optuna.samplers.RandomSampler()
94         return independent_sampler.sample_independent(study, trial, param_name, param_distribution)
95 
96 
97 ###################################################################################################
98 # .. note::
99 #    In favor of code simplicity, the above implementation doesn't support some features (e.g., maximization).
100 #    If you're interested in how to support those features, please see
101 #    `examples/samplers/simulated_annealing.py
102 #    <https://github.com/optuna/optuna-examples/blob/main/samplers/simulated_annealing_sampler.py>`_.
103 #
104 #
105 # You can use ``SimulatedAnnealingSampler`` in the same way as built-in samplers as follows:
106 
107 
108 def objective(trial):
109     x = trial.suggest_float("x", -10, 10)
110     y = trial.suggest_float("y", -5, 5)
111     return x**2 + y
112 
113 
114 sampler = SimulatedAnnealingSampler()
115 study = optuna.create_study(sampler=sampler)
116 study.optimize(objective, n_trials=100)
117 
118 best_trial = study.best_trial
119 print("Best value: ", best_trial.value)
120 print("Parameters that achieve the best value: ", best_trial.params)
121 
122 
123 ###################################################################################################
124 # In this optimization, the values of ``x`` and ``y`` parameters are sampled by using
125 # ``SimulatedAnnealingSampler.sample_relative`` method.
126 #
127 # .. note::
128 #     Strictly speaking, in the first trial,
129 #     ``SimulatedAnnealingSampler.sample_independent`` method is used to sample parameter values.
130 #     Because :func:`~optuna.samplers.intersection_search_space` used in
131 #     ``SimulatedAnnealingSampler.infer_relative_search_space`` cannot infer the search space
132 #     if there are no complete trials.
133
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/tutorial/20_recipes/005_user_defined_sampler.py b/tutorial/20_recipes/005_user_defined_sampler.py
--- a/tutorial/20_recipes/005_user_defined_sampler.py
+++ b/tutorial/20_recipes/005_user_defined_sampler.py
@@ -1,5 +1,5 @@
 """
-.. _sampler:
+.. _user_defined_sampler:
 
 User-Defined Sampler
 ====================

{"golden_diff": "diff --git a/tutorial/20_recipes/005_user_defined_sampler.py b/tutorial/20_recipes/005_user_defined_sampler.py\n--- a/tutorial/20_recipes/005_user_defined_sampler.py\n+++ b/tutorial/20_recipes/005_user_defined_sampler.py\n@@ -1,5 +1,5 @@\n \"\"\"\n-.. _sampler:\n+.. _user_defined_sampler:\n \n User-Defined Sampler\n ====================\n", "issue": "Mention each tutorial page in API pages at least once\n<!-- Please write a clear and concise description of what content in https://optuna.readthedocs.io/ is an issue. -->\r\n\r\n[Optuna's tutorial](https://optuna.readthedocs.io/en/stable/tutorial/index.html) is a good source to understand Optuna's functionality with concrete examples. However, some tutorial pages might not be mentioned in corresponding Optuna's API pages. \r\n\r\n\r\n## Description\r\n\r\nPlease add a `note section` or `see also section` to mention the following tutorial pages.\r\n\r\n- ~[ ] [Lightweight, versatile, and platform agnostic architecture](https://optuna.readthedocs.io/en/stable/tutorial/10_key_features/001_first.html)~\r\n    - ~this is is a little bit conceptual page, so it might not be necessary to be linked.~ \r\n- [x] [Pythonic Search Space](https://optuna.readthedocs.io/en/stable/tutorial/10_key_features/002_configurations.html)\r\n- [x] [Efficient Optimization Algorithms](https://optuna.readthedocs.io/en/stable/tutorial/10_key_features/003_efficient_optimization_algorithms.html)\r\n- [x] [Easy Parallelization](https://optuna.readthedocs.io/en/stable/tutorial/10_key_features/004_distributed.html)\r\n- [x] [Quick Visualization for Hyperparameter Optimization Analysis](https://optuna.readthedocs.io/en/stable/tutorial/10_key_features/005_visualization.html) \r\n  - linked from https://optuna.readthedocs.io/en/stable/reference/visualization/index.html\r\n- [x] [Saving/Resuming Study with RDB Backend](https://optuna.readthedocs.io/en/stable/tutorial/20_recipes/001_rdb.html)\r\n  - linked from https://optuna.readthedocs.io/en/stable/reference/generated/optuna.study.create_study.html#optuna.study.create_study\r\n- [x] [Multi-objective Optimization with Optuna] (https://optuna.readthedocs.io/en/stable/tutorial/20_recipes/002_multi_objective.html) https://github.com/optuna/optuna/pull/3339\r\n- [x] [User Attributes](https://optuna.readthedocs.io/en/stable/tutorial/20_recipes/003_attributes.html)\r\n- [x] [Command-Line Interface](https://optuna.readthedocs.io/en/stable/tutorial/20_recipes/004_cli.html)\r\n  - linked from https://optuna.readthedocs.io/en/stable/reference/index.html\r\n- [x] [User-Defined Sampler](https://optuna.readthedocs.io/en/stable/tutorial/20_recipes/005_user_defined_sampler.html)\r\n  - linked from https://optuna.readthedocs.io/en/stable/reference/samplers.html\r\n- [x] [User-Defined Pruner](https://optuna.readthedocs.io/en/stable/tutorial/20_recipes/006_user_defined_pruner.html)\r\n  - linked from https://optuna.readthedocs.io/en/stable/reference/pruners.html\r\n- [x] [Callback for Study.optimize](https://optuna.readthedocs.io/en/stable/tutorial/20_recipes/007_optuna_callback.html)\r\n  - linked from `callbacks`'s section in https://optuna.readthedocs.io/en/stable/reference/generated/optuna.study.Study.html#optuna.study.Study.optimize\r\n- [ ] [Specify Hyperparameters Manually](https://optuna.readthedocs.io/en/stable/tutorial/20_recipes/008_specify_params.html)\r\n  - [x] [the first section](https://optuna.readthedocs.io/en/stable/reference/generated/optuna.study.Study.html#optuna.study.Study.optimize) can be linked from `Study.enqueue_trial` \r\n  - [ ] [the second section](https://optuna.readthedocs.io/en/stable/tutorial/20_recipes/008_specify_params.html#second-scenario-have-optuna-utilize-already-evaluated-hyperparameters) can be linked from `Study.add_trial`\u3000(see https://github.com/optuna/optuna/pull/3346)\r\n- [x] [Ask-and-Tell Interface](https://optuna.readthedocs.io/en/stable/tutorial/20_recipes/009_ask_and_tell.html)\r\n- [x] [Re-use the best values](https://optuna.readthedocs.io/en/stable/tutorial/20_recipes/010_reuse_best_trial.html) https://github.com/optuna/optuna/pull/3396\n", "before_files": [{"content": "\"\"\"\n.. _sampler:\n\nUser-Defined Sampler\n====================\n\nThanks to user-defined samplers, you can:\n\n- experiment your own sampling algorithms,\n- implement task-specific algorithms to refine the optimization performance, or\n- wrap other optimization libraries to integrate them into Optuna pipelines (e.g., :class:`~optuna.integration.SkoptSampler`).\n\nThis section describes the internal behavior of sampler classes and shows an example of implementing a user-defined sampler.\n\n\nOverview of Sampler\n-------------------\n\nA sampler has the responsibility to determine the parameter values to be evaluated in a trial.\nWhen a `suggest` API (e.g., :func:`~optuna.trial.Trial.suggest_float`) is called inside an objective function, the corresponding distribution object (e.g., :class:`~optuna.distributions.UniformDistribution`) is created internally. A sampler samples a parameter value from the distribution. The sampled value is returned to the caller of the `suggest` API and evaluated in the objective function.\n\nTo create a new sampler, you need to define a class that inherits :class:`~optuna.samplers.BaseSampler`.\nThe base class has three abstract methods;\n:meth:`~optuna.samplers.BaseSampler.infer_relative_search_space`,\n:meth:`~optuna.samplers.BaseSampler.sample_relative`, and\n:meth:`~optuna.samplers.BaseSampler.sample_independent`.\n\nAs the method names imply, Optuna supports two types of sampling: one is **relative sampling** that can consider the correlation of the parameters in a trial, and the other is **independent sampling** that samples each parameter independently.\n\nAt the beginning of a trial, :meth:`~optuna.samplers.BaseSampler.infer_relative_search_space` is called to provide the relative search space for the trial. Then, :meth:`~optuna.samplers.BaseSampler.sample_relative` is invoked to sample relative parameters from the search space. During the execution of the objective function, :meth:`~optuna.samplers.BaseSampler.sample_independent` is used to sample parameters that don't belong to the relative search space.\n\n.. note::\n    Please refer to the document of :class:`~optuna.samplers.BaseSampler` for further details.\n\n\nAn Example: Implementing SimulatedAnnealingSampler\n--------------------------------------------------\n\nFor example, the following code defines a sampler based on\n`Simulated Annealing (SA) <https://en.wikipedia.org/wiki/Simulated_annealing>`_:\n\"\"\"\n\nimport numpy as np\nimport optuna\n\n\nclass SimulatedAnnealingSampler(optuna.samplers.BaseSampler):\n    def __init__(self, temperature=100):\n        self._rng = np.random.RandomState()\n        self._temperature = temperature  # Current temperature.\n        self._current_trial = None  # Current state.\n\n    def sample_relative(self, study, trial, search_space):\n        if search_space == {}:\n            return {}\n\n        # Simulated Annealing algorithm.\n        # 1. Calculate transition probability.\n        prev_trial = study.trials[-2]\n        if self._current_trial is None or prev_trial.value <= self._current_trial.value:\n            probability = 1.0\n        else:\n            probability = np.exp(\n                (self._current_trial.value - prev_trial.value) / self._temperature\n            )\n        self._temperature *= 0.9  # Decrease temperature.\n\n        # 2. Transit the current state if the previous result is accepted.\n        if self._rng.uniform(0, 1) < probability:\n            self._current_trial = prev_trial\n\n        # 3. Sample parameters from the neighborhood of the current point.\n        # The sampled parameters will be used during the next execution of\n        # the objective function passed to the study.\n        params = {}\n        for param_name, param_distribution in search_space.items():\n            if not isinstance(param_distribution, optuna.distributions.UniformDistribution):\n                raise NotImplementedError(\"Only suggest_float() is supported\")\n\n            current_value = self._current_trial.params[param_name]\n            width = (param_distribution.high - param_distribution.low) * 0.1\n            neighbor_low = max(current_value - width, param_distribution.low)\n            neighbor_high = min(current_value + width, param_distribution.high)\n            params[param_name] = self._rng.uniform(neighbor_low, neighbor_high)\n\n        return params\n\n    # The rest are unrelated to SA algorithm: boilerplate\n    def infer_relative_search_space(self, study, trial):\n        return optuna.samplers.intersection_search_space(study)\n\n    def sample_independent(self, study, trial, param_name, param_distribution):\n        independent_sampler = optuna.samplers.RandomSampler()\n        return independent_sampler.sample_independent(study, trial, param_name, param_distribution)\n\n\n###################################################################################################\n# .. note::\n#    In favor of code simplicity, the above implementation doesn't support some features (e.g., maximization).\n#    If you're interested in how to support those features, please see\n#    `examples/samplers/simulated_annealing.py\n#    <https://github.com/optuna/optuna-examples/blob/main/samplers/simulated_annealing_sampler.py>`_.\n#\n#\n# You can use ``SimulatedAnnealingSampler`` in the same way as built-in samplers as follows:\n\n\ndef objective(trial):\n    x = trial.suggest_float(\"x\", -10, 10)\n    y = trial.suggest_float(\"y\", -5, 5)\n    return x**2 + y\n\n\nsampler = SimulatedAnnealingSampler()\nstudy = optuna.create_study(sampler=sampler)\nstudy.optimize(objective, n_trials=100)\n\nbest_trial = study.best_trial\nprint(\"Best value: \", best_trial.value)\nprint(\"Parameters that achieve the best value: \", best_trial.params)\n\n\n###################################################################################################\n# In this optimization, the values of ``x`` and ``y`` parameters are sampled by using\n# ``SimulatedAnnealingSampler.sample_relative`` method.\n#\n# .. note::\n#     Strictly speaking, in the first trial,\n#     ``SimulatedAnnealingSampler.sample_independent`` method is used to sample parameter values.\n#     Because :func:`~optuna.samplers.intersection_search_space` used in\n#     ``SimulatedAnnealingSampler.infer_relative_search_space`` cannot infer the search space\n#     if there are no complete trials.\n", "path": "tutorial/20_recipes/005_user_defined_sampler.py"}], "after_files": [{"content": "\"\"\"\n.. _user_defined_sampler:\n\nUser-Defined Sampler\n====================\n\nThanks to user-defined samplers, you can:\n\n- experiment your own sampling algorithms,\n- implement task-specific algorithms to refine the optimization performance, or\n- wrap other optimization libraries to integrate them into Optuna pipelines (e.g., :class:`~optuna.integration.SkoptSampler`).\n\nThis section describes the internal behavior of sampler classes and shows an example of implementing a user-defined sampler.\n\n\nOverview of Sampler\n-------------------\n\nA sampler has the responsibility to determine the parameter values to be evaluated in a trial.\nWhen a `suggest` API (e.g., :func:`~optuna.trial.Trial.suggest_float`) is called inside an objective function, the corresponding distribution object (e.g., :class:`~optuna.distributions.UniformDistribution`) is created internally. A sampler samples a parameter value from the distribution. The sampled value is returned to the caller of the `suggest` API and evaluated in the objective function.\n\nTo create a new sampler, you need to define a class that inherits :class:`~optuna.samplers.BaseSampler`.\nThe base class has three abstract methods;\n:meth:`~optuna.samplers.BaseSampler.infer_relative_search_space`,\n:meth:`~optuna.samplers.BaseSampler.sample_relative`, and\n:meth:`~optuna.samplers.BaseSampler.sample_independent`.\n\nAs the method names imply, Optuna supports two types of sampling: one is **relative sampling** that can consider the correlation of the parameters in a trial, and the other is **independent sampling** that samples each parameter independently.\n\nAt the beginning of a trial, :meth:`~optuna.samplers.BaseSampler.infer_relative_search_space` is called to provide the relative search space for the trial. Then, :meth:`~optuna.samplers.BaseSampler.sample_relative` is invoked to sample relative parameters from the search space. During the execution of the objective function, :meth:`~optuna.samplers.BaseSampler.sample_independent` is used to sample parameters that don't belong to the relative search space.\n\n.. note::\n    Please refer to the document of :class:`~optuna.samplers.BaseSampler` for further details.\n\n\nAn Example: Implementing SimulatedAnnealingSampler\n--------------------------------------------------\n\nFor example, the following code defines a sampler based on\n`Simulated Annealing (SA) <https://en.wikipedia.org/wiki/Simulated_annealing>`_:\n\"\"\"\n\nimport numpy as np\nimport optuna\n\n\nclass SimulatedAnnealingSampler(optuna.samplers.BaseSampler):\n    def __init__(self, temperature=100):\n        self._rng = np.random.RandomState()\n        self._temperature = temperature  # Current temperature.\n        self._current_trial = None  # Current state.\n\n    def sample_relative(self, study, trial, search_space):\n        if search_space == {}:\n            return {}\n\n        # Simulated Annealing algorithm.\n        # 1. Calculate transition probability.\n        prev_trial = study.trials[-2]\n        if self._current_trial is None or prev_trial.value <= self._current_trial.value:\n            probability = 1.0\n        else:\n            probability = np.exp(\n                (self._current_trial.value - prev_trial.value) / self._temperature\n            )\n        self._temperature *= 0.9  # Decrease temperature.\n\n        # 2. Transit the current state if the previous result is accepted.\n        if self._rng.uniform(0, 1) < probability:\n            self._current_trial = prev_trial\n\n        # 3. Sample parameters from the neighborhood of the current point.\n        # The sampled parameters will be used during the next execution of\n        # the objective function passed to the study.\n        params = {}\n        for param_name, param_distribution in search_space.items():\n            if not isinstance(param_distribution, optuna.distributions.UniformDistribution):\n                raise NotImplementedError(\"Only suggest_float() is supported\")\n\n            current_value = self._current_trial.params[param_name]\n            width = (param_distribution.high - param_distribution.low) * 0.1\n            neighbor_low = max(current_value - width, param_distribution.low)\n            neighbor_high = min(current_value + width, param_distribution.high)\n            params[param_name] = self._rng.uniform(neighbor_low, neighbor_high)\n\n        return params\n\n    # The rest are unrelated to SA algorithm: boilerplate\n    def infer_relative_search_space(self, study, trial):\n        return optuna.samplers.intersection_search_space(study)\n\n    def sample_independent(self, study, trial, param_name, param_distribution):\n        independent_sampler = optuna.samplers.RandomSampler()\n        return independent_sampler.sample_independent(study, trial, param_name, param_distribution)\n\n\n###################################################################################################\n# .. note::\n#    In favor of code simplicity, the above implementation doesn't support some features (e.g., maximization).\n#    If you're interested in how to support those features, please see\n#    `examples/samplers/simulated_annealing.py\n#    <https://github.com/optuna/optuna-examples/blob/main/samplers/simulated_annealing_sampler.py>`_.\n#\n#\n# You can use ``SimulatedAnnealingSampler`` in the same way as built-in samplers as follows:\n\n\ndef objective(trial):\n    x = trial.suggest_float(\"x\", -10, 10)\n    y = trial.suggest_float(\"y\", -5, 5)\n    return x**2 + y\n\n\nsampler = SimulatedAnnealingSampler()\nstudy = optuna.create_study(sampler=sampler)\nstudy.optimize(objective, n_trials=100)\n\nbest_trial = study.best_trial\nprint(\"Best value: \", best_trial.value)\nprint(\"Parameters that achieve the best value: \", best_trial.params)\n\n\n###################################################################################################\n# In this optimization, the values of ``x`` and ``y`` parameters are sampled by using\n# ``SimulatedAnnealingSampler.sample_relative`` method.\n#\n# .. note::\n#     Strictly speaking, in the first trial,\n#     ``SimulatedAnnealingSampler.sample_independent`` method is used to sample parameter values.\n#     Because :func:`~optuna.samplers.intersection_search_space` used in\n#     ``SimulatedAnnealingSampler.infer_relative_search_space`` cannot infer the search space\n#     if there are no complete trials.\n", "path": "tutorial/20_recipes/005_user_defined_sampler.py"}]}