10 #ifndef CLASS_CHANNELERLANG
11 #define CLASS_CHANNELERLANG
28 this->setExtras(extras);
31 vector<Package> simulate(vector<Package> list){
37 int size = list.size();
38 vector<string> ext = this->getExtras();
41 int N = atoi(ext[0].c_str());
42 int lambda = atoi(ext[1].c_str());
43 for (
int i = 0; i < size; i = i+1){
44 if(erlang(N,lambda/(list.size()-i))>0.5)
45 list = deletePackageById(i,list);
52 vector<Package> deletePackageById(
int ID, vector<Package> list){
59 for (
int i = 0; i < list.size(); i++)
61 if(list[i].getID()==ID){
62 list.erase(list.begin()+i);
69 double erlang(
int N,
int A){
77 num = (pow(A,N))/(factorial(N));
79 for(
int i=0;i<N;i=i+1){
80 den = den + (pow(A,i)/factorial(i));
85 double factorial(
int x){
88 return x*factorial(x-1);
91 double pow(
int a,
int b){
Clase que representa el Simulador utilizando Erlang.
Clase Abstracta que representa el Simulador de pérdida de paquetes.