my nonlinear constraints HAVE to be satisfied, what to do next?

30 ビュー (過去 30 日間)
Frank
Frank 2023 年 5 月 9 日
編集済み: Matt J 2023 年 5 月 9 日
I am working on a sophisticated anisotropic tomographic modeling project. I recently learned that the fmincon function in MATLAB does not always honor nonlinear constraints. I am aware that there are codes on GitHub that claim to always honor nonlinear constraints, but I do not have much confidence in GitHub code. My nonlinear constraints are quite complicated: they are 4th order polynomials with 4 variables for my current work. In the future, I may have 15th order polynomials with 20 variables.
I have two questions:
  1. Is there any MATLAB program that always honors nonlinear constraints?
  2. If there is no MATLAB program that always honors nonlinear constraints, I may have to write my own code that will always honor nonlinear constraints. I am thinking of boxing or bounding the mth order polynomials with n variables first (of course, this is a complicated task), so that I turn the nonlinear constraints into bound constraints next. Then, I could apply fmincon. Do you have any suggestions?
Thank you very much for your help!
  10 件のコメント
Frank
Frank 2023 年 5 月 9 日
@Torsten Thank you very much! Could you please tell me what do you mean "project"?
Torsten
Torsten 2023 年 5 月 9 日
編集済み: Torsten 2023 年 5 月 9 日
Project means:
Solve the subproblem of finding the nearest feasible point to the one suggested by fmincon:
min: sum((x-x_suggested_by_fmincon).^2)
s.t.
your constraints on x.
in each call of your objective function.
But maybe evaluating your constraints gives similar problems as evaluating your objective for infeasible points - I don't know.
I think Matt J has more experience than I with optimization (see his answer below and the link I included to a similar discussion).

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

採用された回答

Matt J
Matt J 2023 年 5 月 9 日
編集済み: Matt J 2023 年 5 月 9 日
(1) It is not possible to enforce equality constraints (e.g. Snell's Law) exactly , whether linear or non-linear. This is true both during the iterative process or at convergence. This is true for any optimization software app you might pursue. It is a fundamental limitation of finite precision digital computing.
(2) Inequality constraints, whether linear or nonlinear can be enforced at convergence by introducing slack, e.g., instead of c(x)<=0 impose c(x)<=-Delta<0. Set the ConstraintTolerance parameter to be less than Delta. Note: This will not work if your inequality constrained region has no interior, e.g., the constraint x^2<=0, but in this case, it means your inequality constraint should really be written as an equality constraint anyway.
(3) If for some reason, the computation of the objective or nonlinear constraint function cannot be completed for a certain input x, the recommended approach is to just return NaN or Inf. Certain fmincon algorithms like sqp or interior-point can recover from NaN or Inf values encountered during the iterative search.
  3 件のコメント
Matt J
Matt J 2023 年 5 月 9 日
編集済み: Matt J 2023 年 5 月 9 日
I don't know how the recovery mechanism works, or if there is any documentation describing it. However, it isn't something you're supposed to need to worry about as the user. It's handled under the hood.
Walter Roberson
Walter Roberson 2023 年 5 月 9 日
(Note: some optimization algorithms can recover from inf but not nan)

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

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2023 年 5 月 9 日
If you use surrogateopt then there is no explicit non-linear equality of inequality function parameter. However, you can have the function return a struct in which the field Fval is to be minimized, and the function will try to ensure that the field Ineq <= 0 .
The idea is that the function will be passed a set of model parameters that satisfy the bounds and linear equalities and inequalities, and the function will be responsible for testing nonlinear inequalities itself. If they pass, then compute a valid Fval; if they do not pass then return a high value such as Inf. So you would never compute with the locations that do not pass, because you tested for yourself.
  1 件のコメント
Frank
Frank 2023 年 5 月 9 日
編集済み: Frank 2023 年 5 月 9 日
@Walter Roberson Thanks! I believe surrogateopt is a derivative-free optimization algorithm. My algorithm requires derivatives.

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

カテゴリ

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

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by