- Timestamp:
- 09/07/09 17:04:29 (15 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
vtcross/trunk/src/cognitive_engines/CBR_CE/CognitiveEngine.cpp
r465 r468 18 18 #include <cstring> 19 19 #include <stdint.h> 20 #include <math.h> 21 20 #include <cmath> 21 22 #include "vtcross/cbr.h" 22 23 #include "vtcross/cognitive_engine.h" 23 24 #include "vtcross/common.h" … … 26 27 #include "vtcross/error.h" 27 28 #include "vtcross/socketcomm.h" 28 #include "vtcross/cbr.h" 29 30 // TODO this is really bad; need to move to a proper cbr.h 31 #include "cbr.c" 32 33 #include "sqlite3.h" 34 #include "sqlite3ext.h" 35 36 37 static cbr myCBR; 38 29 30 static CBR *myCBR; 39 31 40 32 CognitiveEngine::CognitiveEngine() … … 48 40 CognitiveEngine::~CognitiveEngine() 49 41 { 50 cbr_free(myCBR); 42 delete myCBR; 43 51 44 delete [] pList; 52 45 delete [] oList; … … 160 153 } 161 154 162 cbr_update(myCBR,nameList, obsList, valList, obsVals,155 myCBR->Update(nameList, obsList, valList, obsVals, 163 156 numberColumns, obsColumns); 164 157 } … … 670 663 * If the goal is to minimize, set the search operation to 671 664 * return values less than the target. 665 * 666 * NOTE: the values '2' and '4' here are from some old preprocesser 667 * definitions, which I will copy here until I can figure out just what 668 * exactly they were for: 669 42 #define EQ 0 // equals 670 43 #define NE 1 // not equals 671 44 #define GT 2 // greater than 672 45 #define GE 3 // greater than or equal to 673 46 #define LT 4 // less than 674 47 #define LE 5 // less than or equal to 672 675 */ 673 676 if(strcmp(uList[i].goal.c_str(), "max") == 0) { 674 searchOps[i] = GT;677 searchOps[i] = 2; 675 678 } else if(strcmp(uList[i].goal.c_str(), "min") == 0) { 676 searchOps[i] = LT;679 searchOps[i] = 4; 677 680 } 678 681 } 679 682 680 683 /* CBR specific call */ 681 uint32_t rc = cbr_search(myCBR,searchNames, searchOps, searchVals,684 uint32_t rc = myCBR->Search(searchNames, searchOps, searchVals, 682 685 radioInfo->numUtilities, returnValues); 683 686 … … 739 742 740 743 // Add row to CBR. 741 cbr_add_row(myCBR,allNames, returnValues, returnValueIndex+1);744 myCBR->AddRow(allNames, returnValues, returnValueIndex+1); 742 745 743 746 return pList; … … 791 794 cols[columnIndex] = (char *) "utility"; 792 795 793 myCBR = cbr_create(filename, tablename, cols, numberColumns);794 } 795 796 myCBR = new CBR(filename, tablename, cols, numberColumns); 797 } 798