Skip to main content

FEL by Praman (Simulation and Modeling)

#include
#include
#include
typedef struct
{

int cno,in_arr,arr,ser_time,tsb,tse,wait,tsis,idle;
}customer;

int lookup1(int c)
{

if(c>=0 && c<13 font="font">
{

return 1;
}

else if(c>=13 && c<25 font="font">
{

return 2;
}

else if(c>=25 && c<38 font="font">
{

return 3;
}

else if(c>=38 && c<50 font="font">
{

return 4;
}

else if(c>=50 && c<63 font="font">
{

return 5;
}

else if(c>=63 && c<75 font="font">
{

return 6;
}

else if(c>=75 && c<87 font="font">
{

return 7;
}

return 8;
}

int lookup2(int c)
{

if(c>=0 && c<11 font="font">
{

return 1;
}

else if(c>=11 && c<31 font="font">
{

return 2;
}

else if(c>=31 && c<61 font="font">
{

return 3;
}

else if(c>=61 && c<86 font="font">
{

return 4;
}

else if(c>=86 && c<96 font="font">
{

return 5;
}

return 6;
}

void prtcust(customer c)
{

printf(
"\n");
printf("%d\t",c.cno);
printf("%d\t",c.in_arr);
printf("%d\t",c.arr);
printf("%d\t",c.ser_time);
printf("%d\t",c.tsb);
printf("%d\t",c.tse);
printf("%d\t",c.tsis);
printf("%d\t",c.wait);
printf("%d\t",c.idle);
}

customer initialize(customer c)

{

c.cno=1;

c.in_arr=0;

c.arr=0;

c.ser_time=lookup2(rand()%100);

c.tsb=0;

c.tse=c.ser_time;

c.wait=0;

c.idle=0;

c.tsis=c.ser_time;

prtcust(c);

return c;


}

typedef struct
{

char ename;
int time;
}event;
int max(int a,int b)
{

return a>=b?a:b;
}

void prtfel(event fel[],int t,int in,int dp)
{

event temp[3],temp2;
int i,j;
for(i=0;i<3 font="font" i="i">
{

temp[i]=fel[i];

}

for(i=0;i<3 font="font" i="i">
{

for(j=0;j<3 font="font" j="j">
{

if(temp[i].time
{

temp2=temp[i];

temp[i]=temp[j];

temp[j]=temp2;

}



}

}

if(t==temp[0].time)
{

for(i=0;i<3 font="font" i="i">
{

printf(
"(%c,%d) ",temp[i].ename,temp[i].time);
}

printf(
"\n%d\t",t);
t=temp[0].time;



}



}

int main()
{

customer c[30];

int i,j,k,a,d,e,p,arr=0,dep=0,idle=0,t=0,in=1,dp=0;
event fel[3];
system("cls");
printf("\t\t\tGrocery Shop Simulation\n");
printf("Cstno\tInArr\tArrvl\tSerTm\tTSB\tTSE\tTSpSys\tWait\tIdle");
c[0]=initialize(c[0]);

for(i=1;i<30 font="font" i="i">
{

c[i].cno=i+1;

c[i].in_arr=lookup1(rand()%100);

c[i].arr=c[i-1].arr+c[i].in_arr;

c[i].ser_time=lookup2(rand()%100);

c[i].tsb=max(c[i-1].tse,c[i].arr);

c[i].tse=c[i].tsb+c[i].ser_time;

c[i].wait=max(0,c[i].tsb-c[i].arr);

c[i].tsis=c[i].ser_time+c[i].wait;

c[i].idle=max(0,c[i].arr-c[i-1].tse);

prtcust(c[i]);

}

printf(
"\n\nPress any key to see FEL");
getch();

fel[2].ename=
'E';
fel[2].time=60;

fel[0].ename=
'A';
fel[0].time=0;

fel[1].ename=
'D';
fel[1].time=c[0].ser_time;

system(
"cls");
printf("\t\t\t FEL\n");
printf("Time \tFEL\n");
printf("%d\t",t);


while(t<60 font="font">
{

if(fel[0].time==t)
{

fel[0].time=t+c[in].in_arr;

in++;



}



if(fel[1].time==t)
{

fel[1].time= t+ c[dp].ser_time;

dp++;



}



t++;

prtfel(fel,t,in,dp);



}

getch();

}





Comments

Popular posts from this blog

Advantages and Disadvantages of EIS Advantages of EIS Easy for upper-level executives to use, extensive computer experience is not required in operations Provides timely delivery of company summary information Information that is provided is better understood Filters data for management Improves to tracking information Offers efficiency to decision makers Disadvantages of EIS System dependent Limited functionality, by design Information overload for some managers Benefits hard to quantify High implementation costs System may become slow, large, and hard to manage Need good internal processes for data management May lead to less reliable and less secure data

Inter-Organizational Value Chain

The value chain of   a company is part of over all value chain. The over all competitive advantage of an organization is not just dependent on the quality and efficiency of the company and quality of products but also upon the that of its suppliers and wholesalers and retailers it may use. The analysis of overall supply chain is called the value system. Different parts of the value chain 1.  Supplier     2.  Firm       3.   Channel 4 .   Buyer

Big-M Method and Two-Phase Method

Big-M Method The Big-M method of handling instances with artificial  variables is the “commonsense approach”. Essentially, the notion is to make the artificial variables, through their coefficients in the objective function, so costly or unprofitable that any feasible solution to the real problem would be preferred, unless the original instance possessed no feasible solutions at all. But this means that we need to assign, in the objective function, coefficients to the artificial variables that are either very small (maximization problem) or very large (minimization problem); whatever this value,let us call it Big M . In fact, this notion is an old trick in optimization in general; we  simply associate a penalty value with variables that we do not want to be part of an ultimate solution(unless such an outcome is unavoidable). Indeed, the penalty is so costly that unless any of the  respective variables' inclusion is warranted algorithmically, such variables will ...