Repository: optuna/optuna

Issue:
Show warning message by `GridSearchSampler` whose `CategoricalDistribution` contains unsupported typed values, not raising `ValueError`
### Motivation

The grid search sampler has a strict type rule for its search space for `CategoricalDistribution`, which is not consistent with the other samplers as reported in #3534.


### Description

`CategoriaclDistribution` shows a warning message when the `choices` argument contains an unsupported type.

When we run the following code
```python
import optuna

optuna.distributions.CategoricalDistribution([[1], [2]])
```

then we see the following warning message:

```bash
/Users/nzw/Documents/optuna/optuna/distributions.py:501: UserWarning: Choices for a categorical distribution should be a tuple of None, bool, int, float and str for persistent storage but contains [1] which is of type list.
  warnings.warn(message)
/Users/nzw/Documents/optuna/optuna/distributions.py:501: UserWarning: Choices for a categorical distribution should be a tuple of None, bool, int, float and str for persistent storage but contains [2] which is of type list.
  warnings.warn(message)
```


On the other hand, the grid search sampler raises `ValueError` when we use such unsupported typed value as an element of `choices` of the distribution.


### Alternatives (optional)

_No response_

### Additional context (optional)

_No response_

Discussion:

Patch:
diff --git a/optuna/samplers/_grid.py b/optuna/samplers/_grid.py
index 4673185db..8ca3738cf 100644
--- a/optuna/samplers/_grid.py
+++ b/optuna/samplers/_grid.py
@@ -211,11 +211,12 @@ class GridSampler(BaseSampler):
         if param_value is None or isinstance(param_value, (str, int, float, bool)):
             return
 
-        raise ValueError(
+        message = (
             "{} contains a value with the type of {}, which is not supported by "
             "`GridSampler`. Please make sure a value is `str`, `int`, `float`, `bool`"
-            " or `None`.".format(param_name, type(param_value))
+            " or `None` for persistent storage.".format(param_name, type(param_value))
         )
+        warnings.warn(message)
 
     def _get_unvisited_grid_ids(self, study: Study) -> List[int]:
 


Test patch:
diff --git a/tests/samplers_tests/test_grid.py b/tests/samplers_tests/test_grid.py
index 466598995..036b3d6b2 100644
--- a/tests/samplers_tests/test_grid.py
+++ b/tests/samplers_tests/test_grid.py
@@ -153,7 +153,7 @@ def test_cast_value() -> None:
     samplers.GridSampler._check_value("x", "foo")
     samplers.GridSampler._check_value("x", "")
 
-    with pytest.raises(ValueError):
+    with pytest.warns(UserWarning):
         samplers.GridSampler._check_value("x", [1])