<commit_before>#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "SarsaAgent.h"
#include "Glue_utilities.h"

#define NUM_STATES 114
#define NUM_ACTIONS 4

Action action;
Action previous_action;
Observation previous_observation;
double value[NUM_STATES][NUM_ACTIONS];
double sarsa_alpha = 0.1;
double sarsa_gamma = 0.9;
int freeze = 0;

void agent_init(const Task_specification task_spec)
{
  task_spec_struct tss;

  srand(time(NULL));

	printf("task_spec is: %s\n", task_spec);
  
  parse_task_spec(task_spec, &tss);

  action.numInts     =  tss.num_discrete_action_dims;
  action.intArray    = (int*)malloc(sizeof(int)*action.numInts);
  action.numDoubles  = tss.num_continuous_action_dims;
  action.doubleArray = 0;

  previous_action.numInts     = tss.num_discrete_action_dims;
  previous_action.intArray    = (int*)malloc(sizeof(int)*previous_action.numInts);
  previous_action.numDoubles  = tss.num_continuous_action_dims;
  previous_action.doubleArray = 0;

  previous_observation.numInts     = tss.num_discrete_obs_dims;
  previous_observation.intArray    = (int*)malloc(sizeof(int)*previous_observation.numInts);
  previous_observation.numDoubles  = tss.num_continuous_obs_dims;
  previous_observation.doubleArray = 0;

  memset(value, 0, sizeof(double)*114*4);
}

Action agent_start(Observation o)<commit_msg>Making myself up to date<commit_after>#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "SarsaAgent.h"
#include "Glue_utilities.h"

#define NUM_STATES 114
#define NUM_ACTIONS 4

Action action;
Action previous_action;
Observation previous_observation;
double value[NUM_STATES][NUM_ACTIONS];
double sarsa_alpha = 0.1;
double sarsa_gamma = 0.9;
int freeze = 0;

void agent_init(const Task_specification task_spec)
{
  task_spec_struct tss;
  srand(time(NULL));

  printf("task_spec is: %s\n", task_spec);
  
  parse_task_spec(task_spec, &tss);

  action.numInts     =  tss.num_discrete_action_dims;
  action.intArray    = (int*)malloc(sizeof(int)*action.numInts);
  action.numDoubles  = tss.num_continuous_action_dims;
  action.doubleArray = 0;

  previous_action.numInts     = tss.num_discrete_action_dims;
  previous_action.intArray    = (int*)malloc(sizeof(int)*previous_action.numInts);
  previous_action.numDoubles  = tss.num_continuous_action_dims;
  previous_action.doubleArray = 0;

  previous_observation.numInts     = tss.num_discrete_obs_dims;
  previous_observation.intArray    = (int*)malloc(sizeof(int)*previous_observation.numInts);
  previous_observation.numDoubles  = tss.num_continuous_obs_dims;
  previous_observation.doubleArray = 0;

  memset(value, 0, sizeof(double)*114*4);
}

Action agent_start(Observation o)
{'fraction_non_alphanumeric': 0.10951855935317897, 'fraction_numerical': 0.012495406100698273, 'mean_word_length': 5.891139240506329, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6879041', 'n_tokens_mistral': 1043, 'n_tokens_neox': 1001, 'n_words': 159}