3 views (last 30 days)

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

Don Mathis
on 13 Oct 2017

You can define your own modified version of the BayesianOptimization class and have your "my_bayesopt" function call that. Put a copy of BayesianOptimization.m into your local folder and rename it MyBayesianOptimization.m. Then, inside MyBayesianOptimization.m,

- Rename the class on line 1:

classdef MyBayesianOptimization

- Rename the constructor:

function this = MyBayesianOptimization(Options)

- Make checkXConstraintFcnSatisfiability do nothing:

function checkXConstraintFcnSatisfiability(this)

end

Inside your my_bayesopt.m, make it call your new class:

function Results = my_bayesopt(ObjectiveFcn, VariableDescriptions, varargin)

Options = bayesoptim.BayesoptOptions(ObjectiveFcn, VariableDescriptions, varargin);

Options.NumRestartCandidates = 1e6;

Results = MyBayesianOptimization(Options);

end

This works for me in MATLAB version R2016b. Let me know how it goes.

Opportunities for recent engineering grads.

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

Start Hunting!
## 1 Comment

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/359683-baysian-optimisation-any-way-of-increasing-the-sample-size-of-candidates-solutions-to-satisfy-xcons#comment_490411

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/359683-baysian-optimisation-any-way-of-increasing-the-sample-size-of-candidates-solutions-to-satisfy-xcons#comment_490411

Sign in to comment.