Changeset 525

Show
Ignore:
Timestamp:
12/07/09 12:44:58 (14 years ago)
Author:
bhilburn
Message:

Recreated the CognitiveEngine? class, inherited and implemented it with
the CBR_CE test class. Seems to be working so far.

Location:
vtcross/branches/engineTreeFix/src/cognitive_engines
Files:
1 added
1 removed
4 modified

Legend:

Unmodified
Added
Removed
  • vtcross/branches/engineTreeFix/src/cognitive_engines/CBR_CE/Makefile.am

    r468 r525  
    2121bin_PROGRAMS = cbr_demo 
    2222 
    23 cbr_demo_SOURCES = CognitiveEngine.cpp cbr_demo.cpp 
    24 cbr_demo_LDADD = -lsqlite3 $(CROSS_SOCKETCOMM_LA)  
     23cbr_demo_SOURCES = CBR_CE.cpp cbr_demo.cpp 
     24cbr_demo_DEPENDENCIES = ../libce.a 
     25cbr_demo_LDADD = -lsqlite3 ../libce.a $(CROSS_SOCKETCOMM_LA)  
    2526 
  • vtcross/branches/engineTreeFix/src/cognitive_engines/CBR_CE/cbr_demo.cpp

    r465 r525  
    4141       ERROR(1, "Usage: %s hostname port\n", argv[0]); 
    4242     
    43     CognitiveEngine cognitiveEngine(argv[1], argv[2], false); 
     43    CognitiveEngine cognitiveEngine(argv[1], argv[2], 10, false); 
    4444 
    4545    LOG("Waiting for signal...\n"); 
  • vtcross/branches/engineTreeFix/src/cognitive_engines/CognitiveEngine.cpp

    r524 r525  
    2626#include <string> 
    2727 
    28 #include "vtcross/cbr.h" 
    2928#include "vtcross/cognitive_engine.h" 
    3029#include "vtcross/common.h" 
     
    10099        ReceiveRadioConfiguration(); 
    101100        ReceiveExperience(); 
    102     } 
    103 } 
    104  
    105 void  
    106 CognitiveEngine::ReceiveFeedback(Observable *observables, Parameter *parameters) 
    107 {  
    108     LOG("Cognitive Engine:: Receiving feedback.\n"); 
    109      
    110     uint32_t numberColumns = radioInfo->numParameters + radioInfo->numUtilities; 
    111  
    112     uint32_t obsColumns = radioInfo->numObservables + 1; 
    113  
    114     float valList[numberColumns]; 
    115     float obsVals[numberColumns]; 
    116     string nameList[numberColumns]; 
    117     string obsList[obsColumns]; 
    118  
    119     size_t columnObsIndex = 0; 
    120     for (size_t i = 0; i < radioInfo->numObservables; i++){ 
    121         obsList[columnObsIndex] = observables[i].name; 
    122         columnObsIndex++; 
    123     }   
    124     obsList[columnObsIndex] = "utility"; 
    125  
    126     size_t columnIndex = 0; 
    127     for (size_t i = 0; i < radioInfo->numParameters; i++){ 
    128         nameList[columnIndex] = parameters[i].name; 
    129         columnIndex++; 
    130     }    
    131     for (size_t i = 0; i < radioInfo->numUtilities; i++){ 
    132         nameList[columnIndex] = uList[i].name; 
    133         columnIndex++; 
    134     }    
    135  
    136     size_t obsValueIndex = 0; 
    137     for(size_t i = 0; i < radioInfo->numObservables; i++) { 
    138         obsVals[obsValueIndex] = observables[i].value; 
    139         obsValueIndex++; 
    140     } 
    141  
    142     /* Calculate Utility */ 
    143     float newUtilityValue = 0; 
    144  
    145     for(size_t i = 0; i < radioInfo->numUtilities; i++) { 
    146         newUtilityValue = newUtilityValue + (uList[i].target - observables[i].value); 
    147     } 
    148     obsVals[obsValueIndex] = newUtilityValue; 
    149  
    150     size_t returnValueIndex = 0; 
    151     for(size_t i = 0; i < radioInfo->numParameters; i++) { 
    152         valList[returnValueIndex] = parameters[i].value; 
    153         returnValueIndex++; 
    154     } 
    155     for(size_t i = 0; i < radioInfo->numUtilities; i++) { 
    156         valList[returnValueIndex] = uList[i].target; 
    157         returnValueIndex++; 
    158101    } 
    159102} 
     
    420363 
    421364void  
     365CognitiveEngine::ReceiveFeedback(Observable *observables,Parameter *parameters) 
     366{ 
     367    LOG("Cognitive Engine:: Receiving feedback.\n"); 
     368 
     369    LOG("CognitiveEngine:: ReceiveFeedback not implemented.\n"); 
     370} 
     371 
     372 
     373void  
    422374CognitiveEngine::ReceiveFeedback(Observable *observables, Parameter *parameters, \ 
    423375    std::string service) 
     
    451403 
    452404void  
    453 PerformUpdatePerformance() 
    454 { 
    455 } 
    456  
    457  
    458 void 
    459 PerformRequestOptimizationService() 
    460 { 
    461 } 
    462  
    463  
    464 void 
    465 PerformRequestOptimization() 
    466 { 
    467 } 
    468  
    469  
    470 void 
    471 PerformQueryComponentType() 
    472 { 
    473 } 
    474  
    475  
    476 void 
    477 PerformConnectSML() 
    478 { 
    479 } 
    480  
    481  
    482 void 
    483 PerformDisconnectSML() 
    484 { 
    485 } 
    486  
    487  
    488 void 
    489 PerformResetEngineCognitive() 
    490 { 
    491 } 
    492  
    493  
    494 void 
    495 PerformShutdownEngineCognitive() 
     405CognitiveEngine::PerformUpdatePerformance() 
     406{ 
     407} 
     408 
     409 
     410void 
     411CognitiveEngine::PerformRequestOptimizationService() 
     412{ 
     413} 
     414 
     415 
     416void 
     417CognitiveEngine::PerformRequestOptimization() 
     418{ 
     419} 
     420 
     421 
     422void 
     423CognitiveEngine::PerformQueryComponentType() 
     424{ 
     425} 
     426 
     427 
     428void 
     429CognitiveEngine::PerformConnectSML() 
     430{ 
     431} 
     432 
     433 
     434void 
     435CognitiveEngine::PerformDisconnectSML() 
     436{ 
     437} 
     438 
     439 
     440void 
     441CognitiveEngine::PerformResetEngineCognitive() 
     442{ 
     443} 
     444 
     445 
     446void 
     447CognitiveEngine::PerformShutdownEngineCognitive() 
    496448{ 
    497449} 
  • vtcross/branches/engineTreeFix/src/cognitive_engines/Makefile.am

    r416 r525  
    1515include $(top_srcdir)/Makefile.common 
    1616 
    17 SUBDIRS = CBR_CE DSA_CE OSSIE_DEMO_CE 
     17INCLUDES = -I$(top_srcdir)/src/include 
     18 
     19AM_CXXFLAGS = -Wall -g 
     20 
     21noinst_LIBRARIES = libce.a 
     22libce_a_SOURCES = CognitiveEngine.cpp 
     23 
     24SUBDIRS = . CBR_CE #DSA_CE OSSIE_DEMO_CE