title: step size tolerance violated using fmincon
body: <p>I'm trying to solve a non-linear constraint optimization problem using MatLab's fmincon function with SQP algorithm. This solver has been successfully applied on my problem, as I found out during my literature research.</p>
  
  <p>I know my problem's solution, but fmincon struggles to find it reliably. When running the optimization a 100 times with randomly generated start values within my boundaries, I got about 40 % good results. 'good' means that the results are that close to the optimum that I would accept it, although those 'good' results correspond with different ExitFlags. Most common are Exit Flags -2 and 2:</p>
  
  <pre><code>    ExitFlag = 2 
      Local minimum possible. Constraints satisfied. 
      fmincon stopped because the size of the current step is less than the selected value of the step size tolerance and constraints are  satisfied to within the selected value of the constraint tolerance. 
  
      ExitFlag = -2 
      No feasible solution found. 
      fmincon stopped because the size of the current step is less than the selected value of the step size tolerance but constraints are not satisfied to within the selected value of the constraint tolerance. 
  </code></pre>
  
  <p>The 'non-good' results deviate about 2% of the optimal solution and correspond to ExitFlags 2 and -2, as well.</p>
  
  <p>I played around with the tolerances, but without success. When relaxing the constraint tolerance the number of ExitFlag -2 decreases and some ExitFlag 1 cases occur, but consequently the deviation from the optimal solution rises.</p>
  
  <p>A big problem seems to be the step size which violates its tolerance. Often the solver exits after 2 or 3 iterations because of too small step size / norm of step size (relative change in X is below TolX).Is there a way to counteract these problems? I'd like to tune the solver In away to get appropriate results reliably.</p>
  
  <p>For your information, the options used:</p>
  
  <pre><code>    options=optimset('fmincon');
      options=optimset(options,...
                       'Algorithm','sqp',...
                       'ScaleProblem','obj-and-constr',...
                       'TypicalX',[3, 50, 3, 40, 50, 50],...
                       'TolX',1e-12,...%12
                       'TolFun',1e-8,...%6
                       'TolCon',1e-3,...%6
                       'MaxFunEvals',1000,...  %1000
                       'DiffMinChange',1e-10);
  </code></pre>