# Ray Tune Search Space validation before trial execution

**URL:** <https://discuss.ray.io/t/ray-tune-search-space-validation-before-trial-execution/4178>\
**Category:** Ray Tune\
**Created:** [November 18, 2021, 4:33pm UTC](https://discuss.ray.io/t/ray-tune-search-space-validation-before-trial-execution/4178 "2021-11-18T16:33:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![paksha](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/paksha/32/1779_2.png) [@paksha](https://discuss.ray.io/u/paksha)\
**Post date:** [November 18, 2021, 4:33pm UTC](https://discuss.ray.io/t/ray-tune-search-space-validation-before-trial-execution/4178/1 "2021-11-18T16:33:23Z")

</div>

Is there a way to invalidate a search space that was generated by an optimizer before executing the trial?

Instead of determining if the hyperparameters suggested by the optimizer are valid or invalid _after_ the trial has started execution, I would like to do this _before_ the trial is ran. So, with an invalid search space as determined by some function, I would like the optimizer to keep suggesting new search spaces until a “valid” one is found as allowed by some validation function.

I think this would make my program execution much faster, so hopefully there’s some way to do this. I read about the conditional search spaces and looked at some of the examples too, but it wasn’t clear to me how to validate or invalidate the entire config through some function.

What I want to do (in the case where I do not reuse actors) is for a new process to _not_ be created if the search space is invalid by my definition. In the case I do reuse actors, I think being able to do this search space invalidation would help my search be faster.

As a concrete example, let’s my search space consists of three parameters, “a”, “b”, and “c”, and each of those maps to a float. My (hypothetical and weird) validation function might be that the sum of these three parameter values _must_ equal 10.00 and the value of parameter “c” must be an odd integer. I do not want to run any trials where this is not the case by invalidating the search space before spinning up a new trial or process.

Thanks for any help!
