MATLAB: Fmincon stopped, Converged to an infeasible point.

fminconinfeasible point.optimization

Converged to an infeasible point.
fmincon stopped because the size of the current step is less than the default value of the step size tolerance but constraints are not satisfied to within the default value of the constraint tolerance.
if someone knows that this error is all about.. please guide me. Thank you.

Best Answer

Your constraints cannot be met.
Your cost function does not even use x(527) or x(528). The lower bounds and upper bounds for those are both 0, which forces the values to be 0. But maybe they are used in the constraints? Yes, they are used in row 43 of the constraints, as are a number of other variables. beq(43) = 0, so the sum of a number of values must be 0. Can any of the values be negative?
lb(find(Aeq(43,:)))
shows all zeros, and the only way for a sum of non-negative values to be zero is if they are all zero, so all of those variables must be zero.
But let's check... are there other variables whose lower and upper bounds are the same? Yes, it turns out there are. So we proceed to
Nx = length(x0);
X = sym('x', [1, Nx], 'real');
ident = lb == ub;
X(ident) = lb(ident);
eqcon = Aeq*X.' - beq;
Each entry in eqcon must be 0 for the constraints to be met, by definition of equality constraints. So examine it. It starts out plausible,
x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 + x10 + x11 + x12 + x13 + x14 + x15 + x16 + x17 + x18 + x19 + x20 + x21 + x22 + x23 + x24 - 33/25
x42 + x43 + x44 + x45 + x46 + x47 + x48 - 13/10
but then the third entry has
149/50
which cannot possibly be equal to zero. There are other rows that cannot be satisfied, such as 13/5 or 36/25 -- twelve in total.
What does the third constraint say?
mask = find(Aeq(3,:))
Aeq(3,mask)
beq(3)
lb(mask)
ub(mask)
mask =
60 61 62
ans =
1 1 1
ans =
1.49
ans =
1.49 1.49 1.49
ans =
1.49 1.49 1.49
This tells us that 1*x(60) + 1*x(61) + 1*x(62) == 1.49 and that x(60), x(61) and x(62) all have lower bounds of 1.49 and upperbounds of 1.49 and so all three values must be exactly 1.49 . But row 3 of Aeq with entry 3 of beq tells that the sum of the three must be 1.49. With the values having to be exactly 1.49 each, their sum must be 3*1.49 and that can never equal merely 1.49.
If you have R2017b or later, I recommend that you rewrite everything in terms of the new Problem Based optimization system, see https://www.mathworks.com/help/optim/ug/optim.problemdef.optimizationproblem.optimproblem.html and https://www.mathworks.com/help/optim/ug/optimization-expressions.html