vastly different optimization results from different matlab versions (r2023b,2021b,2020b)
[I just came across the problem and want to put down what I have for now. Will come back to improve the question once I narrow it down. THX]
I was solving a high-dimensional nonlinear optimization problem with self written gradient descent method. Running the exact same code (literally the same file, with no workspace or command window inputs), version 2023b gave me very different results from 2021b. I then compared with 2020b, which produced the same result as 2021b. Comparing the outputs, I found that 2023b calculated the gradient differently.
2020b and 2021b gave the following and converged after 18 iterations.
direction = [4.33783e-06 2.33596e-06 -5.33992e-06 -8.36479e-06 -9.19797e-05 1 ]
2023b gave the following and didn’t converge after 44 iterations.
direction = [4.17191e-06 2.24661e-06 -5.13617e-06 -7.53861e-06 -5.19154e-05 1 ]
The code is very slow, so I can’t let it run forever and find out when it will converge.
As far as I know, my code doesn’t involve any randomness. It does use a lot of matrices and high-order polynomials, as well as conditions.
I went through the release notes from r2021b onwards, and noticed a change to the round function, which I don’t use explicitly but can affect the conditions I suppose?round function change
There’re also some performance improvements on matrix calculations.[I just came across the problem and want to put down what I have for now. Will come back to improve the question once I narrow it down. THX]
I was solving a high-dimensional nonlinear optimization problem with self written gradient descent method. Running the exact same code (literally the same file, with no workspace or command window inputs), version 2023b gave me very different results from 2021b. I then compared with 2020b, which produced the same result as 2021b. Comparing the outputs, I found that 2023b calculated the gradient differently.
2020b and 2021b gave the following and converged after 18 iterations.
direction = [4.33783e-06 2.33596e-06 -5.33992e-06 -8.36479e-06 -9.19797e-05 1 ]
2023b gave the following and didn’t converge after 44 iterations.
direction = [4.17191e-06 2.24661e-06 -5.13617e-06 -7.53861e-06 -5.19154e-05 1 ]
The code is very slow, so I can’t let it run forever and find out when it will converge.
As far as I know, my code doesn’t involve any randomness. It does use a lot of matrices and high-order polynomials, as well as conditions.
I went through the release notes from r2021b onwards, and noticed a change to the round function, which I don’t use explicitly but can affect the conditions I suppose?round function change
There’re also some performance improvements on matrix calculations. [I just came across the problem and want to put down what I have for now. Will come back to improve the question once I narrow it down. THX]
I was solving a high-dimensional nonlinear optimization problem with self written gradient descent method. Running the exact same code (literally the same file, with no workspace or command window inputs), version 2023b gave me very different results from 2021b. I then compared with 2020b, which produced the same result as 2021b. Comparing the outputs, I found that 2023b calculated the gradient differently.
2020b and 2021b gave the following and converged after 18 iterations.
direction = [4.33783e-06 2.33596e-06 -5.33992e-06 -8.36479e-06 -9.19797e-05 1 ]
2023b gave the following and didn’t converge after 44 iterations.
direction = [4.17191e-06 2.24661e-06 -5.13617e-06 -7.53861e-06 -5.19154e-05 1 ]
The code is very slow, so I can’t let it run forever and find out when it will converge.
As far as I know, my code doesn’t involve any randomness. It does use a lot of matrices and high-order polynomials, as well as conditions.
I went through the release notes from r2021b onwards, and noticed a change to the round function, which I don’t use explicitly but can affect the conditions I suppose?round function change
There’re also some performance improvements on matrix calculations. version changes, different results MATLAB Answers — New Questions