Index: applications/robust/main.cpp
===================================================================
--- applications/robust/main.cpp (revision 1390)
+++ applications/robust/main.cpp (revision 1393)
@@ -27,5 +27,5 @@
 //const int utility_constant = 5;
 
-const int max_model_order = 2;
+const int max_model_order = 1;
 const double apriorno     = 0.01;
 
@@ -81,4 +81,5 @@
 	mat* data_matrix;
 	vec  predictions;
+	char name[80];
 	
 	model(set<pair<int,int>> ar_components, //funkcie treidz model-konstruktor
@@ -90,5 +91,26 @@
 	{
 		this->ar_components.insert(ar_components.begin(),ar_components.end());
+
+		strcpy(name,"M");
+
+		for(set<pair<int,int>>::iterator ar_ref = ar_components.begin();ar_ref!=ar_components.end();ar_ref++)
+		{
+			char buffer1[2];
+			char buffer2[2];
+			itoa((*ar_ref).first,buffer1,10);
+			itoa((*ar_ref).second,buffer2,10);
+
+			strcat(name,buffer1);
+			strcat(name,buffer2);
+			strcat(name,"_");
+		}
+
 		this->has_constant      = has_constant;
+
+		if(has_constant)
+		{
+			strcat(name,"C");
+		}
+
 		this->window_size       = window_size;
 		this->predicted_channel = predicted_channel;
@@ -97,4 +119,6 @@
 		if(robust)
 		{
+			strcat(name,"R");
+
 			if(has_constant)
 			{
@@ -168,5 +192,5 @@
 			pair<vec,mat> imp_samples = my_rarx->posterior->importance_sample(sample_size);
 
-			//cout << imp_samples.first << endl;
+			//cout << imp_samples.first << endl;			
 			
 			vec sample_prediction;			
@@ -180,5 +204,5 @@
 				}
 				
-				lap_sample.ins(0,(*LapRNG)());
+				lap_sample.ins(lap_sample.size(),(*LapRNG)());
 
 				sample_prediction.ins(0,lap_sample*imp_samples.second.get_col(t));				
@@ -186,5 +210,5 @@
 
 			return pair<vec,vec>(imp_samples.first,sample_prediction);
-		}
+		}	
 		else
 		{
@@ -274,5 +298,5 @@
 	vector<vector<string>> strings;
 
-	char* file_string =  "C:\\dataADClosePercDiff"; // "C:\\ar_student_single"; // 
+	char* file_string =  "C:\\results\\ar_student_single"; // "C:\\dataADClosePercDiff"; //  
 
 	char dfstring[80];
@@ -330,8 +354,8 @@
 
 	ofstream myfilew;
-	char fstring[80];					
-	strcpy(fstring,file_string);
+	//char fstring[80];					
+	//strcpy(fstring,file_string);
 	//strcat(fstring,"lognc.txt");
-	strcat(fstring,"preds.txt");
+	//strcat(fstring,"preds.txt");	
 
 	for(int time = max_model_order;time<data_matrix.cols();time++) //time<data_matrix.cols() 
@@ -347,5 +371,5 @@
 			//if (time = max_model_order) nazvy.push_back(models.model_ref]);// ako by som mohol dostat nazov modelu?
 
-			if((*model_ref)->my_rarx!=NULL)	//vklada normalizacnz faktor do cur_res_lognc
+			if((*model_ref)->my_rarx!=NULL)	//vklada normalizacni faktor do cur_res_lognc
 			{
 				cur_res_lognc.ins(cur_res_lognc.size(),(*model_ref)->my_rarx->posterior->_ll());				
@@ -356,4 +380,31 @@
 			}
 
+			int sample_size = 10;
+			pair<vec,mat> samples;
+			if((*model_ref)->my_arx!=NULL)
+			{
+				mat samp_mat = (*model_ref)->my_arx->posterior().sample_mat(sample_size);
+				samples = pair<vec,mat>(ones(samp_mat.rows()),samp_mat);
+			}
+			else
+			{
+				samples = (*model_ref)->my_rarx->posterior->importance_sample(sample_size);
+			}
+			
+			for(int i=0;i<(*model_ref)->ar_components.size()+1;i++)
+			{
+				char fstring[80];					
+				strcpy(fstring,file_string);
+				strcat(fstring,(*model_ref)->name);
+				strcat(fstring,".txt");
+				
+				cout << samples.first << endl;
+				
+				myfilew.open(fstring,ios::app);
+				myfilew << samples.first << endl << samples.second << endl << zeros(samples.first.size()) << endl; 
+				myfilew.close();
+			}			
+			
+			/* // PREDICTIONS
 			pair<vec,vec> predictions = (*model_ref)->predict(500,time,&LapRNG);
 
@@ -363,10 +414,9 @@
 
 			(*model_ref)->predictions.ins((*model_ref)->predictions.size(),avg_prediction);
-			
-			
+					
 			myfilew.open(fstring,ios::app);
-			myfilew << avg_prediction << ",";
+			myfilew << avg_prediction << ","; 
 			myfilew.close();
-			
+			*/
 
 			//preds.ins(0,data_matrix.get(0,time+1));
@@ -374,8 +424,9 @@
 
 		
+		/* // REAL PRICE
 		myfilew.open(fstring,ios::app);
 		myfilew << data_matrix.get(0,time+1) << endl;
 		myfilew.close();
-		
+		*/
 
 		result_lognc.ins_col(result_lognc.cols(),cur_res_lognc);
@@ -384,5 +435,5 @@
 		// cout << "Updated." << endl;	
 							
-
+		/*
 		myfilew.open(fstring,ios::app);
 		
@@ -424,14 +475,15 @@
 		}
 		
-		/*
-		for(int i = 0;i<cur_res_lognc.size();i++)
-		{
-			myfilew << cur_res_lognc[i] << ' ';//zmenil som ciarku ze medzeru
-		}
+		
+		// for(int i = 0;i<cur_res_lognc.size();i++)
+		// {
+		// 	   myfilew << cur_res_lognc[i] << ' ';//zmenil som ciarku ze medzeru
+		// }
+		
+
+		myfilew << endl;				
+		
+		myfilew.close();
 		*/
-
-		myfilew << endl;				
-		
-		myfilew.close();
 		
 }
