0
votes

I need to solve a system of 44 equations with 44 unknowns (x) of the following form

(-1/(1 - x(t))) + (phi(t) * (1/T) * Σ_{h=45}^{60} β^{h-t})) = 0

where phi_t takes value 0 for t <= 25 and value 1 everywhere else, and where T = phi(1) x(1) + phi(2) x(2) + ... + phi(44)x(44).

I have two types of constraints. First, all x must be between 0.1 and 0.5, and T must be below 0.9.

EDIT: The following links are pictures with the full problem and the associated system of equations that represent the solution, Stack Overflow won't let me post pictures. Maximization problem and system of equations. The constraint basically means that x(t) \in [0.1, 0.5] for all t and phi(25)x(25) + phi(26)x(26) ... + phi(43)x(43) + phi(44)x(44) <= 0.9

I use Matlab's fmincon and the solution it returns fulfils the constraint place on the τ, but returns a result for T that is well above the value of 0.9 that it is intended to have as a maximum.

I use the following Main file:

clear all
clc

% Solve restricted problem

global beta phi w C R D
C = 25;
R = 40;
D = 55;
beta = 0.99;
phi = [0,1];
w = ones(1,R-1);

phiB = phi(1)*ones(1,R-1);
for i=C:R-1
    phiB(i) = phi(2);
end

lb = 0.1*ones(1,R-1); % Lower bound constraint
ub = 0.5*ones(1,R-1); % Lower bound constraint
rng default % reproducible initial point
x0 = 0.01*ones(R-1,1);
opts = optimoptions(@fmincon,'Algorithm','interior-point','Display','off');
sol = fmincon(@(x)0,x0,phiB,0.9,[],[],lb,ub,@fminconstr,opts)

Where the fmincon function represents the maximization of a constant and hence the only thing that has to be satisfied are the equality and inequality constraints. It calls the function fminconstr, of the form

function [c,ceq] = fminconstr(x)

    c = []; % nonlinear inequality
    ceq = fbnd(x); % the fsolve objective is fmincon constraints

end

where the constraint is the system of equations, defined by the function fbnd

function F = fbnd(x)

    global R C D
    global beta
    global phi
    global w

    phiB = phi(1)*ones(1,R-1);
    for i=C:R-1
         phiB(i) = phi(2);
     end

    T =  phiB * x;

    F = NaN(1,R-1);
    for i=1:C
        betaM = beta*ones(1,D-R);
        for j = 1:D-R
            betaM(j) = beta^(R+j-i-1);
        end
        F(i) = ((-1/(w(i)-x(i))) + phi(1)*(1/T)*sum(betaM));            
    end
    for i=C-1:R-1
        betaM = beta*ones(1,D-R);
        for j = 1:D-R
            betaM(j) = beta^(R+j-i-1);
        end
        F(i) = ((-1/(w(i)-x(i))) + sum(phi(2)*betaM'*(1/T)));        
    end

end

The program returns values for x between 0.1 and 0.5, so these constraints do work. But when computing T as described in the problem (in fmincon notation I'd understand this constraint is Ax <= b), I obtain values for T of around 4.6, well above the value of 0.9 defined by the constraint.

I also tried defining this constraint as c(x) <= 0, modifying the code as

 sol = fmincon(@(x)0,x0,[],[],[],[],lb,ub,@fminconstr2,opts)

where fminconstr2 is now

function [c,ceq] = fminconstr2(x)

    global phi
    global R 
    global C

    c = fbnd2(x); % nonlinear inequality
    ceq = fbnd(x); % the fsolve objective is fmincon constraints

end

and fbnd2 is

function T = fbnd2(x)

    global R C
    global phi

    phiB = phi(1)*ones(1,R-1);
    for i=C:R-1
        phiB(i) = phi(2);
    end

    T =  phiB * x - 0.9;

end

and obtain the same result with a T of around 4.6.

I want to solve the same system of equations, but I would need to obtain a value of T that is within the constraint that I specify.

1
show us a clear mathematical formulation of the equality constraint, not the code only - Adam
EDIT: The following links are pictures with the full problem and the associated system of equations that represent the solution, Stack Overflow won't let me post pictures. Maximization problem and system of equations. The constraint basically means that x(t) \in [0.1, 0.5] for all t and phi(25)x(25) + phi(26)x(26) ... + phi(43)x(43) + phi(44)x(44) <= 0.9 - Elena T. Aguilar

1 Answers

0
votes

enter image description here

Your Equality Constraint is logically false. If you set ceq = [] you'll get solution that satisfy only the lb, ub and T<=0.9 Constraints