Different Nonlinear Equality and Inequality Constraint Tolerances

조회 수: 4 (최근 30일)
agion
agion 2023년 9월 8일
편집: Bruno Luong 2023년 9월 12일
Dear community, I am working on a couple of optimization problems using either the patternsearch or fmincon function and they requrie both nonlinear equality and inequality constraints. The inequality constraints are relatively simple in that they are designed to keep several of the output variables to be between 0 and 1 and the equality constraint are designed so that several output variables equal 1. I would like to apply a different tolerance for the equality and inequality constraints, e.g. 10^-4 for the equality constraints and 10^-6 for the inequality constraints. Is this possible either within the function options or in the constraint function itself?

채택된 답변

John D'Errico
John D'Errico 2023년 9월 8일
편집: John D'Errico 2023년 9월 8일
As @Torsten said, the answer is a simple one. No. But sometimes, no can be a fuzzy word. :-)
For example, suppose I have two constraints:
x + y > 1
x*y == 3
By default, these are both constraints, and those tools use ONE constraint tolerance. Suppose you want to have a constraint tolerance of 1e-6 for the inequality, and 1e-4 for the equality constraint? Then multiply the equality constraint by a constant, here scaling it by 0.01.
x + y > 1
x*y/100 == 3/100
Now both sets of constraints can happily live under an overall constraint tolerance of 1e-6.
Simple enough? You cannot change the optimizer. But you CAN change your constraints so you will be happy.
Now, could you send in a feature request to TMW, asking for this capability? Well, yes. But if I were a TB developer, I might respond with exactly this workaround, because adding capability to code where the capability is not needed just makes the code more complex, for no gain.
  댓글 수: 2
Bruno Luong
Bruno Luong 2023년 9월 8일
편집: Bruno Luong 2023년 9월 12일
Depending on the selected function and algorithm the constraint tolerance is considered to absolute or relative, or both.
I believe if it is relative, scaling will have no effect.
For the summarized of this aspect see this page https://uk.mathworks.com/help/optim/ug/tolerance-details.html
If you are using fmincon only 'active-set' algorithm considers absolute constraint tolerance thus can be scaled.
agion
agion 2023년 9월 12일
@John D'Errico the workaround you suggested seems to work for my application when using the fmincon fuction as @Bruno Luong mentioned. I did try to perform the scaling with other fmincon algorithms like 'interior-point' to see if it would work and for the most part it was ok; however, I did notice that depending on the value of the output variables and the magnitude of the scaling, in some instances the scaling value was too low and the constraint caused poor fitting. So, it does work within reason.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Torsten
Torsten 2023년 9월 8일
No.

카테고리

Help CenterFile Exchange에서 Nonlinear Optimization에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by