Changeset 89 for vtcross/branches
- Timestamp:
- 11/27/08 21:32:50 (16 years ago)
- Location:
- vtcross/branches/trnewman/CR_engines/CBR/src
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
vtcross/branches/trnewman/CR_engines/CBR/src/cbr.c
r88 r89 85 85 } else { 86 86 printf("no matched rearch results. use default values\n"); 87 // set default values87 88 88 _retvals[0] = 100; // throughput 89 89 _retvals[1] = 1; // spectral_efficiency -
vtcross/branches/trnewman/CR_engines/CBR/src/main_cognitive_engine.c
r88 r89 303 303 ReadMessage(sockfd,buffer); 304 304 *num_cols = atoi(buffer); 305 /*printf("number of rows: %d, number of columns: %d\n",306 *num_rows, *num_cols); */307 305 return 1; 308 306 } … … 310 308 311 309 int GetExperience(int sockfd, int num_rows, int num_cols, 312 float **past_exp) 310 //float **past_exp) 311 float past_exp[num_rows][num_cols]) 313 312 { 314 313 char buffer[256]; … … 380 379 int RunCBREngine(struct Utility uList[], struct Parameter pList[], 381 380 struct Observable oList[], struct CE_Info *ce_info, 382 int num_cols, int num_rows, float ** past_exp) 381 //int num_cols, int num_rows, float ** past_exp) 382 int num_cols, int num_rows, float past_exp[num_rows][num_cols]) 383 383 { 384 384 … … 386 386 387 387 // get column names 388 //char *cols[50]; 388 /*char *cols[50] = {"throughput", "spectral_efficiency", 389 "log10_ber", "mod_scheme", "tx_power", "SNR", "utility"};*/ 389 390 //char cols[num_cols][50]; 391 390 392 char **cols; 391 393 cols = (char **)malloc(sizeof(char)*num_cols); … … 409 411 j++; 410 412 } 411 printf("number of columns: %d, %d\n", num_cols, j);412 413 cols[j] = malloc(strlen("utility")+1); 413 414 cols[j] = "utility"; 414 //strcpy(cols[j], "utility"); 415 printf("here\n"); 416 417 printf("number of columns: %d\n", num_cols); 415 418 416 printf("column names:"); 419 417 for (i = 0; i<num_cols; i++){ … … 429 427 cbr mycbr = cbr_create(filename, tablename, cols, num_cols); 430 428 //cbr mycbr = cbr_create("ex1", "data", cols, num_cols); 431 429 432 430 // add row here 433 431 float vals[num_cols]; … … 440 438 vals[5] = 10.0f; // SNR 441 439 vals[6] = 0.762; // utility*/ 442 printf("here\n");443 440 for (i = 0; i < num_rows; i++){ 444 441 for (j = 0; j < num_cols; j++){ 445 442 vals[j] = past_exp[i][j]; 446 443 } 447 printf("add row to cbr table\n");448 444 rc = cbr_add_row(mycbr, cols, vals, num_cols); 449 445 } … … 542 538 print_current_config(uList, pList, oList, &ce_info); 543 539 544 // get experience size rom server540 // get experience size from server 545 541 int num_rows, num_cols; 546 542 GetExperienceSize(sockfd, &num_rows, &num_cols); 547 //printf("number of rows: %d, number of columns: %d\n",548 // num_rows, num_cols);549 543 // get experience 550 float **past_exp;551 544 int i, j; 545 /*float **past_exp; 552 546 past_exp = (float **)malloc(sizeof(float)*num_rows); 553 547 for (i = 0; i< 1; i++){ 554 548 past_exp[i] = (float*)malloc(sizeof(float)*num_cols); 555 } 549 }*/ 550 float past_exp[num_rows][num_cols]; 556 551 GetExperience(sockfd, num_rows, num_cols, past_exp); 557 552 for (i = 0; i < num_rows; i++){ 553 printf("experience #%d:\n", i+1); 558 554 for (j = 0; j < num_cols; j++){ 559 printf("experience: %f\n", past_exp[i][j]); 560 } 555 printf(" %f", past_exp[i][j]); 556 } 557 printf("\n"); 561 558 } 562 559