# Disciplined convex programming error

Hi everybody, i have this kind of problem; maybe does it mean that it isn’t feasible?

p_max = [1000; 20; 30; 0; 0];
p_min = [0 ; 0; 0; 0; 0];
r_max = [0; 0; 0; 0; 0.5];
r_min = [0; 0; 0; 0; -0.5];
s_max = [0; 0; 0; 0; 10];
s_min = [0; 0; 0; 0; 0];

a = diag(0.3*ones(N,1));
b = 0.5*ones(N,1);

s_0 = 4; % supponiamo che la batteria sia carica al 20% del suo max
r_0 = 0

for i = 1: N_Simulazione

cvx_begin
variables p(N,K) f(M,K) r(N,K) s(N,K)
f_obiettivo=0;
for k = 1: K
f_obiettivo = f_obiettivo + p(:,k)'*a*p(:,k) + b'*p(:,k);
end
minimize f_obiettivo;
subject to
for k = 1 : K
p(:,k) == d(:,k) - A_grafo*f(:,k) + r(:,k); % vincolo sul primo nodo
p_min <= p(:,k) <= p_max
s_min <= s(:,k) <= s_max
r_min <= r(:,k) <= r_max
if k==1
s(:,k) == s_0 + r_0;
else
s(:,k) == s(:,k-1) + r(:,k-1);
end
end
cvx_end

%d = [d(:,2:end)  d(:,1)];
d = [d(:,i:end) d(:,1:i)];
s_0 = s(:,i);
r_0 = r(:,i);
p_segnato(:,i) = p(:,1);
s_segnato(:,i) = s(:,2);
r_segnato(:,i) = r(:,1);
f_segnato(:,i) = f(:,1);

end

Why do not you include the actual error message you got.

Indeed. We can’t offer help without more specifics.