Hello.
I have an optimization problem that is to be solved through 3 iteration "t".
Starting from the 2nd iteration, the constraint function follows some conditions.
My problem is that my code runs only for the 1st iteration while for 2 remaining iterations, I always get the error message as indicated by the attached screenshot "Error Message".
Can you anyone help me dealing with and fixing the error I'm having?
Regards.
===============
NB:
Optimization code => OptimCode.m
Constraint Function => ConstFun.m (it calls the 2 functions, Layer_L_Fcn and Layer_U_Fcn to formulate some constraints)
Objective Function => ObjFun.m

 채택된 답변

Walter Roberson
Walter Roberson 2019년 9월 1일

1 개 추천

C_Geom = [100 - x(7+(t-1)*m); ...
x(2+(t-1)*m)+x(7+(t-1)*m)*cos(deg2rad(x(8+(t-1)*m))) - 9500; ...
x(3+(t-1)*m)+x(7+(t-1)*m)*sin(deg2rad(x(8+(t-1)*m))) - 4500; ...
];
emits 4 non-linear constraints in that case, where-as the other two branches emit 10. The code is expecting that the same number be emitted each time. You should put another 6 zeros on the bottom of that case.

댓글 수: 1

Abderrahmane DADA
Abderrahmane DADA 2019년 9월 2일
편집: Abderrahmane DADA 2019년 9월 2일
Thanks Walter for your answer.
That really works: starting from the 2nd condition, the sizes of my two constraints have to be the same for my code to run.
Thanks a lot again

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

추가 답변 (1개)

Matt J
Matt J 2019년 8월 31일
편집: Matt J 2019년 8월 31일

0 개 추천

Execute dbstop if error at the command line
>>dbstop if error
and then re-run the optimization. The code will pause execution where the error has occurred. Go inside your objective function using the Function Call Stack in the DEBUG panel and observe what has caused the error.

댓글 수: 8

Abderrahmane DADA
Abderrahmane DADA 2019년 8월 31일
Thanks Matt for your answer.
I have followed the steps you mentionned znd it looks like there's an error at line 69 which point to: "rethrow(userFcn_ME)".
Still don't know how to deal with this error: Any advice from your behalf?
Matt J
Matt J 2019년 8월 31일
I see no such line in your OBJFun.m file. Your OBJfun.m file only has 10 lines.
Try
>> dbstop if caught error
instead.
Abderrahmane DADA
Abderrahmane DADA 2019년 8월 31일
When Ifollowed your instruction, the "makeSate.m" function poped out.
It is in that function where you can find that line.
Matt J
Matt J 2019년 8월 31일
But my advice to you was to use the Function Call Stack drop down menu in the image I posted to go to your objective function.
Abderrahmane DADA
Abderrahmane DADA 2019년 9월 1일
편집: Abderrahmane DADA 2019년 9월 1일
Matt.
I have followed all the steps you have indicated to me and when I opened the Function Call Stack drop down menu, my objective functioned is not part of the dropdown menu. Plus, the erorr points to the "makeSate.m" function (line 69) I have attached in my latest post.
I have made a video that shows all the steps yuou have recommanded. Please find it via this link: OptimCode - Error
Did you try
>> dbstop if caught error
Abderrahmane DADA
Abderrahmane DADA 2019년 9월 2일
Thanks a lot Matt for your support.
The answer given wy Walter has worked for me.

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

카테고리

도움말 센터File Exchange에서 Debugging and Analysis에 대해 자세히 알아보기

제품

릴리스

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by