# Baysian Optimisation. Any way of increasing the sample size of candidates solutions to satisfy XConstraintFunction in bayesopt()?

3 views (last 30 days)
Bob Hickish on 4 Oct 2017
Commented: LANG Wu on 3 May 2021
I'm investigating the suitability of bayesopt() for problems of increasing dimensionality and range within the variables. As both of these increase, the number of solutions in the solution space grows quickly, whilst the number of feasible solutions grows less quickly. I have included a constraint function as an input to bayesopt(). The bayeopt() algorithm checks whether this can be satisfied be inputting 10,000 possible solutions (I assume drawn from the solution space) to it and seeing if any are feasible. However as mentioned before, the solution space grows a lot more quickly than the number of feasible solutions. This means that it becomes very unlikely to draw a feasible solution in 10,000 selections. If a feasible solution is not found, bayesopt() considers there to be no feasible solutions and terminates the algorithm. However, I know that there are feasible solutions so would like the algorithm to continue so I can see how it performs. Is there a way of increasing the 10,000 limit? I can see the variable that would be need to changed in the bayesopt() code, but when I try to change it I get a pop up box saying that I dont have access to alter the file.
##### 2 CommentsShowHide 1 older comment
LANG Wu on 3 May 2021
Hi Bob,
Have you solved the issue that passing InitialX to the constraint function?
Thanks,
Lang

Don Mathis on 6 Oct 2017
Unfortunately the API doesn't allow that, but you can assign into the Options object once you have one. The bayesopt function creates one right away, so you could do something like this:
x = optimizableVariable('x',[-8,8]);
fun = @(T)sin(T.x);
BO = my_bayesopt(fun, x)
function Results = my_bayesopt(ObjectiveFcn, VariableDescriptions, varargin)
Options = bayesoptim.BayesoptOptions(ObjectiveFcn, VariableDescriptions, varargin);
Options.NumRestartCandidates = 1e6;
Results = BayesianOptimization(Options);
end
Bob Hickish on 1 Nov 2017
I have just got round to implementing this. It has worked perfectly, thanks.

### Categories

Find more on Classification Ensembles in Help Center and File Exchange

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!