필터 지우기
필터 지우기

How to do "not equal to" constraints in fmincon/Global search?

조회 수: 8 (최근 30일)
Daniela Würmseer
Daniela Würmseer 2022년 6월 5일
댓글: Walter Roberson 2022년 6월 6일
Is there (in the meantime) a better way than:
existing to "add" a not equal constraint to the optimization Problem?
I want to say for example "x not equal to [0,1,0,1]".
  댓글 수: 6
Walter Roberson
Walter Roberson 2022년 6월 6일
If you implemented an anti-equality constraint, fmincon would happily return the next adjacent representable number(s).
GlobalSearch is often configured to use random starting points; a trivial change in starting point is likely to return locations that are not bit-for-bit identical.
Walter Roberson
Walter Roberson 2022년 6월 6일
Matt's suggestion of requiring a minimum distance from the distinguished point might be useful for this situation.
And possibly paretosearch() instead of global search.

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

채택된 답변

Matt J
Matt J 2022년 6월 6일
I need to test somehow if the solution i get from Global Search is unique.
The run() command, with 5 output arguments, can return all candidate solutions located by the search
If you see that multiple solutions have the same objective value, it would indicate the solution is not unique.
  댓글 수: 1
Walter Roberson
Walter Roberson 2022년 6월 6일
... after doing uniquetol by rows to filter points that are essentially the same.

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

추가 답변 (2개)

Walter Roberson
Walter Roberson 2022년 6월 5일
You could try a nonlinear equality constraint
ceq = double(isequal(x, [0 1 0 1]));
This would return 1 if the equality holds, but non-zero is disfavored. Favoured is 0 which corresponds to false which would be the case when the x is anything else.
I am not convinced that this will work well.
  댓글 수: 2
John D'Errico
John D'Errico 2022년 6월 5일
Ugh, no. This form of constraint would be discontinuous, and fmincon presumes not only continuity, but differentiability. And since fmincon will be passing in real values for the parameters, NOT integer values, exact equality will essentially never happen anyway. So I would doubt that constraint will be of any value at all.
Walter Roberson
Walter Roberson 2022년 6월 5일
I was thinking about the continuity / differentiability when I posted that. I was thinking that it would seem plausible that you could use the nonlinear constraints to exclude (for example) a circle from consideration, and a point is a circle shrunk down to no radius. The nonlinear constraints have never been documented as being required to establish a concave area of solution.

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


Matt J
Matt J 2022년 6월 6일
You could impose a constraint like as a smooth approximation to .
function [c,ceq,gradc,gradceq]=nonlcon(x,r)
ceq=[]; gradceq=[];
gradc=[0;1;0;1]-x(:);
c=(r^2-norm(gradc)^2)/2;
end

카테고리

Help CenterFile Exchange에서 Solver 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