Clear Filters
Clear Filters

Vectorized gradient based optimizers

2 views (last 30 days)
Is there any vectorized gradient based optimizer available ? Even outside matlab ?

Accepted Answer

Matt J
Matt J on 31 Dec 2019
Edited: Matt J on 31 Dec 2019
As long as you are willing to supply the gradient, you can vectorize the minimization of N objectives,
by applying fminunc to the consolidated objective,
or analogously with fmincon if each problem has constraints.
  22 Comments
mahmoud tarek
mahmoud tarek on 15 Jan 2020
yes, i can and i am trying now to provide the gradients (if possible) of my simulations function.
Do you have any documents or ideas on how to do that ?
Matt J
Matt J on 15 Jan 2020
The chain rule,
If an analytical calculation is too difficult, you can also try your own vectorized finite difference method to find the Jacobian of your simulation function. From that, it should be easier to find the total derivative of your objective using the chain rule.
delta = small_number;
Y0=simulation(X); %
Jacobian=nan(size(X)); %to hold the result
for i=1:11
Xp=X;
Xp(:,i)=Xp(:,i)+delta;
Yp=simulation(Xp);
Jacobian(:,i)=(Yp(:,i)-Y0(:,i))/delta;
end

Sign in to comment.

More Answers (0)

Categories

Find more on Get Started with Optimization Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!