Violation of upper and lower bound in patternsearch

3 vues (au cours des 30 derniers jours)
Andrea
Andrea le 27 Juil 2012
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 commentaire
Sean de Wolski
Sean de Wolski le 27 Juil 2012
Could you please post the relevant parts of your code so we can reproduce it?

Connectez-vous pour commenter.

Réponses (1)

prabhat kumar sharma
prabhat kumar sharma le 16 Jan 2025 à 9:33
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

Community Treasure Hunt

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

Start Hunting!

Translated by