fmincon MATLAB: "No Feasible Solution Found!"

808 views Asked by At

I have the following code and I need to use "fmincon" to solve a model with linear constraints and a nonlinear objective function:

A = [Aeq ; Aineq];
x0 = zeros(size(A,2),1);
x0(1:T:(n+2)*T) = I0;
lb = zeros(size(A,2),1);
ub = Inf*zeros(size(A,2),1);
options = optimset('fmincon');

% fmincon:
[x , fval , exitflag , output , lambda] = fmincon(@MP_ObjF1 , x0 , Aineq , bineq , Aeq , beq , 0 , Inf , [] , options);

And this is the function:

function ObjF = MP_ObjF1(x)

global n;
global T;
global h;
global Total_Tcij; %A row vector of T arrays

ObjF = 0;
for t=1:T
    x_I_set = ((1:T:(n+2)*T)+(t-1))';
    x_I = x(x_I_set);
    HC = x_I*h; %"x_I" is a row vector, and "h" is a column vector.
    newObjF = (Total_Tcij(t) + HC)*x((n+2)*T+t);
    ObjF = (ObjF + newObjF);
end

end

The data required to run the model is as follows (which is the result of the codes being run up to the above part of the codes) :

n = 2;
T = 3;
h = [5 ; 5 ; 5 ; 5];
Total_Tcij = [10    10    10];

Aineq =

Columns 1 through 14

 0     0     0     0     0     0     0     0     0     0     0     0     1     0
 0     0     0     0     0     0     0     0     0     0     0     0     0     1
 0     0     0     0     0     0     0     0     0     0     0     0     0     0
 0     0     0     0     0     0     0     0     0     0     0     0     0     0
 0     0     0     0     0     0     0     0     0     0     0     0     0     0
 0     0     0     0     0     0     0     0     0     0     0     0     0     0
 0     0     0     0     0     0     0     0     0     0     0     0     1     0
 0     0     0     0     0     0     0     0     0     0     0     0     0     1
 0     0     0     0     0     0     0     0     0     0     0     0     0     0
 0     0     0     0     0     0     0     0     0     0     0     0     0     0
 0     0     0     0     0     0     0     0     0     0     0     0     0     0
 0     0     0     0     0     0     0     0     0     0     0     0     0     0
 1     0     0     0     0     0     0     0     0     0     0     0     0     0
 0     1     0     0     0     0     0     0     0     0     0     0     0     0
 0     0     1     0     0     0     0     0     0     0     0     0     0     0
 0     0     0     1     0     0     0     0     0     0     0     0     0     0
 0     0     0     0     1     0     0     0     0     0     0     0     0     0
 0     0     0     0     0     1     0     0     0     0     0     0     0     0
 0     0     0     0     0     0     1     0     0     0     0     0     0     0
 0     0     0     0     0     0     0     1     0     0     0     0     0     0
 0     0     0     0     0     0     0     0     1     0     0     0     0     0
 0     0     0     0     0     0     0     0     0     1     0     0     0     0
 0     0     0     0     0     0     0     0     0     0     1     0     0     0
 0     0     0     0     0     0     0     0     0     0     0     1     0     0

Column 15

 0
 0
 1
 0
 0
 0
 0
 0
 1
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0

Aeq =

Columns 1 through 14

-1     0     0     0     0     0     0     0     0     0     0     0     4     0
 1    -1     0     0     0     0     0     0     0     0     0     0     0     4
 0     1    -1     0     0     0     0     0     0     0     0     0     0     0
 0     0     1    -1     0     0     0     0     0     0     0     0     0     0
 0     0     0     1    -1     0     0     0     0     0     0     0     0     0
 0     0     0     0     1    -1     0     0     0     0     0     0     0     0
 0     0     0     0     0     0    -1     0     0     0     0     0    13     0
 0     0     0     0     0     0     1    -1     0     0     0     0     0    13
 0     0     0     0     0     0     0     1    -1     0     0     0     0     0
 0     0     0     0     0     0     0     0     0     1     0     0     4     0
 0     0     0     0     0     0     0     0     0    -1     1     0     0     4
 0     0     0     0     0     0     0     0     0     0    -1     1     0     0
 0     0     0     0     0     0     0     0     0     0     0     0     0     0
 0     0     0     0     0     0     0     0     0     0     0     0     0     0
 0     0     0     0     0     0     0     0     0     0     0     0     4     4
 0     0     0     0     0     0     0     0     0     0     0     0     0     0
 0     0     0     0     0     0     0     0     0     0     0     0     0     0
 0     0     0     0     0     0     0     0     0     0     0     0     0     0
 0     0     0     0     0     0     0     0     0     0     0     0     0     0
 0     0     0     0     0     0     0     0     0     0     0     0     0     0
 0     0     0     0     0     0     0     0     0     0     0     0     7     7
 0     0     0     0     0     0     0     0     0     0     0     0     1     0
 0     0     0     0     0     0     0     0     0     0     0     0     0     1
 0     0     0     0     0     0     0     0     0     0     0     0     0     0

Column 15

 0
 0
 4
 0
 0
 0
 0
 0
 7
 0
 0
 4
 0
 0
 4
 0
 0
 0
 0
 0
 7
 0
 0
 1

bineq =
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
50
50
50
50
50
50
50
50
50
50
50
50

beq =

-4
 3
 5
 3
 4
 6
 5
 3
 5
 0
-4
-3
 0
 0
 4
 3
 7
13
 0
 2
 7
 1
 1
 1

The result is the following warning:

Warning: Trust-region-reflective method does not currently solve this type of problem, using active-set (line search) instead. 
> In fmincon at 439

No feasible solution found.

fmincon stopped because the size of the current search direction is less than twice the default value of the step size tolerance but constraints were not satisfied to within the selected value of the constraint tolerance.

<stopping criteria details>

However, I'm quite sure the program has a feasible solution; should I set anything e.g. regarding the search direction or the constraint tolerance? I appreciate your help in advance.

0

There are 0 answers