Stop fmincon and continue routine.

Hello. Thanks in advance for your help.
I am solving certain problem by using a genetic algorithm, after 'x' iterations i try to improve some chromosomes by calling a fmincon function, using a SQP solver. The problem is that sometimes the SQP gets stuck and i do not know the reason (i am guessing that it can be a problem while computing the hessian or something like that, when i press ctrl -c matlab always says that the operation has been terminated In fmincon (line 910) [X,FVAL,EXITFLAG,OUTPUT,LAMBDA,GRAD,HESSIAN] = sqpLineSearch(funfcn,X,full(A),full(B),full(Aeq),full(Beq), ...).
Ok, what i want to di is to stop the search after some time; but i do want the algorithm to continue with the next chromosome (something like break in a for loop or a return in a 'while'), i.e, i do not want to stop and lose the results of the whole simulations (Genetic Algorithm and some SQP's).
I tried 'return' and it still gets stuck, 'break' is not possible outside a for, when i use a timer and put an error message, the simulation stops and i lose the simulations results.
Any help will be appreciated. Thanks.

답변 (1개)

Matt J
Matt J 2014년 7월 10일
편집: Matt J 2014년 7월 10일

0 개 추천

FMINCON has an optimoption called 'OutputFcn', which lets you terminate the optimization according to your own criteria.

카테고리

도움말 센터File Exchange에서 Surrogate Optimization에 대해 자세히 알아보기

제품

질문:

2014년 7월 10일

편집:

2014년 7월 10일

Community Treasure Hunt

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

Start Hunting!

Translated by