Changeset 511

Show
Ignore:
Timestamp:
11/11/09 16:03:01 (14 years ago)
Author:
trnewman
Message:

Making it obvious where the core DSA algorithm is located

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • vtcross/trunk/src/cognitive_engines/DSA_CE/DSA_CognitiveEngine.cpp

    r509 r511  
    165165    /* Calculate Utility */ 
    166166    float oldUtilityValue = returnValues[UTILITY]; 
    167      
     167    
     168 
     169    ////////////////////////////////////////////// 
     170    // 
     171    //  BEGIN CORE DSA ALGORITHM UTILITY FUNCTION 
     172    // 
     173    ////////////////////////////////////////////// 
     174  
    168175    // Set DSA utility to take into account both the previously sensed 
    169176    //  energy and the average communication time. 
     
    174181    // So we should lower the utility for this channel. 
    175182 
     183    int reward = 20; 
     184    int punishment = -100; 
     185 
    176186    if((observables[COMMUNICATION_TIME].value != 0) || (observables[ENERGY].value > 1000)) {  
    177         newUtilityValue = newUtilityValue - 100; 
     187        printf("Cognitive Engine:: Primary User caused channel change - Decrementing Utility."); 
     188        newUtilityValue = newUtilityValue + punishment; 
    178189    } else { 
    179         newUtilityValue = newUtilityValue + 20; 
    180     } 
    181  
     190        printf("Cognitive Engine:: Scan Mode:: No PU detected - Incrementing Utility."); 
     191        newUtilityValue = newUtilityValue + reward; 
     192    } 
    182193 
    183194    if(newUtilityValue <= 100) 
     
    185196 
    186197    obsVals[obsValueIndex] = newUtilityValue; 
     198 
     199    ////////////////////////////////////////////// 
     200    // 
     201    //  END CORE DSA ALGORITHM UTILITY FUNCTION 
     202    // 
     203    ////////////////////////////////////////////// 
     204 
    187205 
    188206    size_t returnValueIndex = 0;