Pattern Search Stopping Criteria

Hi
I have been trying to implement a way to stop the pattern search algorithm, if it reaches a specific function value (or r^2 value in our case). It seems like you can't put 'break' inside the function to stop it with specified values.
Is there any particular fucntions that we can use as a stopping function?
Thanks a lot.

 Respuesta aceptada

Sean de Wolski
Sean de Wolski el 10 de Ag. de 2021

0 votos

You can use an outputfcn for this. The output function can pass back a stop flag.

1 comentario

MSA
MSA el 11 de Ag. de 2021
I was able to stop using the outputfcn. Thanks for your answer and help.

Iniciar sesión para comentar.

Más respuestas (1)

Image Analyst
Image Analyst el 10 de Ag. de 2021

0 votos

Hard to say with out seeing the code. You can put a break inside a for loop or a while loop and it will go to the line right after the end of that loop with all the values having whatever value they had last.
If you just want to exit the entire function immediately, you can use "return" instead of break.
Post your code if you want more help.

3 comentarios

MSA
MSA el 11 de Ag. de 2021
I tried return in the loop, didn't. Maybe I was implementing it in the wrong way.
I was being able to stop the search based on the other comment.
Thanks for your answer and help.
Image Analyst
Image Analyst el 11 de Ag. de 2021
Editada: Image Analyst el 11 de Ag. de 2021
Sorry, when you said "pattern search algorithm", I thought you had your own pattern search function you had written. I didn't know that you were referring to the patternsearch() function that is built in to the Global Optimization Toolbox.
I'll remove the space from the tag, and add the Toolbox to the product list to make it more clear.
MSA
MSA el 11 de Ag. de 2021
I am sorry for making it confusing.

Iniciar sesión para comentar.

Categorías

Productos

Versión

R2019a

Preguntada:

MSA
el 10 de Ag. de 2021

Comentada:

MSA
el 11 de Ag. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by