Matlab alternatives for gradient optimisation problems?
Afficher commentaires plus anciens
At school, I have been using maltab to solve various optimisation problems manually, without the optimisation toolbox as this is what they want us to do. I have an assignment in which I have to document solving these kinds of problems with an open-source software of my choice. I have done some research, but so far did not find any alternatives which would fit the problem. Could you suggest open-source / free software that handles data something like matlab does? Or anything that could be used for this kind of problem?
For example, this is how my implementation looks for the Newton-Raphson method:
d0 = 1
i = 0
x0 = [-1, 0]';
[f0, g0] = fun4(x0)
syms x1 x2
f = (x1-1)^2+(x2-x1^2)^2;
Hs = hessian(f)
H0 = eval(subs(Hs, [x1, x2],[x0(1), x0(2)]))
tab = [i, x0', g0, d0];
while d0 >= 0.01
x0 = x0 - H0^-1*g0'
[f0, g0] = fun4(x0)
d0 = g0*g0'
H0 = eval(subs(Hs, [x1, x2],[x0(1), x0(2)]))
i = i + 1
tab = [tab; i, x0', g0, d0];
end
I would need the same or similar functionality as used in the code, so mainly similar functions as eval(), hessian()/jacobian() and syms. fun4 includes the function defined in the variable f, its in a separate script so that it can be used repeadetly.
Thanks!
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Symbolic Math Toolbox dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!