/// <summary> /// 给定点,检测是否需要进行动态优化,并进行频率的动态调整 /// </summary> /// <param name="index"></param> public void checkAndOpt_Dyn(int index) { LU lu = new LU(); //succ(i) while(true) { lu = utilizationCompTime(index, this.vexs[index].pointPeriod); double laxity = 1 - lu.worseTime / this.vexs[index].pointPeriod; if (laxity >= lu.utilization || lu.k_index == lu.minT_index) break; Console.WriteLine("laxity=" + laxity + " U=" + lu.utilization + " minT_index=" + lu.minT_index + 1 + " k_index=" + lu.k_index + 1); Console.WriteLine("check for point " + (index + 1)); Console.WriteLine((lu.minT_index + 1) + "频率为" + this.vexs[lu.minT_index].pointPeriod + "动态调整加倍"); Console.ReadKey(); this.vexs[lu.minT_index].pointPeriod *= 2; MGraphUpdate(lu.minT_index); } }
public void checkAndOpt_UtiDyn(int index) { LU lu = new LU(); lu = utilizationCompTime(index, this.vexs[index].pointPeriod); }
public LU utilizationCompTime(int index, int tk) { LU lu = new LU(); bool noIncoming = true; List<int> candi = new List<int>(vexnum); for (int i = 0; i < vexnum; i++) { if (this.arcs[i, index].arcAdj == 1) { noIncoming = false; candi.Add(i); } } if (noIncoming) { lu.worseTime = this.vexs[index].pointComptime; lu.utilization = lu.worseTime / this.vexs[index].pointPeriod; lu.k_index = lu.minT_index = index; return lu; } else { LU minLU = new LU(0, 0); LU tLU = new LU(); double tTime = 0; double tU = 0; for (int i = 0; i < candi.Count; i++) { tTime = tk / (this.vexs[candi[i]].pointPeriod) * this.vexs[index].pointComptime + utilizationCompTime(candi[i], tk).worseTime; tU = utilizationCompTime(candi[i], tk).utilization + this.vexs[candi[i]].pointComptime / this.vexs[candi[i]].pointPeriod; tLU.worseTime = tTime; tLU.utilization = tU; tLU.k_index = index; tLU.minT_index = (this.vexs[candi[i]].pointPeriod > this.vexs[index].pointPeriod) ? index : candi[i]; if (tLU.worseTime > minLU.worseTime) { minLU.worseTime = tLU.worseTime; minLU.utilization = tLU.utilization; minLU.minT_index = tLU.minT_index; minLU.k_index = tLU.k_index; } } return minLU; } }