#include #include #include #include #include #include #define MAX 1000 using namespace std; int parent_proc[MAX]; int OUT[MAX][MAX]; float tp[MAX]={0}; //processor availability //float time=0; float aft[MAX]={0}; // clock time for processor int comm_mat[MAX][MAX]={0}; //process time on diff. processor int adj[MAX][MAX]={0}; //adjancecy matrix int p_matrix[MAX][MAX],p_temp[MAX][MAX]; //processor matrix int nodes=0; //number of nodes int n_proc=0; //number of processors float rank[MAX][MAX]={0.0}; //oct ranking float est[MAX][MAX]={0}; // average of all rank on processor vector ready_list; vector n_ready; ifstream ifs; void SORT(); void remove_duplicate(); inline void set_aft(){for(int i=0;i>nodes; ifs>>n_proc; read_weight(); read_processor(); read_adj();ifs.close(); /* read endds */ set_end_nodes(); for(int i=nodes-1;i>=0;i--) { if(check_end_node(i)==true) set_rank_zero(i); /* If a terminal node set rank to 0.0*/ else{ /* if not a terminal node*/ for(int j=i+1;jtemp){ temp=ready_list[n_ready[i]]; save=i; } n_ready.erase(n_ready.begin()+save); return save; } float EFT(int ni,int pj,int previous) { int temp[MAX]={0}; float mt; for(int i=0;i<=ni;i++) { if(adj[i][ni]!=-1) { for(int j=0;jtemp[i]) est[ni][i]=tp[i]; else est[ni][i]=temp[i]; } /* for(int j=0;j<=ni;j++) { if(adj[j][ni]!=-1) //if a pred. // { add_mul_mat(aft[j],adj[j][ni],p_temp); /// AFT(Nm)+Cm,i } else continue; for(int z=0;z=p_temp[previous][z]) est[ni][z]=tp[z]; else est[ni][z]=p_temp[previous][z]; // EST } } */ return est[ni][pj]+comm_mat[ni][pj]; /* EFT */ } void add_mul_mat(float add,float mul,int a[][MAX]) { float mx=0; for(int i=0;imx) mx=(float)a[previous][j]; } //return mx; } void N_entry() { bool flag=true; for(int i=0;i>adj[i][j]; } void read_processor() { for (int i = 0; i >p_matrix[i][j]; } void read_weight() { for(int i=0;i>comm_mat[i][j]; } void display() { cout<<"Nodes: "<