I use following code to find proper X which minimize myFun
problem.x0 = zeros(3,20);
problem.ub = 10*ones(3,20);
problem.lb = -problem.ub;
problem.objective = @(x) myFun(x);
problem.solver = 'fmincon';
problem.options = optimoptions(@fmincon, 'Algorithm', 'sqp', 'MaxFunEvals', 1e6, 'MaxIter', 1e5);
xFinal = fmincon(problem);
The cost function, myFun, is not convex and the gradient is not specified as well, so, there no no garantee to yeild global minimum (no problem so far).
My probem is that number of iterations is different if I run this code in different computers, and I get different X as local minimum. Start value, constraints, ... all are same. MATLAB version is also same.
Any idea why I cannot get same results in different PCs?
Thanks.
--------
p.s.
Tried to add
at the beggining, but didn't solve the issue.
after iteration No. 0, I get different f(x) or Fval. Iiteration No. 0 is same for all runs.
F-count is not same after first iteration as well (for the runs in different computers).