function [ztrata u y b P]=cc(regulator_parameters,system,apriori,seed)

horizont=regulator_parameters.horizont;

y=zeros(1,horizont);
b=zeros(1,horizont-1);
P=zeros(1,horizont-1);
u=zeros(1,horizont-1);
ztrata=0;

y(1)=apriori(1);
b(1)=apriori(2);
P(1)=apriori(3);

for i=1:horizont-1
    u(i)=-y(i)*b(i)/(b(i)^2+P(i));
    [y(i+1) b(i+1) P(i+1)]=get_next([y(i) b(i) P(i)],u(i),system,seed(i));
    ztrata=ztrata+y(i+1)^2;
end

end

