deepQlearning: add libdeepqlearn.so, debug some issue with -Werror -fpic
This commit is contained in:
@@ -45,7 +45,7 @@ struct networks_qlearning * create_nework_qlearning(
|
||||
struct networks_qlearning *qnets = malloc(sizeof(struct networks_qlearning));
|
||||
qnets->config = config;
|
||||
|
||||
setup_networks_alloutputs_config_TYPE_FLOAT(&(qnets->main_net), config, random, minR, maxR, randomRange);
|
||||
setup_networks_alloutputs_config_TYPE_FLOAT(&(qnets->main_net), config, randomize, minR, maxR, randomRange);
|
||||
setup_networks_alloutputs_config_TYPE_FLOAT(&(qnets->target_net), config, false, minR, maxR, randomRange);
|
||||
copy_weight_in_networks_from_main_to_target(qnets);
|
||||
|
||||
@@ -283,7 +283,7 @@ int select_action(struct RL_agent * rlAgent){
|
||||
//init =false;
|
||||
//}
|
||||
//int random = xrand() % randRange;
|
||||
float proba_explor = (float) (xrand() % (1<<17 -1))/ (1<<17 -1); //frand(); //(float)(random ) / randRange;
|
||||
float proba_explor = (float) (xrand() % ((1<<17) -1))/ ((1<<17) -1); //frand(); //(float)(random ) / randRange;
|
||||
if(proba_explor > rlAgent->qlearnParams->exploration_factor ){
|
||||
action = ARG_MAX_ARRAY_TYPE_FLOAT( action_value->x, action_value->dim->rank );
|
||||
//if(action == ARG_MIN_ARRAY_TYPE_FLOAT( action_value->x, action_value->dim->rank ))
|
||||
@@ -385,7 +385,7 @@ void learn_to_drive(struct RL_agent * rlAgent){
|
||||
struct game_status * car_status = car->status;
|
||||
struct qlearning_params * qlParams = rlAgent->qlearnParams;
|
||||
struct status_qlearning * qlStatus = rlAgent->status;
|
||||
struct print_params * pprint = rlAgent->pprint;
|
||||
//struct print_params * pprint = rlAgent->pprint;
|
||||
char msg[100];
|
||||
|
||||
pthread_t threadPrint;
|
||||
|
||||
@@ -20,6 +20,7 @@ struct game_status * create_game_status(){
|
||||
status->reward = 0;
|
||||
status->cumulative_reward = 0;
|
||||
status->done = false;
|
||||
return status;
|
||||
}
|
||||
|
||||
coordinate * create_coordinate(size_t dim_size){
|
||||
@@ -423,13 +424,12 @@ float distance2_coordinate(coordinate *c0, coordinate *c1){
|
||||
v->sensor->x[position] = (float)(MIN((SUBDIVISION-1),dist))/SUBDIVISION ;\
|
||||
|
||||
|
||||
|
||||
//v->sensor->x[position] = (float)(MIN((SUBDIVISION-1),(int)dist))/SUBDIVISION ;\
|
||||
|
||||
|
||||
//v->sensor->x[position] = (MIN(49,(distance2_coordinate(diStep_sensor, v->coord)/5))) ;\
|
||||
//v->sensor->x[position] = (MIN(49,(distance2_coordinate(diStep_sensor, v->coord)))) / 50;\
|
||||
//v->sensor->x[position] = (MIN(49,(int)(distance2_coordinate(diStep_sensor, v->coord)/10))) / 50;\
|
||||
#if 0
|
||||
//v->sensor->x[position] = (float)(MIN((SUBDIVISION-1),(int)dist))/SUBDIVISION ;
|
||||
//v->sensor->x[position] = (MIN(49,(distance2_coordinate(diStep_sensor, v->coord)/5))) ;
|
||||
//v->sensor->x[position] = (MIN(49,(distance2_coordinate(diStep_sensor, v->coord)))) / 50;
|
||||
//v->sensor->x[position] = (MIN(49,(int)(distance2_coordinate(diStep_sensor, v->coord)/10))) / 50;
|
||||
#endif
|
||||
|
||||
void read_sensor(struct vehicle *v){
|
||||
copy_tensor_TYPE_FLOAT(v->old_sensor, v->sensor);
|
||||
|
||||
@@ -378,22 +378,22 @@ void signedvCoordFromLin(long int *ret, long int line, dimension *dim ){
|
||||
long int* signedCoordFromLin(long int line, dimension *dim){
|
||||
long int *ret;
|
||||
ret=malloc(dim->size*sizeof(long int));
|
||||
vCoordFromLin(ret,line,dim);
|
||||
signedvCoordFromLin(ret,line,dim);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* */
|
||||
/* unsigned */
|
||||
size_t LineFromCoord(size_t *coo, dimension *dim) {
|
||||
return signedLineFromCoord(coo,dim);
|
||||
return (long)signedLineFromCoord((long*)coo,dim);
|
||||
}
|
||||
|
||||
void vCoordFromLin(size_t *ret, size_t line, dimension *dim ){
|
||||
signedvCoordFromLin(ret, line, dim);
|
||||
signedvCoordFromLin((long*)ret, (long)line, dim);
|
||||
}
|
||||
|
||||
size_t* CoordFromLin(size_t line, dimension *dim){
|
||||
return signedCoordFromLin(line, dim);
|
||||
return (size_t*)signedCoordFromLin((long)line, dim);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -51,9 +51,9 @@ size_t LineFromCoord(size_t *coo, dimension *dim);
|
||||
size_t* CoordFromLin(size_t line, dimension *dim);
|
||||
void vCoordFromLin(size_t *ret, size_t line, dimension *dim );
|
||||
|
||||
long int signedLineFromCoord(long int *coo, dimension *dim);
|
||||
long int* signedCoordFromLin(long int line, dimension *dim);
|
||||
void signedvCoordFromLin(long int *ret, long int line, dimension *dim );
|
||||
long int signedLineFromCoord(long *coo, dimension *dim);
|
||||
long int* signedCoordFromLin(long line, dimension *dim);
|
||||
void signedvCoordFromLin(long *ret, long int line, dimension *dim );
|
||||
|
||||
|
||||
void increment_dim_var(dimension *d);
|
||||
|
||||
@@ -768,11 +768,11 @@ neurons_##type * calculate_output_by_network_neurons_##type(neurons_##type *base
|
||||
if(tmp->next_layer==NULL){\
|
||||
/*print_tensor_msg_##type(tmp->output,"retult");*/\
|
||||
*output_link = tmp->output;\
|
||||
\
|
||||
return tmp;\
|
||||
}\
|
||||
tmp = tmp->next_layer;\
|
||||
}\
|
||||
return NULL;\
|
||||
\
|
||||
}\
|
||||
void print_predict_by_network_neurons_##type(neurons_##type *base, tensor_##type *input){\
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "neuron_t/neuron_t.h"
|
||||
#include "tensor_t/tensor_t.h"
|
||||
|
||||
//#define GEN_TYPE_FILE_NN(type)\
|
||||
//#define GEN_TYPE_FILE_NN(type)
|
||||
//void export_to_file_weight_in_nneurons_##type(char *fileName, neurons_##type *src);
|
||||
|
||||
#define EXPORT_TO_FILE_TENSOR_ATTRIBUTE_IN_NNEURONS(type,nneurons ,attribute, file_name) \
|
||||
|
||||
Reference in New Issue
Block a user