This is a moderately simple problem with 5 unknowns. Another solver may be safer, because of the absolute values, but they are in the constraints, and fmincon can probably at least take a shot at it. So I'll put it into fmincon and then patternsearch to see if they come up with consistent solutions.
The 5 unknowns are w1,w2,w3,w4,X. Put them all into a vector of unknowns called U.
LB = [small small small small -inf];
U0 = [.25 .25 .25 .25 1];
I've defined the variable "small" as a value close to zero, but sufficiently far enough away that we will not have a divide by zero.
First, does the nonlinear constraint function evaluate as desired? Is this an initial feasible point?
[C,CEQ] = NLcons(U0)
C =
-0.9200 -0.7500 -0.5500 -0.6500 -0.1900
Clearly, the initial point is feasible. The requirement is that C must be <= 0. In fact, your constraints make it clear that ANY set of values w1=w2=w3=w4 will be a feasible solution, as long as X is on the order of 1 or more. So as long as I choose w1=w2=w3=w4=0.25, it also trivially satisfies the equality constraint. These thigns are good, since it is valuable to start a solver off so the constraints are satisfied. Then it does not need to hunt for an initial feasible point to then work from.
[X,FVAL,EXITFLAG] = fmincon(@(U) U(5),U0,A,b,Aeq,beq,LB,UB,@NLcons)
Local minimum possible. Constraints satisfied.
fmincon stopped because the size of the current step is less than
the value of the step size tolerance and constraints are
satisfied to within the value of the constraint tolerance.
X =
0.3147 0.2913 0.2331 0.1609 0.0045
I tend to dislike absolute values in optimizations, as they cause singularities in the derivitives. But did that cause a problem for fmincon? See if patternsearch finds a similar solution.
[X,FVAL,EXITFLAG] = patternsearch(@(U) U(5),U0,A,b,Aeq,beq,LB,UB,@NLcons )
Optimization terminated: mesh size less than options.MeshTolerance
and constraint violation is less than options.ConstraintTolerance.
X =
0.3164 0.2852 0.2383 0.1602 0.0533
So the two solvers have found fairly similar solutions. fmincon seems to have survived the absolute values in the constraints. I might have pushed patternsearch a little harder and it probably would have come to the same solution as fmincon.
function [C,CEQ] = NLcons(U)
C(1) = abs(w(1)/w(2) - 1.08) - X;
C(2) = abs(w(2)/w(3) - 1.25) - X;
C(3) = abs(w(3)/w(4) - 1.45) - X;
C(4) = abs(w(1)/w(3) - 1.35) - X;
C(5) = abs(w(2)/w(4) - 1.81) - X;