Question about propt optimization code

2 views (last 30 days)
Jaime De La Mota Sanchis
Jaime De La Mota Sanchis on 23 Oct 2019
Hello everyone. I have found the following example in which a version of Zermelo's optimization problem is solved. There is however a part of the code that I don't understand:
The first two lines of the document are:
% Array with consecutive number of collocation points
narr = [20 40];
and later on, the author writes
% Initial guess
if n==narr(1)
x0 = {tf == 2; icollocate({x1 == xi(1); x2 == xi(2)})
collocate({u1 == pi})};
else
x0 = {tf == tfopt; icollocate({x1 == xopt1; x2 == xopt2})
collocate({u1 == uopt1})};
end
and
tfopt = subs(tf,solution);
xopt1 = subs(x1,solution);
xopt2 = subs(x2,solution);
uopt1 = subs(u1,solution);
If I understand propperly, the code first constructs an optimal solution based on a very simple guess and then, uses the found optimal solution as an initial guess for a second optimal solution?
If someone can confirm that I have undestoood this correctly, I would be very thankful.
Regards.
Jaime.

Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by