Violation of upper and lower bound in patternsearch

조회 수: 1 (최근 30일)
Andrea
Andrea 2012년 7월 27일
답변: prabhat kumar sharma 2025년 1월 16일
Dear, I am using patternsearch for a minimization problem. I notice that patternsearch algorithm does not meet the bound that I give to the variable x. Is it possible? Is there an option to avoid this issue?
Thanks in advance
Kind regards
Andrea Giostri
  댓글 수: 1
Sean de Wolski
Sean de Wolski 2012년 7월 27일
Could you please post the relevant parts of your code so we can reproduce it?

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

답변 (1개)

prabhat kumar sharma
prabhat kumar sharma 2025년 1월 16일
Hello Andrea,
For reproducing the exact issue. Please share the codepiece.
However, if you're encountering this issue, here are a few things to check and try:
  1. Ensure Bounds Are Correctly Set: Double-check that you've specified the bounds correctly in the patternsearch function call. Bounds should be set using the lb (lower bound) and ub (upper bound) arguments.
lb = [lower_bound1, lower_bound2, ...];
ub = [upper_bound1, upper_bound2, ...];
[x, fval] = patternsearch(@yourObjectiveFunction, x0, [], [], [], [], lb, ub, options);
2. Check Initial Point: Ensure that your initial point x0 is within the specified bounds. If x0 is outside the bounds, the algorithm might behave unexpectedly.
3. Use Options to Enforce Bounds: Although patternsearch should inherently respect bounds, you can specify additional options to ensure robust behavior. Use optimoptions to set options for the algorithm.
options = optimoptions('patternsearch', 'Display', 'iter', 'UseCompletePoll', true, 'UseCompleteSearch', true);
4. Review Custom Functions: If you're using custom functions or constraints, ensure they don't inadvertently modify x to exceed the bounds.
5. Algorithm Settings: If the issue persists, consider using different settings or algorithms within patternsearch. Sometimes, enabling more thorough search options can help.
If you've verified all these aspects and the issue still occurs, it might be worth reaching out to MathWorks support for further support. https://www.mathworks.com/help/matlab/matlab_env/contact-technical-support.html

카테고리

Help CenterFile Exchange에서 Direct Search에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by