我需要将此算法转换为背包。这基本上是基于贪婪算法。请帮助我将其转换为背包

时间:2018-07-01 11:52:14

标签: knapsack-problem greedy vlsi

我需要将此算法转换为背包。这基本上是基于贪婪算法。请帮助我将其转换为背包 下面显示了在考虑较低Power值的情况下调度不同内核的贪婪算法:

Step1. Initialize the value of TAM width. 
Step2. Construct three partitions of TAM width value as tw1,tw2  
and tw3 
and take the test 
time of different TAM width partitioned for scheduling of the cores. 
Step3. Different possible combination is made using  
for 
loop for the particular TAM 
width value. 
for i= 1; i<=n/2                      //   outer loop 
             {l= n-i ;                                  // where , n is value of TAM width 
for j= 1; j<=l/2                     //   inner loop
             {k=n-i ;}}                             // where  i,j,k,l are integers
           Minimum test time tt
  is taken among all the possible combinations  
           where, 
tt
 is sum of the test time of the cores. 
ttj represents test time of each core. 
Step4. Sort the value of power P of different cores in descending order using bubble 
sorting technique and select the two cores of maximum power along with the core 
of minimum power for scheduling. Update start time as well as end time. As 
testing of any core is completed the fourth core of minimum power P is added. 
Step5. Sort the value of test time 
tt
 of remaining cores in descending order and 
           schedule the cores from higher to lower test time 
tt
. Update the respective cores 
           accordingly and update the test time of each partition. 
Step6. Repeat step 7 until all the remaining cores get scheduled. 
Step7. Final test time tt
 value is the minimum test time tt
 among all the possible 
            Combinations. Test time tt
 is represented by the partition with maximum value

0 个答案:

没有答案