diff --git a/deepQlearn_0/src/deepQlearning/learn_to_drive.c b/deepQlearn_0/src/deepQlearning/learn_to_drive.c index 8418121..28a5eb6 100644 --- a/deepQlearn_0/src/deepQlearning/learn_to_drive.c +++ b/deepQlearn_0/src/deepQlearning/learn_to_drive.c @@ -464,8 +464,11 @@ if(/*(qlStatus->nb_episodes %125 == 0) &&*/ pprint->printed){ char *fileNameDateScore(char * pre, char* post,size_t score){ char *filename=malloc(256); time_t t = time(NULL); - struct tm tm = *localtime(&t); - sprintf(filename,"%s%d%02d%02d_%02dh%02dm%02ds_%ld%s",pre, tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec,score,post); + ///struct tm tm = *localtime(&t); + //sprintf(filename,"%s%d%02d%02d_%02dh%02dm%02ds_%ld%s",pre, tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec,score,post); + ///sprintf(filename,"%s_%d%02d%02d%02d%02d%02d_%ld%s",pre, tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec,score,post); + //char sep='_'; + sprintf(filename,"%s%c%ld%c%ld%c%s",pre, sep, t, sep,score,sep,post); return filename; } diff --git a/deepQlearn_0/src/deepQlearning/learn_to_drive.h b/deepQlearn_0/src/deepQlearning/learn_to_drive.h index b8e0e3b..a09da7c 100644 --- a/deepQlearn_0/src/deepQlearning/learn_to_drive.h +++ b/deepQlearn_0/src/deepQlearning/learn_to_drive.h @@ -38,6 +38,7 @@ //#define main_symlink ".ff_main_.symlink" extern char *action_name[8]; +extern char sep; struct qlearning_params { float gamma; diff --git a/neuron_t/src/neuron_t/neuron_t.c b/neuron_t/src/neuron_t/neuron_t.c index b3c3278..4a92dfd 100644 --- a/neuron_t/src/neuron_t/neuron_t.c +++ b/neuron_t/src/neuron_t/neuron_t.c @@ -78,19 +78,19 @@ config_layers * create_config_layers_from_m_list_ptr_DIMENSION(struct main_list_ config_layers * create_config_layers_from_m_list_dimension(struct main_list_dimension * m_l_dim){ config_layers * pconf=malloc(sizeof(struct config_layers)); pconf->nb_layers=m_l_dim->size; - printf("debug: pconf->nb_layers=%ld\n",pconf->nb_layers); + //printf("debug: pconf->nb_layers=%ld\n",pconf->nb_layers); pconf->sz_layers=malloc(pconf->nb_layers * sizeof(size_t)); pconf->array_dim_in_layers=malloc((pconf->nb_layers)*sizeof(size_t*)); for(struct list_dimension *local_l_dim=m_l_dim->begin_list; local_l_dim; local_l_dim=local_l_dim->next){ size_t i = local_l_dim->index; - char msg[50]; sprintf(msg, "dim[%ld] ",i); - printDebug_dimension(&(local_l_dim->value), msg); + //char msg[50]; sprintf(msg, "dim[%ld] ",i); + //printDebug_dimension(&(local_l_dim->value), msg); pconf->sz_layers[i]=local_l_dim->value.size; - printf("debug: pconf->sz_layers[%ld]=%ld\n",i,pconf->sz_layers[i]); + //printf("debug: pconf->sz_layers[%ld]=%ld\n",i,pconf->sz_layers[i]); pconf->array_dim_in_layers[i]=malloc((pconf->sz_layers[i])*sizeof(size_t)); for(size_t j=0; j< pconf->sz_layers[i];++j){ pconf->array_dim_in_layers[i][j] = local_l_dim->value.perm[j]; - printf("debug: pconf->array_dim_in_layers[%ld][%ld]=%ld\n",i,j,pconf->array_dim_in_layers[i][j]); + //printf("debug: pconf->array_dim_in_layers[%ld][%ld]=%ld\n",i,j,pconf->array_dim_in_layers[i][j]); } } @@ -99,14 +99,19 @@ config_layers * create_config_layers_from_m_list_dimension(struct main_list_dime void print_config_layers(config_layers * pconf){ for(size_t i=0;inb_layers; ++i){ - printf("debug: pconf->sz_layers[%ld]=%ld\n",i,pconf->sz_layers[i]); + //printf("debug: pconf->sz_layers[%ld]=%ld\n",i,pconf->sz_layers[i]); for(size_t j=0; j< pconf->sz_layers[i];++j){ - printf(" [%ld][%ld]=%ld | ",i,j,pconf->array_dim_in_layers[i][j]); + //printf(" [%ld][%ld]=%ld | ",i,j,pconf->array_dim_in_layers[i][j]); } - printf("debug: pconf->nb_layers=%ld\n",pconf->nb_layers); + //printf("debug: pconf->nb_layers=%ld\n",pconf->nb_layers); } } + +void extract_src_score_date_from_filename(char *src, ssize_t score, size_t date, char *filename){ + // +} + bool randomizeInitWeight=true; #define GEN_NEURONS_F_(type)\ @@ -1157,7 +1162,7 @@ void put_meaning_of_weitgh_in_set_neurons_##type(struct set_neurons_##type *dst_ for(struct list_ptr_set_NEURONS_##type *local_set_n=m_set_nrns->begin_list; local_set_n ; local_set_n = local_set_n->next ){\ sum_score+=(local_set_n->value->score);\ if(cmp_config_layers(dst_nrns->pconf, local_set_n->value->pconf)){\ - printf("debug: config_layers not match in inex = %ls \n",local_set_n->index);\ + printf("debug: config_layers not match in inex = %ld \n",local_set_n->index);\ return;\ }\ }\ diff --git a/neuron_t/src/neuron_t/neuron_t.h b/neuron_t/src/neuron_t/neuron_t.h index ce5688d..3b645c9 100644 --- a/neuron_t/src/neuron_t/neuron_t.h +++ b/neuron_t/src/neuron_t/neuron_t.h @@ -25,6 +25,8 @@ config_layers * create_config_layers_from_m_list_ptr_DIMENSION(struct main_list_ config_layers * create_config_layers_from_m_list_dimension(struct main_list_dimension *m_l_dim); void print_config_layers(config_layers * pconf); +void extract_src_score_date_from_filename(char *src, ssize_t score, size_t date, char *filename); + #define GEN_NEURON_(type)\ \ struct neurons_##type {/* layer */\ diff --git a/y_socket_t/include/y_socket_t/y_file_handler.h b/y_socket_t/include/y_socket_t/y_file_handler.h index 4cd861a..2738ca3 100644 --- a/y_socket_t/include/y_socket_t/y_file_handler.h +++ b/y_socket_t/include/y_socket_t/y_file_handler.h @@ -15,6 +15,8 @@ #include "list_t/list_t.h" +extern char sep; + void y_fileNameDateScore(char* filename, char * pre, char* post,size_t score); struct arg_send_file{ diff --git a/y_socket_t/src/y_socket_t/y_file_handler.c b/y_socket_t/src/y_socket_t/y_file_handler.c index e7c79bd..bcf445b 100644 --- a/y_socket_t/src/y_socket_t/y_file_handler.c +++ b/y_socket_t/src/y_socket_t/y_file_handler.c @@ -80,8 +80,8 @@ int funcCmp_y_ptr_HEADER_T(y_ptr_HEADER_T h1, y_ptr_HEADER_T h2){ int funcCmp_y_ptr_HEADER_T_fn_nameid_mask(y_ptr_HEADER_T h1, y_ptr_HEADER_T h2){ if(h1==NULL || h2==NULL) return -1; - struct main_list_y_ptr_STRING * m_h1_nameid = split_str_to_main_list_y_ptr_STRING(h1->nameid,'_', h1->size_nameid); - struct main_list_y_ptr_STRING * m_h2_nameid = split_str_to_main_list_y_ptr_STRING(h2->nameid,'_', h2->size_nameid); + struct main_list_y_ptr_STRING * m_h1_nameid = split_str_to_main_list_y_ptr_STRING(h1->nameid,sep, h1->size_nameid); + struct main_list_y_ptr_STRING * m_h2_nameid = split_str_to_main_list_y_ptr_STRING(h2->nameid,sep, h2->size_nameid); //int count_match = 0; struct main_list_TYPE_SIZE_T * m_index_not_match = create_var_list_TYPE_SIZE_T(); @@ -459,11 +459,14 @@ int remove_content_from_headers(struct main_list_y_ptr_HEADER_T *m_head_l_t, y_p } } +char sep=';'; + void y_fileNameDateScore(char* filename, char * pre, char* post,size_t score){ // char *filename=malloc(256); time_t t = time(NULL); - struct tm tm = *localtime(&t); - sprintf(filename,"%s%d%02d%02d_%02dh%02dm%02ds_%ld%s",pre, tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec,score,post); + //struct tm tm = *localtime(&t); + //sprintf(filename,"%s%d%02d%02d_%02dh%02dm%02ds_%ld%s",pre, tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec,score,post); + sprintf(filename,"%s%c%ld%c%ld%c%s",pre, sep, t,sep,score,sep,post); //return filename; } @@ -583,7 +586,7 @@ void* y_socket_send_file_for_node(void* arg){ set_addr_str_from_node(tempAddr, node); c_af=(node).addr.ss_family; - sprintf(nameid, "%s_%s_%ld",name_f, tempAddr, timeid); + sprintf(nameid, "%s%c%s%c%ld",name_f,sep, tempAddr,sep, timeid); for(int tour_i=0;(tour_i<4) && (check_if_in_ok_header_l_(argS->m_ok_head_l_t, nameid) == 0); ++tour_i){ @@ -925,7 +928,7 @@ void receve_from_node(struct pollfd *fds, struct main_list_y_ptr_HEADER_T *m_hea #if 0 size_nameid = sprintf(nameid, "%s_%s_%s_%s",name_f /*filename*/, srcAddr, value_of_(js_dst_v)->type.string, timeid/*value_of_(js_tm_v)->type.string*/); #endif - size_nameid = sprintf(nameid, "%s_%s_%s",name_f, srcAddr, /*value_of_(js_dst_v)->type.string,*/ value_of_(js_tm_v)->type.string); + size_nameid = sprintf(nameid, "%s%c%s%c%s",name_f, sep, srcAddr, sep, /*value_of_(js_dst_v)->type.string,*/ value_of_(js_tm_v)->type.string); ///printf("debug: nameid = %s\n", nameid); //int intTimeid = atoi(timeid); diff --git a/y_socket_t/src/y_socket_t/y_list_var_tool.c b/y_socket_t/src/y_socket_t/y_list_var_tool.c index cebaa83..03bc900 100644 --- a/y_socket_t/src/y_socket_t/y_list_var_tool.c +++ b/y_socket_t/src/y_socket_t/y_list_var_tool.c @@ -5,6 +5,8 @@ long long_time_id(){ // char *filename=malloc(256); //char timeid[64];//="20251011215824"; time_t t = time(NULL); + return t; +#if 0 struct tm tm = *localtime(&t); //sprintf(timeid,"%d%02d%02d%02d%02d%02d", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec); @@ -13,6 +15,7 @@ long long_time_id(){ ///printf("debug: timeid=%s, vs tm=%ld\n",timeid, intm); //printf("debug: timeof=%ld, vs tm=%ld, tm_zone=%s\n",tm.tm_gmtoff, long_tm, tm.tm_zone); return long_tm; +#endif } char * time_id(){ // char *filename=malloc(256);