At the beginning of my code I query the user if he/she wants to import data from file, but the code never gets past the cin-part. I have to manually terminate the process from there. The printf-statement never executes and when I look at my system monitor in Gnome it shows a huge memory leakage (from 120Mb to ~730Mb). My DRAM is 768 Mb on my machine. What could be the problem, anyone?
Code:
Code: Select all
.
.
.
int main() {
float Q[N_STATES][N_ACTIONS]; // State-action pair table
char ans; // Query for save and load data.
/* Seed the random generator */
srand48(time(0));
/* Initialize the Q-table */
cout << "Read data from file? (y/n) : "; <----- I know it get's here
cin >> ans;
printf("bajs"); <----- Never gets here
if (ans == 'y')
loadData(Q);
else
init(Q);
/* Do Q-learning algorithm */
oneStepQ(Q);
/* Store "experience" */
cout << "Store data on file? (y/n) : ";
cin >> ans;
if (ans == 'y')
saveData(Q);
return 0;
}
.
.
.
Code: Select all
$ ./detach_left
Read data from file? (y/n) : n

