Changeset 511 for vtcross/trunk/src
- Timestamp:
- 11/11/09 16:03:01 (15 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
vtcross/trunk/src/cognitive_engines/DSA_CE/DSA_CognitiveEngine.cpp
r509 r511 165 165 /* Calculate Utility */ 166 166 float oldUtilityValue = returnValues[UTILITY]; 167 167 168 169 ////////////////////////////////////////////// 170 // 171 // BEGIN CORE DSA ALGORITHM UTILITY FUNCTION 172 // 173 ////////////////////////////////////////////// 174 168 175 // Set DSA utility to take into account both the previously sensed 169 176 // energy and the average communication time. … … 174 181 // So we should lower the utility for this channel. 175 182 183 int reward = 20; 184 int punishment = -100; 185 176 186 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; 178 189 } else { 179 newUtilityValue = newUtilityValue + 20;180 } 181 190 printf("Cognitive Engine:: Scan Mode:: No PU detected - Incrementing Utility."); 191 newUtilityValue = newUtilityValue + reward; 192 } 182 193 183 194 if(newUtilityValue <= 100) … … 185 196 186 197 obsVals[obsValueIndex] = newUtilityValue; 198 199 ////////////////////////////////////////////// 200 // 201 // END CORE DSA ALGORITHM UTILITY FUNCTION 202 // 203 ////////////////////////////////////////////// 204 187 205 188 206 size_t returnValueIndex = 0;