How to generate the objconstr for multivariate surrogate optimization with nonlinear constraints?

2 ビュー (過去 30 日間)
Hello,
I am trying to use the surrogate optimization function in matlab to obtain the global minima of a problem with an objective function and several nonlinear constraints. My problem has been computed using symbolic variables, but I am not able to find the correct syntax of putting these symbolic cost functinos and nonlinear constraints into "matlabFunction" to obtain the function handle to use with surrogateopt.
***** Code example ********
symbolic_objective_function %computed from several operations
symbolic_nonlinear_constraints %computed after several operations
%% Is the below line of code the correct way to compute the objconstr for use in surrogateopt?
objconstr=matlabFunction([symbolic_objective_function], [symbolic_nonlinear_constraints],'vars',{x})

採用された回答

Alan Weiss
Alan Weiss 2022 年 2 月 15 日
Try this:
obj = matlabFunction(symbolic_objective_function,'vars',{x});
constr = matlabFunction(symbolic_nonlinear_constraints,'vars',{x});
objconstr = @(x)struct('Fval',obj(x),'Ineq',constr(x));
Alan Weiss
MATLAB mathematical toolbox documentation
  4 件のコメント
MohammadReza Jabbari (Jabari)
MohammadReza Jabbari (Jabari) 2024 年 3 月 2 日
Hi Alan Weiss,
How a nonlinear equality constraint can be fed to the Matlab Sover such as Surrogate?
Alan Weiss
Alan Weiss 2024 年 3 月 3 日
As shown in the surrogateopt reference page, the solver does not accept nonlinear equality constraints. This example shows a potential workaround by using two inequality constraints to form an approximate equality constraint. However, this technique does not always work.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSolver Outputs and Iterative Display についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by