FMINCON showing x0 not between lb and ub, though my x0 is strictly between limits.

13 views (last 30 days)
I am using FMINCON with Interior Point algorithm.
My initial guess x0=[-5.5, -0.5, -0.5].
Lower bound: lb=[-6, -1, -1]
Upper bound: ub=[-4, 1, 1]
While running the code, I am getting the message "Your initial point x0 is not between bounds lb and ub; FMINCON shifted x0 to strictly satisfy the bounds".
Can someone please explain why?
  2 Comments
Debapriya Sengupta
Debapriya Sengupta on 5 Jan 2022
x0=[-5.5,-0.5,-0.5];
opt=optimoptions('fmincon','Display','iter');
gs=GlobalSearch;
problem=createOptimProblem('fmincon','x0',x0,'objective',@Reg_3D_OF_Func,'lb',[-6,-1,-1],'ub',[-4,1,1],'options',opt);
[x,fval,exitflag,output]=run(gs,problem);
Reg_3D_OF_Func is an user defined function.

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 5 Jan 2022
It has something to do with the fact you are using GlobalSearch: some of the runs might be generating initial values out of bounds while others might generate in-bounds x0.
x0=[-5.5,-0.5,-0.5];
opt=optimoptions('fmincon','Display','iter');
gs=GlobalSearch;
problem=createOptimProblem('fmincon','x0',x0,'objective',@Reg_3D_OF_Func,'lb',[-6,-1,-1],'ub',[-4,1,1],'options',opt);
[x,fval,exitflag,output]=run(gs,problem)
First-order Norm of Iter F-count f(x) Feasibility optimality step 0 4 2.344400e+00 0.000e+00 2.388e+00 1 8 7.338240e-02 0.000e+00 5.972e-01 1.786e+00 2 12 1.891233e-02 0.000e+00 9.811e-02 3.629e-01 3 16 1.723423e-03 0.000e+00 1.019e-01 1.307e-01 4 20 4.826181e-05 0.000e+00 1.861e-02 4.727e-02 5 24 5.945924e-06 0.000e+00 1.411e-03 7.126e-03 6 28 7.053477e-06 0.000e+00 1.056e-03 1.646e-03 7 32 5.933509e-06 0.000e+00 9.970e-04 7.821e-04 8 36 2.540379e-07 0.000e+00 2.068e-04 1.932e-03 9 40 3.664163e-11 0.000e+00 2.461e-06 4.980e-04 10 44 4.245787e-15 0.000e+00 2.007e-08 5.998e-06 Local minimum found that satisfies the constraints. Optimization completed because the objective function is non-decreasing in feasible directions, to within the value of the optimality tolerance, and constraints are satisfied to within the value of the constraint tolerance. First-order Norm of Iter F-count f(x) Feasibility optimality step 0 4 9.659986e-02 0.000e+00 4.182e-01 1 8 1.373969e-01 0.000e+00 4.445e-01 5.725e-01 2 12 1.675187e-02 0.000e+00 1.052e-01 2.537e-01 3 16 1.883819e-03 0.000e+00 5.712e-02 1.062e-01 4 20 1.664789e-04 0.000e+00 2.225e-02 5.203e-02 5 24 5.425752e-06 0.000e+00 9.961e-04 1.257e-02 6 28 5.672983e-07 0.000e+00 9.679e-04 2.218e-03 7 32 1.803324e-07 0.000e+00 4.072e-04 8.821e-04 8 36 2.577797e-07 0.000e+00 2.000e-04 2.684e-04 9 40 5.690331e-09 0.000e+00 5.334e-05 4.345e-04 10 44 9.687839e-09 0.000e+00 4.000e-05 3.019e-05 11 48 8.163145e-13 0.000e+00 1.504e-06 9.793e-05 12 52 9.816544e-13 0.000e+00 4.000e-07 9.274e-07 Feasible point with lower objective function value found. Local minimum found that satisfies the constraints. Optimization completed because the objective function is non-decreasing in feasible directions, to within the value of the optimality tolerance, and constraints are satisfied to within the value of the constraint tolerance. First-order Norm of Iter F-count f(x) Feasibility optimality step 0 4 1.923754e-01 0.000e+00 5.760e-01 1 8 3.124102e-02 0.000e+00 3.611e-01 5.540e-01 2 12 1.376073e-01 0.000e+00 4.439e-01 4.675e-01 3 16 2.552247e-02 0.000e+00 1.070e-01 2.382e-01 4 20 3.334620e-03 0.000e+00 1.013e-01 1.334e-01 5 24 1.621608e-03 0.000e+00 2.093e-02 4.580e-02 6 28 2.315814e-05 0.000e+00 3.357e-03 3.594e-02 7 32 3.626316e-07 0.000e+00 2.483e-04 4.225e-03 8 36 4.298216e-11 0.000e+00 2.681e-06 5.956e-04 9 40 3.301282e-15 0.000e+00 3.891e-08 6.500e-06 Local minimum found that satisfies the constraints. Optimization completed because the objective function is non-decreasing in feasible directions, to within the value of the optimality tolerance, and constraints are satisfied to within the value of the constraint tolerance. First-order Norm of Iter F-count f(x) Feasibility optimality step 0 4 2.248363e-01 0.000e+00 8.371e-01 1 8 9.776205e-02 0.000e+00 4.498e-01 6.073e-01 2 12 1.634787e-02 0.000e+00 2.020e-01 2.769e-01 3 16 2.197283e-02 0.000e+00 1.001e-01 1.125e-01 4 20 2.536506e-03 0.000e+00 9.986e-02 1.215e-01 5 24 1.608425e-03 0.000e+00 2.065e-02 3.801e-02 6 28 2.049303e-05 0.000e+00 4.480e-03 3.626e-02 7 32 3.651080e-07 0.000e+00 2.420e-04 4.042e-03 8 36 2.369817e-07 0.000e+00 2.000e-04 1.831e-04 9 40 9.597326e-09 0.000e+00 4.028e-05 3.889e-04 10 44 1.067244e-12 0.000e+00 4.174e-07 9.693e-05 Local minimum found that satisfies the constraints. Optimization completed because the objective function is non-decreasing in feasible directions, to within the value of the optimality tolerance, and constraints are satisfied to within the value of the constraint tolerance. First-order Norm of Iter F-count f(x) Feasibility optimality step 0 4 2.195452e-01 0.000e+00 8.921e-01 1 8 3.881739e-02 0.000e+00 3.965e-01 5.323e-01 2 12 2.166919e-02 0.000e+00 1.997e-01 2.560e-01 3 16 2.968060e-02 0.000e+00 1.018e-01 1.131e-01 4 20 2.854896e-03 0.000e+00 6.308e-02 1.207e-01 5 24 1.741922e-03 0.000e+00 2.028e-02 1.909e-02 6 28 2.393553e-05 0.000e+00 4.120e-03 3.692e-02 7 32 3.704782e-07 0.000e+00 2.511e-04 4.288e-03 8 36 4.331027e-11 0.000e+00 2.692e-06 6.022e-04 9 40 4.271830e-15 0.000e+00 2.290e-08 6.528e-06 Local minimum found that satisfies the constraints. Optimization completed because the objective function is non-decreasing in feasible directions, to within the value of the optimality tolerance, and constraints are satisfied to within the value of the constraint tolerance. First-order Norm of Iter F-count f(x) Feasibility optimality step 0 4 3.903371e-01 0.000e+00 1.078e+00 1 8 5.483460e-02 0.000e+00 3.487e-01 4.704e-01 2 12 7.626129e-02 0.000e+00 2.851e-01 4.456e-01 3 16 2.313944e-02 0.000e+00 1.091e-01 1.864e-01 4 20 6.339247e-04 0.000e+00 1.160e-01 1.280e-01 5 24 1.571817e-03 0.000e+00 2.002e-02 1.838e-02 6 28 2.770342e-05 0.000e+00 2.391e-03 3.481e-02 7 32 3.482794e-07 0.000e+00 2.568e-04 4.749e-03 8 36 2.392309e-07 0.000e+00 2.000e-04 1.556e-04 9 40 8.592744e-09 0.000e+00 4.029e-05 3.980e-04 10 44 2.570428e-12 0.000e+00 2.226e-06 9.195e-05 11 48 9.670676e-13 0.000e+00 4.000e-07 1.411e-06 Local minimum found that satisfies the constraints. Optimization completed because the objective function is non-decreasing in feasible directions, to within the value of the optimality tolerance, and constraints are satisfied to within the value of the constraint tolerance. First-order Norm of Iter F-count f(x) Feasibility optimality step 0 4 3.450835e-01 0.000e+00 1.079e+00 1 8 4.913316e-02 0.000e+00 4.267e-01 3.732e-01 2 12 4.413770e-02 0.000e+00 2.294e-01 3.715e-01 3 16 3.405702e-02 0.000e+00 1.189e-01 1.674e-01 4 20 2.015277e-02 0.000e+00 1.001e-01 6.395e-02 5 24 2.548019e-03 0.000e+00 5.578e-02 9.849e-02 6 28 1.755198e-03 0.000e+00 2.053e-02 2.039e-02 7 32 3.730993e-05 0.000e+00 2.688e-03 3.600e-02 8 36 4.033678e-07 0.000e+00 2.622e-04 5.479e-03 9 40 1.351920e-10 0.000e+00 1.808e-05 6.297e-04 10 44 2.522677e-11 0.000e+00 2.285e-06 1.133e-05 11 48 2.429539e-11 0.000e+00 2.000e-06 1.246e-06 12 52 9.799547e-13 0.000e+00 4.000e-07 3.940e-06 Local minimum found that satisfies the constraints. Optimization completed because the objective function is non-decreasing in feasible directions, to within the value of the optimality tolerance, and constraints are satisfied to within the value of the constraint tolerance. First-order Norm of Iter F-count f(x) Feasibility optimality step 0 4 3.414518e-01 0.000e+00 1.094e+00 1 8 1.571625e-01 0.000e+00 4.879e-01 5.064e-01 2 13 1.919028e-02 0.000e+00 9.678e-02 3.292e-01 3 17 1.740166e-03 0.000e+00 2.157e-02 9.812e-02 4 21 7.027629e-05 0.000e+00 7.857e-03 3.443e-02 5 25 1.486300e-05 0.000e+00 6.852e-03 8.832e-03 6 29 4.590223e-06 0.000e+00 1.000e-03 3.919e-03 7 33 9.110524e-08 0.000e+00 4.304e-04 1.845e-03 8 37 2.417750e-07 0.000e+00 2.000e-04 2.068e-04 9 41 3.721944e-11 0.000e+00 5.716e-06 4.867e-04 10 45 2.429729e-11 0.000e+00 2.000e-06 3.516e-06 11 49 4.266043e-15 0.000e+00 2.004e-08 4.875e-06 Local minimum found that satisfies the constraints. Optimization completed because the objective function is non-decreasing in feasible directions, to within the value of the optimality tolerance, and constraints are satisfied to within the value of the constraint tolerance. First-order Norm of Iter F-count f(x) Feasibility optimality step 0 4 3.371769e-01 0.000e+00 1.131e+00 1 8 1.417682e-01 0.000e+00 5.145e-01 3.859e-01 2 12 7.935906e-02 0.000e+00 4.096e-01 6.270e-01 3 16 2.145820e-02 0.000e+00 1.195e-01 2.836e-01 4 20 2.811002e-03 0.000e+00 3.154e-02 9.566e-02 5 24 1.798861e-03 0.000e+00 2.030e-02 1.242e-02 6 28 6.810898e-05 0.000e+00 2.034e-02 4.149e-02 7 32 1.693050e-05 0.000e+00 7.976e-03 1.235e-02 8 36 2.407902e-07 0.000e+00 2.000e-04 4.190e-03 9 40 9.810262e-09 0.000e+00 4.028e-05 3.917e-04 10 44 1.068018e-12 0.000e+00 4.176e-07 9.801e-05 Local minimum found that satisfies the constraints. Optimization completed because the objective function is non-decreasing in feasible directions, to within the value of the optimality tolerance, and constraints are satisfied to within the value of the constraint tolerance. First-order Norm of Iter F-count f(x) Feasibility optimality step 0 4 3.318605e-01 0.000e+00 1.131e+00 1 8 1.929770e-01 0.000e+00 5.145e-01 4.638e-01 2 13 2.105123e-02 0.000e+00 1.053e-01 3.858e-01 3 17 1.788712e-03 0.000e+00 2.104e-02 1.047e-01 4 21 6.576564e-05 0.000e+00 9.479e-03 3.555e-02 5 25 1.780964e-05 0.000e+00 7.656e-03 9.251e-03 6 29 4.870876e-06 0.000e+00 1.000e-03 4.078e-03 7 33 9.647318e-08 0.000e+00 3.964e-04 1.899e-03 8 37 2.414362e-07 0.000e+00 2.000e-04 1.906e-04 9 41 3.464390e-11 0.000e+00 2.432e-06 4.857e-04 10 45 3.853556e-15 0.000e+00 2.216e-08 5.833e-06 Local minimum found that satisfies the constraints. Optimization completed because the objective function is non-decreasing in feasible directions, to within the value of the optimality tolerance, and constraints are satisfied to within the value of the constraint tolerance. First-order Norm of Iter F-count f(x) Feasibility optimality step 0 4 3.305586e-01 0.000e+00 1.131e+00 1 8 1.114903e-01 0.000e+00 5.145e-01 3.607e-01 2 12 6.405262e-02 0.000e+00 3.427e-01 5.568e-01 3 16 2.461008e-02 0.000e+00 1.162e-01 2.339e-01 4 20 1.902676e-03 0.000e+00 6.747e-02 1.150e-01 5 24 1.740198e-03 0.000e+00 2.014e-02 1.012e-02 6 28 3.214181e-05 0.000e+00 6.520e-03 3.696e-02 7 32 9.852330e-07 0.000e+00 1.572e-03 5.678e-03 8 36 1.925062e-07 0.000e+00 2.001e-04 9.362e-04 9 40 7.551514e-09 0.000e+00 4.022e-05 3.544e-04 10 44 1.044779e-12 0.000e+00 4.152e-07 8.588e-05 Local minimum found that satisfies the constraints. Optimization completed because the objective function is non-decreasing in feasible directions, to within the value of the optimality tolerance, and constraints are satisfied to within the value of the constraint tolerance. First-order Norm of Iter F-count f(x) Feasibility optimality step 0 4 3.281169e-01 0.000e+00 1.131e+00 1 8 1.335371e-01 0.000e+00 5.145e-01 3.879e-01 2 12 1.142470e-01 0.000e+00 4.635e-01 6.760e-01 3 16 2.382899e-02 0.000e+00 1.203e-01 3.172e-01 4 20 2.139229e-03 0.000e+00 7.781e-02 1.108e-01 5 24 1.681621e-03 0.000e+00 2.016e-02 2.013e-02 6 28 3.397309e-05 0.000e+00 2.680e-03 3.532e-02 7 32 3.980299e-07 0.000e+00 2.605e-04 5.210e-03 8 36 4.547410e-11 0.000e+00 2.754e-06 6.242e-04 9 40 4.328082e-15 0.000e+00 2.009e-08 6.689e-06 Local minimum found that satisfies the constraints. Optimization completed because the objective function is non-decreasing in feasible directions, to within the value of the optimality tolerance, and constraints are satisfied to within the value of the constraint tolerance. First-order Norm of Iter F-count f(x) Feasibility optimality step 0 4 3.278485e-01 0.000e+00 1.131e+00 1 8 1.242883e-01 0.000e+00 5.145e-01 3.629e-01 2 12 8.976789e-02 0.000e+00 4.435e-01 6.287e-01 3 16 2.481430e-02 0.000e+00 1.180e-01 2.843e-01 4 20 1.999250e-03 0.000e+00 7.820e-02 1.150e-01 5 24 1.695534e-03 0.000e+00 2.016e-02 1.746e-02 6 28 3.419336e-05 0.000e+00 2.679e-03 3.550e-02 7 32 3.971558e-07 0.000e+00 2.605e-04 5.232e-03 8 36 4.704326e-11 0.000e+00 3.784e-06 6.237e-04 9 40 2.428228e-11 0.000e+00 2.000e-06 2.667e-06 10 44 9.310731e-16 0.000e+00 5.788e-08 4.899e-06 Local minimum found that satisfies the constraints. Optimization completed because the objective function is non-decreasing in feasible directions, to within the value of the optimality tolerance, and constraints are satisfied to within the value of the constraint tolerance. Your initial point x0 is not between bounds lb and ub; FMINCON shifted x0 to strictly satisfy the bounds. First-order Norm of Iter F-count f(x) Feasibility optimality step 0 4 6.742875e-01 0.000e+00 8.324e-01 1 8 3.544975e-02 0.000e+00 6.734e-01 9.545e-01 2 12 1.125477e-02 0.000e+00 9.724e-02 2.542e-01 3 16 6.950022e-04 0.000e+00 9.089e-02 1.097e-01 4 20 4.282315e-05 0.000e+00 1.602e-02 3.286e-02 5 24 9.212134e-06 0.000e+00 1.389e-03 7.960e-03 6 28 5.130918e-06 0.000e+00 1.000e-03 1.367e-03 7 32 2.294501e-07 0.000e+00 2.059e-04 1.805e-03 8 36 3.515817e-11 0.000e+00 2.439e-06 4.731e-04 9 40 4.364979e-15 0.000e+00 2.007e-08 5.876e-06 Local minimum found that satisfies the constraints. Optimization completed because the objective function is non-decreasing in feasible directions, to within the value of the optimality tolerance, and constraints are satisfied to within the value of the constraint tolerance. GlobalSearch stopped because it analyzed all the trial points. All 14 local solver runs converged with a positive local solver exit flag.
x = 1×3
-4.7000 0.8000 -0.6200
fval = 4.2458e-15
exitflag = 1
output = struct with fields:
funcCount: 2631 localSolverTotal: 14 localSolverSuccess: 14 localSolverIncomplete: 0 localSolverNoSolution: 0 message: 'GlobalSearch stopped because it analyzed all the trial points.↵↵All 14 local solver runs converged with a positive local solver exit flag.'
function y = Reg_3D_OF_Func(x)
y = sum((x - [-4.7 .8 -.62]).^2);
end
  5 Comments

Sign in to comment.

More Answers (1)

Matt J
Matt J on 5 Jan 2022
Edited: Matt J on 5 Jan 2022
That might happen if you have additional, tighter box bounds encoded into your linear inequality constraint matrices A,b..For example, if one of the rows of your A,b data were
A(i,:)=[0,0,-1]; b(i)=0; %equivalent to x(3)>=0
then fmincon preprocessing would delete this row and convert lb(3) to zero. Once the input data has been simplified in this way, x0(3) would then violate the bounds.
  1 Comment
Debapriya Sengupta
Debapriya Sengupta on 5 Jan 2022
Mine is an unconstrained optimization problem. I do not have inequality constraints defined in my code.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!