int TightenWindows (long NO_JOBS, long *release, long *due, long *proc_time, long *dlist) { short FLAG, INF, CHNG, ROUNDS; long i, j, k, t, head; long release2[MAXJOBS+1], due2[MAXJOBS+1]; long sindex[MAXJOBS+1]; long P, H, C, CI[MAXJOBS]; for(i=0; i<=NO_JOBS; i++) sindex[i]=i; for(i=0; i<=NO_JOBS; i++) CI[i]=0; INF=0; CHNG=0; //cout << "dlist = " ; //for(i=0; i<=14; i++) cout << " " << dlist[i] ; //cout << endl; /* 1.1. Read precedence constraints from array in the format of the file*/ FLAG=1; head=dlist[0]; i=1; while(FLAG>=0) { if (dlist[i]>0) { delay[dlist[i]][head]=dlist[i+1]; i=i+2; } else if (dlist[i]==0 && dlist[i+1]>0) { head=dlist[i+1]; i=i+2; } else if (dlist[i]==0 && dlist[i+1]==0) { FLAG=-1; } } /* 1.2. Convert end of time windows to due times ------------------------- */ for (i=1; i<=NO_JOBS; i++) due += proc_time[i]; /* 1.3. Print-out imported data; this part will be deleted when integrated */ //cout << "Release, Due and Processing Times" << endl; //for(i=1; i<=NO_JOBS; i++) cout <<" "< r="<0) cout <<" DPC["<0) && (k<=ROUNDS)) { FLAG = 0; k += 1; for(i=1; i<=NO_JOBS; i++) { for(j=1; j<=NO_JOBS; j++) { if(delay[i][j]>0) { if(release[j]due[j]-delay[i][j]) { due[i]=due[j]-delay[i][j]; FLAG=1; CHNG=1; } } } } } //cout << "DPC Tightening " << endl; //for(i=1; i<=NO_JOBS; i++) cout <<" "< r="< r="<due[sindex[k]]) && (CI[sindex[i]]>release2[sindex[i]])) { release2[sindex[i]]=CI[sindex[i]]; CHNG=1; } if ((H+proc_time[sindex[i]]>due[sindex[k]]) && (C>release2[sindex[i]])) { release2[sindex[i]]=C; CHNG=1; } } } } for(i=1; i<=NO_JOBS; i++) release[sindex[i]] = release2[sindex[i]]; //cout <<"Edge-Finding: Tightening of Release Times " << endl; //for(i=1; i<=NO_JOBS; i++) cout <<" "< r="< r="<=release[sindex[k]]) { if (H>due[sindex[i]]-P) { H=due[sindex[i]]-P; } P -= proc_time[sindex[i]]; } else { if ((due[sindex[i]]-P-proc_time[sindex[i]]CI[sindex[i]])) { due2[sindex[i]]=CI[sindex[i]]; CHNG=1; } if ((H-proc_time[sindex[i]]C)) { due2[sindex[i]]=C; CHNG=1; } } } } for(i=1; i<=NO_JOBS; i++) due[sindex[i]] = due2[sindex[i]]; //cout <<"Edge-Finding: Tightening of Due Times " << endl; //for(i=1; i<=NO_JOBS; i++) cout <<" "< r="<