y_nnn_screen: debug avoid to kill or join bash already down by adding check bash down
This commit is contained in:
@@ -124,37 +124,79 @@ struct arg_bash *create_arg_bash(){
|
|||||||
return b_arg;
|
return b_arg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int check_bash_down(pid_t pid){
|
||||||
|
char path_folder[SIZE_LOCAL_BUF];
|
||||||
|
snprintf(path_folder, SIZE_LOCAL_BUF, "/proc/%d", pid);
|
||||||
|
printf("debug: check_bash_down %s\n", path_folder);
|
||||||
|
if (access(path_folder, F_OK) == 0) {
|
||||||
|
// file exists
|
||||||
|
char path[SIZE_LOCAL_BUF];
|
||||||
|
snprintf(path,SIZE_LOCAL_BUF, "/proc/%d/comm",pid);
|
||||||
|
if(access(path, F_OK) == 0){
|
||||||
|
char name[SIZE_LOCAL_BUF];
|
||||||
|
int status;
|
||||||
|
int fd_comm = open(path, O_RDONLY);
|
||||||
|
if(fd_comm<0){
|
||||||
|
perror("fd_comm: check_bash_down");
|
||||||
|
return fd_comm;
|
||||||
|
}
|
||||||
|
if((status=read(fd_comm, name, SIZE_LOCAL_BUF))){
|
||||||
|
name[status-1]=0;
|
||||||
|
if(strcmp(name,"bash")==0){
|
||||||
|
close(fd_comm);
|
||||||
|
printf("debug: success check_bash_down not down = %s , name = %s\n",path,name);
|
||||||
|
return 0;//success
|
||||||
|
}
|
||||||
|
printf("debug: check_bash_down fail: name=%s != bash\n",name);
|
||||||
|
}
|
||||||
|
close(fd_comm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
printf("debug: fail check_bash_down %s, bash already down \n",path_folder);
|
||||||
|
//else {
|
||||||
|
// file doesn't exist
|
||||||
|
return -1;
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/* free and kill bash */
|
/* free and kill bash */
|
||||||
void free_arg_bash(struct arg_bash *arg){
|
void free_arg_bash(struct arg_bash *arg){
|
||||||
pthread_mutex_destroy(arg->mut_bash_var);
|
pthread_mutex_destroy(arg->mut_bash_var);
|
||||||
free(arg->mut_bash_var);
|
free(arg->mut_bash_var);
|
||||||
pthread_cond_destroy(arg->cond_bash_var);
|
pthread_cond_destroy(arg->cond_bash_var);
|
||||||
free(arg->cond_bash_var);
|
free(arg->cond_bash_var);
|
||||||
|
int ret_check_down_bash_new=-1;
|
||||||
|
int ret_check_down_bash_current = -1;
|
||||||
if(arg->fd_new_bash_pid > 0) {
|
if(arg->fd_new_bash_pid > 0) {
|
||||||
|
if(check_bash_down(arg->new_bash_pid) == 0){
|
||||||
close(arg->fd_new_bash_pid);
|
close(arg->fd_new_bash_pid);
|
||||||
kill(arg->new_bash_pid, SIGKILL);
|
kill(arg->new_bash_pid, SIGKILL);
|
||||||
|
ret_check_down_bash_new=0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(arg->fd_current_bash_pid > 0 && arg->fd_current_bash_pid != arg->fd_new_bash_pid) {
|
if(arg->fd_current_bash_pid > 0 && arg->fd_current_bash_pid != arg->fd_new_bash_pid) {
|
||||||
|
if(check_bash_down(arg->current_bash_pid) == 0){
|
||||||
close(arg->fd_current_bash_pid);
|
close(arg->fd_current_bash_pid);
|
||||||
kill(arg->current_bash_pid, SIGKILL);
|
kill(arg->current_bash_pid, SIGKILL);
|
||||||
|
ret_check_down_bash_current = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(arg->thread_launch){
|
|
||||||
pthread_join(*(arg->thread_launch), NULL);
|
|
||||||
free(arg->thread_launch);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(arg->thread_launch){
|
if(arg->thread_launch){
|
||||||
pthread_join(*(arg->thread_launch),NULL);
|
pthread_join(*(arg->thread_launch),NULL);
|
||||||
free(arg->thread_launch);
|
free(arg->thread_launch);
|
||||||
}
|
}
|
||||||
if(arg->thread_run_newbash){
|
if(arg->thread_run_newbash){
|
||||||
|
if(ret_check_down_bash_new == 0)
|
||||||
pthread_join(*(arg->thread_run_newbash),NULL);
|
pthread_join(*(arg->thread_run_newbash),NULL);
|
||||||
free(arg->thread_run_newbash);
|
free(arg->thread_run_newbash);
|
||||||
}
|
}
|
||||||
if(arg->thread_run_waitbash){
|
if(arg->thread_run_waitbash){
|
||||||
|
if(ret_check_down_bash_current==0)
|
||||||
pthread_join(*(arg->thread_run_waitbash),NULL);
|
pthread_join(*(arg->thread_run_waitbash),NULL);
|
||||||
free(arg->thread_run_waitbash);
|
free(arg->thread_run_waitbash);
|
||||||
}
|
}
|
||||||
@@ -212,27 +254,43 @@ if(arg->new_bash_pid == arg->old_bash_pid){
|
|||||||
|
|
||||||
void kill_all_bash(struct arg_bash *arg){
|
void kill_all_bash(struct arg_bash *arg){
|
||||||
pthread_mutex_lock(arg->mut_bash_var);
|
pthread_mutex_lock(arg->mut_bash_var);
|
||||||
|
int ret_check_down_bash_new=-1;
|
||||||
|
int ret_check_down_bash_current=-1;
|
||||||
if(arg->fd_new_bash_pid > 0) {
|
if(arg->fd_new_bash_pid > 0) {
|
||||||
|
if(check_bash_down(arg->new_bash_pid) == 0){
|
||||||
close(arg->fd_new_bash_pid);
|
close(arg->fd_new_bash_pid);
|
||||||
kill(arg->new_bash_pid, SIGKILL);
|
kill(arg->new_bash_pid, SIGKILL);
|
||||||
|
ret_check_down_bash_new = 0;
|
||||||
|
}
|
||||||
arg->new_bash_pid = arg->old_bash_pid;
|
arg->new_bash_pid = arg->old_bash_pid;
|
||||||
arg->fd_new_bash_pid = -1;
|
arg->fd_new_bash_pid = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(arg->fd_current_bash_pid > 0 && arg->fd_current_bash_pid != arg->fd_new_bash_pid) {
|
if(arg->fd_current_bash_pid > 0 && arg->fd_current_bash_pid != arg->fd_new_bash_pid) {
|
||||||
|
if(check_bash_down(arg->current_bash_pid) == 0){
|
||||||
close(arg->fd_current_bash_pid);
|
close(arg->fd_current_bash_pid);
|
||||||
kill(arg->current_bash_pid, SIGKILL);
|
kill(arg->current_bash_pid, SIGKILL);
|
||||||
|
ret_check_down_bash_current = 0;
|
||||||
|
}
|
||||||
arg->current_bash_pid = arg->old_bash_pid;
|
arg->current_bash_pid = arg->old_bash_pid;
|
||||||
arg->fd_current_bash_pid=-1;
|
arg->fd_current_bash_pid=-1;
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(arg->mut_bash_var);
|
pthread_mutex_unlock(arg->mut_bash_var);
|
||||||
if(arg->thread_run_newbash){
|
if(arg->thread_run_newbash){
|
||||||
|
if(ret_check_down_bash_new == 0){
|
||||||
|
printf("debug: join thread_run_newbash\n");
|
||||||
pthread_join(*(arg->thread_run_newbash),NULL);
|
pthread_join(*(arg->thread_run_newbash),NULL);
|
||||||
|
}else
|
||||||
|
printf("debug: not join thread_run_newbash\n");
|
||||||
free(arg->thread_run_newbash);
|
free(arg->thread_run_newbash);
|
||||||
arg->thread_run_newbash=NULL;
|
arg->thread_run_newbash=NULL;
|
||||||
}
|
}
|
||||||
if(arg->thread_run_waitbash){
|
if(arg->thread_run_waitbash){
|
||||||
|
if(ret_check_down_bash_current == 0){
|
||||||
|
printf("debug: join thread_run_waitbash\n");
|
||||||
pthread_join(*(arg->thread_run_waitbash),NULL);
|
pthread_join(*(arg->thread_run_waitbash),NULL);
|
||||||
|
}else
|
||||||
|
printf("debug: not join thread_run_waitbash\n");
|
||||||
free(arg->thread_run_waitbash);
|
free(arg->thread_run_waitbash);
|
||||||
arg->thread_run_waitbash=NULL;
|
arg->thread_run_waitbash=NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -279,7 +279,7 @@ float df(float x){
|
|||||||
// **************************************************************
|
// **************************************************************
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
TEST(first_learn_vehicle_50__9){
|
TEST(_first_learn_vehicle_50__9){
|
||||||
size_t nb_block = 7;
|
size_t nb_block = 7;
|
||||||
size_t dim= 2;
|
size_t dim= 2;
|
||||||
struct blocks * path = create_blocks(nb_block, dim);
|
struct blocks * path = create_blocks(nb_block, dim);
|
||||||
@@ -364,12 +364,12 @@ struct status_qlearning *qlstatus = create_status_qlearning ();
|
|||||||
20/*long int nb_training_before_update_weight_in_target*/,
|
20/*long int nb_training_before_update_weight_in_target*/,
|
||||||
10000/*size_t number_episodes*/
|
10000/*size_t number_episodes*/
|
||||||
);
|
);
|
||||||
/*
|
|
||||||
UPDATE_ATTRIBUTE_NEURONE_IN_ALL_LAYERS(TYPE_FLOAT, nnetworks->main_net, d_f_act , df );
|
UPDATE_ATTRIBUTE_NEURONE_IN_ALL_LAYERS(TYPE_FLOAT, nnetworks->main_net, d_f_act , df );
|
||||||
UPDATE_ATTRIBUTE_NEURONE_IN_ALL_LAYERS(TYPE_FLOAT, nnetworks->main_net, f_act, f );
|
UPDATE_ATTRIBUTE_NEURONE_IN_ALL_LAYERS(TYPE_FLOAT, nnetworks->main_net, f_act, f );
|
||||||
UPDATE_ATTRIBUTE_NEURONE_IN_ALL_LAYERS(TYPE_FLOAT, nnetworks->target_net, d_f_act , df );
|
UPDATE_ATTRIBUTE_NEURONE_IN_ALL_LAYERS(TYPE_FLOAT, nnetworks->target_net, d_f_act , df );
|
||||||
UPDATE_ATTRIBUTE_NEURONE_IN_ALL_LAYERS(TYPE_FLOAT, nnetworks->target_net, f_act , f );
|
UPDATE_ATTRIBUTE_NEURONE_IN_ALL_LAYERS(TYPE_FLOAT, nnetworks->target_net, f_act , f );
|
||||||
*/
|
|
||||||
struct print_params *pprint = create_print_params(
|
struct print_params *pprint = create_print_params(
|
||||||
12/*float scale_x*/,12 /*float scale_y*/,
|
12/*float scale_x*/,12 /*float scale_y*/,
|
||||||
dly/*struct delay_params * dly_p*/
|
dly/*struct delay_params * dly_p*/
|
||||||
@@ -588,10 +588,164 @@ struct status_qlearning *qlstatus = create_status_qlearning ();
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
HIDE_TEST(_first_learn_vehicle_50__11_9){
|
||||||
|
size_t nb_block = 7;
|
||||||
|
size_t dim= 2;
|
||||||
|
struct blocks * path = create_blocks(nb_block, dim);
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
HIDE_TEST(first_learn_vehicle_50__11){
|
|
||||||
|
|
||||||
|
copy_coordinate(path->lower_bound_block[0], (float[]){0,0});
|
||||||
|
copy_coordinate(path->upper_bound_block[0], (float[]){100,250});
|
||||||
|
copy_coordinate(path->lower_bound_block[1], (float[]){100,0});
|
||||||
|
copy_coordinate(path->upper_bound_block[1], (float[]){250,80});
|
||||||
|
copy_coordinate(path->lower_bound_block[2], (float[]){250,0});
|
||||||
|
copy_coordinate(path->upper_bound_block[2], (float[]){360,140});
|
||||||
|
copy_coordinate(path->lower_bound_block[3], (float[]){360,70});
|
||||||
|
copy_coordinate(path->upper_bound_block[3], (float[]){600,140});
|
||||||
|
copy_coordinate(path->lower_bound_block[4], (float[]){600,90});
|
||||||
|
copy_coordinate(path->upper_bound_block[4], (float[]){720,300});
|
||||||
|
copy_coordinate(path->lower_bound_block[5], (float[]){300,300});
|
||||||
|
copy_coordinate(path->upper_bound_block[5], (float[]){720,350});
|
||||||
|
copy_coordinate(path->lower_bound_block[6], (float[]){0,250});
|
||||||
|
copy_coordinate(path->upper_bound_block[6], (float[]){410,300});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
copy_coordinate(path->lower_bound_block[0], (float[]){0,0});
|
||||||
|
copy_coordinate(path->upper_bound_block[0], (float[]){150,250});
|
||||||
|
copy_coordinate(path->lower_bound_block[1], (float[]){150,0});
|
||||||
|
copy_coordinate(path->upper_bound_block[1], (float[]){250,150});
|
||||||
|
copy_coordinate(path->lower_bound_block[2], (float[]){250,80});
|
||||||
|
copy_coordinate(path->upper_bound_block[2], (float[]){360,200});
|
||||||
|
copy_coordinate(path->lower_bound_block[3], (float[]){360,70});
|
||||||
|
copy_coordinate(path->upper_bound_block[3], (float[]){600,170});
|
||||||
|
copy_coordinate(path->lower_bound_block[4], (float[]){600,90});
|
||||||
|
copy_coordinate(path->upper_bound_block[4], (float[]){760,300});
|
||||||
|
copy_coordinate(path->lower_bound_block[5], (float[]){300,300});
|
||||||
|
copy_coordinate(path->upper_bound_block[5], (float[]){760,350});
|
||||||
|
copy_coordinate(path->lower_bound_block[6], (float[]){0,250});
|
||||||
|
copy_coordinate(path->upper_bound_block[6], (float[]){410,300});
|
||||||
|
|
||||||
|
|
||||||
|
///////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
copy_coordinate(path->lower_bound_block[0], (float[]){0,3});
|
||||||
|
copy_coordinate(path->upper_bound_block[0], (float[]){4,7});
|
||||||
|
copy_coordinate(path->lower_bound_block[1], (float[]){1,0});
|
||||||
|
copy_coordinate(path->upper_bound_block[1], (float[]){10,3});
|
||||||
|
copy_coordinate(path->lower_bound_block[2], (float[]){10,0.5});
|
||||||
|
copy_coordinate(path->upper_bound_block[2], (float[]){14,5});
|
||||||
|
copy_coordinate(path->lower_bound_block[3], (float[]){14,2});
|
||||||
|
copy_coordinate(path->upper_bound_block[3], (float[]){18,7});
|
||||||
|
copy_coordinate(path->lower_bound_block[4], (float[]){11,7});
|
||||||
|
copy_coordinate(path->upper_bound_block[4], (float[]){17,10});
|
||||||
|
copy_coordinate(path->lower_bound_block[5], (float[]){8,6});
|
||||||
|
copy_coordinate(path->upper_bound_block[5], (float[]){11,9.75});
|
||||||
|
copy_coordinate(path->lower_bound_block[6], (float[]){1,7});
|
||||||
|
copy_coordinate(path->upper_bound_block[6], (float[]){8,9.75});
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
update_bounds_limits_blocks(path);
|
||||||
|
|
||||||
|
struct vehicle *car = create_vehicle(path);
|
||||||
|
|
||||||
|
config_layers *pconf = create_config_layers_from_OneD(4,(size_t[]){3,24,24,3}); /* 3 input , 3 target; 2 hidden layer with 24 neurons each */
|
||||||
|
//config_layers *pconf = create_config_layers_from_OneD(4,(size_t[]){3,14,14,3}); /* 3 input , 3 target; 2 hidden layer with 24 neurons each */
|
||||||
|
|
||||||
|
bool randomize=true;
|
||||||
|
float minR = -0.5, maxR = 0.5;
|
||||||
|
int randomRange = 500;
|
||||||
|
size_t nb_prod_thread = 2;
|
||||||
|
size_t nb_calc_thread = 4;
|
||||||
|
float learning_rate = 0.00001 /* 0.001*/;
|
||||||
|
struct networks_qlearning *nnetworks = create_nework_qlearning(
|
||||||
|
pconf,
|
||||||
|
randomize, minR, maxR, randomRange,
|
||||||
|
nb_prod_thread, nb_calc_thread,
|
||||||
|
learning_rate
|
||||||
|
);
|
||||||
|
/*
|
||||||
|
EXTRACT_FILE_TO_TENSOR_ATTRIBUTE_NNEURONS(TYPE_FLOAT, nnetworks->main_net, weight_in, ".ff_main_20240717_01h42m16s_5300.txt");
|
||||||
|
EXTRACT_FILE_TO_TENSOR_ATTRIBUTE_NNEURONS(TYPE_FLOAT, nnetworks->target_net, weight_in, ".ff_target_20240717_01h42m16s_5300.txt");
|
||||||
|
*/
|
||||||
|
|
||||||
|
EXTRACT_FILE_TO_TENSOR_ATTRIBUTE_NNEURONS(TYPE_FLOAT, nnetworks->main_net, weight_in, ".ff_main_.symlink");
|
||||||
|
EXTRACT_FILE_TO_TENSOR_ATTRIBUTE_NNEURONS(TYPE_FLOAT, nnetworks->target_net, weight_in, ".ff_target_.symlink");
|
||||||
|
|
||||||
|
struct status_qlearning *qlstatus = create_status_qlearning ();
|
||||||
|
struct delay_params *dly = create_delay_params (
|
||||||
|
50000 /*size_t delay_between_episodes*/,
|
||||||
|
500/*size_t delay_between_games*/
|
||||||
|
);
|
||||||
|
|
||||||
|
struct qlearning_params *qlparams = create_qlearning_params (
|
||||||
|
0.95/*float gamma*/,
|
||||||
|
learning_rate,
|
||||||
|
0 /* (not used!)float discount_factor*/,
|
||||||
|
0.01/*0.99*/ /*float exploration_factor*/,
|
||||||
|
20/*long int nb_training_before_update_weight_in_target*/,
|
||||||
|
10000/*size_t number_episodes*/
|
||||||
|
);
|
||||||
|
/*
|
||||||
|
UPDATE_ATTRIBUTE_NEURONE_IN_ALL_LAYERS(TYPE_FLOAT, nnetworks->main_net, d_f_act , df );
|
||||||
|
UPDATE_ATTRIBUTE_NEURONE_IN_ALL_LAYERS(TYPE_FLOAT, nnetworks->main_net, f_act, f );
|
||||||
|
UPDATE_ATTRIBUTE_NEURONE_IN_ALL_LAYERS(TYPE_FLOAT, nnetworks->target_net, d_f_act , df );
|
||||||
|
UPDATE_ATTRIBUTE_NEURONE_IN_ALL_LAYERS(TYPE_FLOAT, nnetworks->target_net, f_act , f );
|
||||||
|
*/
|
||||||
|
struct print_params *pprint = create_print_params(
|
||||||
|
12/*float scale_x*/,12 /*float scale_y*/,
|
||||||
|
dly/*struct delay_params * dly_p*/
|
||||||
|
);
|
||||||
|
|
||||||
|
struct RL_agent *rlAgent = create_RL_agent (
|
||||||
|
nnetworks /*struct networks_qlearning * networks*/,
|
||||||
|
car /*struct vehicle * car*/,
|
||||||
|
qlstatus /*struct status_qlearning * status*/,
|
||||||
|
pprint /*struct print_params * pprint*/,
|
||||||
|
qlparams/*struct qlearning_params *qlearnParams*/
|
||||||
|
);
|
||||||
|
|
||||||
|
//pthread_t thread_learn;
|
||||||
|
//pthread_create(&thread_learn, NULL, learn_to_drive, (void*)rlAgent);
|
||||||
|
//learn_to_drive(rlAgent);
|
||||||
|
|
||||||
|
struct arg_bash *bash_arg= create_arg_bash();
|
||||||
|
|
||||||
|
struct arg_run_qlearn_bprint *argQL_BP = create_arg_run_qlearn_bprint(bash_arg, rlAgent);
|
||||||
|
|
||||||
|
struct arg_var_ * var = create_arg_var_(y_nnn_manager_handle_input, argQL_BP);
|
||||||
|
struct y_socket_t *argS = y_socket_create("1600", 2, 3, var);
|
||||||
|
|
||||||
|
|
||||||
|
pthread_t pollTh;
|
||||||
|
pthread_create(&pollTh, NULL, y_socket_poll_fds, (void*)argS);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
pthread_join(pollTh, NULL);
|
||||||
|
//pthread_join(thread_learn, NULL);
|
||||||
|
|
||||||
|
y_socket_free(argS);
|
||||||
|
free_arg_var_(var);
|
||||||
|
free_arg_run_qlearn_bprint(argQL_BP);
|
||||||
|
//free_arg_bash(bash_arg);
|
||||||
|
//free_RL_agent(rlAgent);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 1
|
||||||
|
HIDE_TEST(_first_learn_vehicle_50__11){
|
||||||
size_t nb_block = 7;
|
size_t nb_block = 7;
|
||||||
size_t dim= 2;
|
size_t dim= 2;
|
||||||
struct blocks * path = create_blocks(nb_block, dim);
|
struct blocks * path = create_blocks(nb_block, dim);
|
||||||
@@ -712,8 +866,10 @@ EXTRACT_FILE_TO_TENSOR_ATTRIBUTE_NNEURONS(TYPE_FLOAT, nnetworks->main_net, weigh
|
|||||||
EXTRACT_FILE_TO_TENSOR_ATTRIBUTE_NNEURONS(TYPE_FLOAT, nnetworks->target_net, weight_in, ".ff_target_20240717_01h42m16s_5300.txt");
|
EXTRACT_FILE_TO_TENSOR_ATTRIBUTE_NNEURONS(TYPE_FLOAT, nnetworks->target_net, weight_in, ".ff_target_20240717_01h42m16s_5300.txt");
|
||||||
*/
|
*/
|
||||||
|
|
||||||
EXTRACT_FILE_TO_TENSOR_ATTRIBUTE_NNEURONS(TYPE_FLOAT, nnetworks->main_net, weight_in, ".ff_main_20250508_17h50m56s_26300.txt");
|
//EXTRACT_FILE_TO_TENSOR_ATTRIBUTE_NNEURONS(TYPE_FLOAT, nnetworks->main_net, weight_in, ".ff_main_20250508_17h50m56s_26300.txt");
|
||||||
EXTRACT_FILE_TO_TENSOR_ATTRIBUTE_NNEURONS(TYPE_FLOAT, nnetworks->target_net, weight_in, ".ff_target_20250508_17h50m56s_26300.txt");
|
//EXTRACT_FILE_TO_TENSOR_ATTRIBUTE_NNEURONS(TYPE_FLOAT, nnetworks->target_net, weight_in, ".ff_target_20250508_17h50m56s_26300.txt");
|
||||||
|
EXTRACT_FILE_TO_TENSOR_ATTRIBUTE_NNEURONS(TYPE_FLOAT, nnetworks->main_net, weight_in, ".ff_main_.symlink");
|
||||||
|
EXTRACT_FILE_TO_TENSOR_ATTRIBUTE_NNEURONS(TYPE_FLOAT, nnetworks->target_net, weight_in, ".ff_target_.symlink");
|
||||||
/*
|
/*
|
||||||
EXTRACT_FILE_TO_TENSOR_ATTRIBUTE_NNEURONS(TYPE_FLOAT, nnetworks->main_net, weight_in, ".ff_main_20250508_23h02m40s_29000.txt");
|
EXTRACT_FILE_TO_TENSOR_ATTRIBUTE_NNEURONS(TYPE_FLOAT, nnetworks->main_net, weight_in, ".ff_main_20250508_23h02m40s_29000.txt");
|
||||||
EXTRACT_FILE_TO_TENSOR_ATTRIBUTE_NNEURONS(TYPE_FLOAT, nnetworks->target_net, weight_in, ".ff_target_20250508_23h02m40s_29000.txt");
|
EXTRACT_FILE_TO_TENSOR_ATTRIBUTE_NNEURONS(TYPE_FLOAT, nnetworks->target_net, weight_in, ".ff_target_20250508_23h02m40s_29000.txt");
|
||||||
@@ -751,9 +907,33 @@ struct status_qlearning *qlstatus = create_status_qlearning ();
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
learn_to_drive(rlAgent);
|
//learn_to_drive(rlAgent);
|
||||||
|
//learn_to_drive(rlAgent);
|
||||||
|
|
||||||
free_RL_agent(rlAgent);
|
struct arg_bash *bash_arg= create_arg_bash();
|
||||||
|
|
||||||
|
struct arg_run_qlearn_bprint *argQL_BP = create_arg_run_qlearn_bprint(bash_arg, rlAgent);
|
||||||
|
|
||||||
|
struct arg_var_ * var = create_arg_var_(y_nnn_manager_handle_input, argQL_BP);
|
||||||
|
struct y_socket_t *argS = y_socket_create("1600", 2, 3, var);
|
||||||
|
|
||||||
|
|
||||||
|
pthread_t pollTh;
|
||||||
|
pthread_create(&pollTh, NULL, y_socket_poll_fds, (void*)argS);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
pthread_join(pollTh, NULL);
|
||||||
|
//pthread_join(thread_learn, NULL);
|
||||||
|
|
||||||
|
y_socket_free(argS);
|
||||||
|
free_arg_var_(var);
|
||||||
|
free_arg_run_qlearn_bprint(argQL_BP);
|
||||||
|
//free_RL_agent(rlAgent);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -892,8 +1072,8 @@ copy_coordinate(path->lower_bound_block[0], (float[]){0,0});
|
|||||||
EXTRACT_FILE_TO_TENSOR_ATTRIBUTE_NNEURONS(TYPE_FLOAT, nnetworks->main_net, weight_in, ".ff_main_20240717_09h11m09s_1700.txt");
|
EXTRACT_FILE_TO_TENSOR_ATTRIBUTE_NNEURONS(TYPE_FLOAT, nnetworks->main_net, weight_in, ".ff_main_20240717_09h11m09s_1700.txt");
|
||||||
EXTRACT_FILE_TO_TENSOR_ATTRIBUTE_NNEURONS(TYPE_FLOAT, nnetworks->target_net, weight_in, ".ff_target_20240717_09h11m09s_1700.txt");
|
EXTRACT_FILE_TO_TENSOR_ATTRIBUTE_NNEURONS(TYPE_FLOAT, nnetworks->target_net, weight_in, ".ff_target_20240717_09h11m09s_1700.txt");
|
||||||
*/
|
*/
|
||||||
EXTRACT_FILE_TO_TENSOR_ATTRIBUTE_NNEURONS(TYPE_FLOAT, nnetworks->main_net, weight_in, ".ff_main_20250508_17h50m56s_26300.txt");
|
EXTRACT_FILE_TO_TENSOR_ATTRIBUTE_NNEURONS(TYPE_FLOAT, nnetworks->main_net, weight_in, ".ff_main_.symlink");
|
||||||
EXTRACT_FILE_TO_TENSOR_ATTRIBUTE_NNEURONS(TYPE_FLOAT, nnetworks->target_net, weight_in, ".ff_target_20250508_17h50m56s_26300.txt");
|
EXTRACT_FILE_TO_TENSOR_ATTRIBUTE_NNEURONS(TYPE_FLOAT, nnetworks->target_net, weight_in, ".ff_target_.symlink");
|
||||||
|
|
||||||
struct status_qlearning *qlstatus = create_status_qlearning ();
|
struct status_qlearning *qlstatus = create_status_qlearning ();
|
||||||
struct delay_params *dly = create_delay_params (
|
struct delay_params *dly = create_delay_params (
|
||||||
@@ -928,9 +1108,34 @@ struct status_qlearning *qlstatus = create_status_qlearning ();
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
learn_to_drive(rlAgent);
|
//learn_to_drive(rlAgent);
|
||||||
|
|
||||||
free_RL_agent(rlAgent);
|
struct arg_bash *bash_arg= create_arg_bash();
|
||||||
|
|
||||||
|
struct arg_run_qlearn_bprint *argQL_BP = create_arg_run_qlearn_bprint(bash_arg, rlAgent);
|
||||||
|
|
||||||
|
struct arg_var_ * var = create_arg_var_(y_nnn_manager_handle_input, argQL_BP);
|
||||||
|
struct y_socket_t *argS = y_socket_create("1600", 2, 3, var);
|
||||||
|
|
||||||
|
|
||||||
|
pthread_t pollTh;
|
||||||
|
pthread_create(&pollTh, NULL, y_socket_poll_fds, (void*)argS);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
pthread_join(pollTh, NULL);
|
||||||
|
//pthread_join(thread_learn, NULL);
|
||||||
|
|
||||||
|
y_socket_free(argS);
|
||||||
|
free_arg_var_(var);
|
||||||
|
free_arg_run_qlearn_bprint(argQL_BP);
|
||||||
|
|
||||||
|
|
||||||
|
//free_RL_agent(rlAgent);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user