
mat file that calculated the constraint, METHOD 4 ran for 5 hours. Performance wise it is similar to METHOD 3 (for the trivial example), I am currently running this code for my problem and it may never finish, it took about 10 minutes to for METHOD 3 to make a.

Very similar to METHOD 3, except you are building and OPTIMIZING an actual function that you can look at.

MatlabFunction(J_fun,'file',filename,'vars',) This seems to be a new site, because I did not notice it when I was researching this problem: On this toy problem, METHOD 3 is much faster than the other two, but I would love it if I could speed this up some more. It is MUUUCCH faster!įor this problem it is fast, but for my problem it is much slower (I have a much larger problem). METHOD 3:Elapsed time is 0.000372 seconds.ĬOMMENT/UPDATE #1: This is probably obvious, but using any of the methods above make sure that you pass the Jacobian to the function instead of loading it. METHOD 2:Elapsed time is 0.017192 seconds. METHOD 1:Elapsed time is 0.038066 seconds. THE FOLLOWING IS THE BOTTLENECK, calculated inside optimization, J is loaded each time, x is the set of design variables, X are the symbolic expressions for the the variables.ĭuring optimization something like this is called: x = This part of the code is calculated once and the result J, is saved and then loaded in the next part % symbolic variables I need an analytical Jacobian so that it is accurate (and I was thinking it would be fast, but that is not the case with my current implementation). I calculated the Jacobian analytically from my constraints using MATLAB's symbolic toolbox. I have formulated a optimization problem that requires a very fast evaluation of the Jacobian matrix.
