Violation of upper and lower bound in patternsearch
1 view (last 30 days)
Show older comments
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 Comment
Sean de Wolski
on 27 Jul 2012
Could you please post the relevant parts of your code so we can reproduce it?
Answers (1)
prabhat kumar sharma
on 16 Jan 2025
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:
- 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
0 Comments
See Also
Categories
Find more on Direct Search in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!