root/applications/robust/main.cpp @ 1396

Revision 1396, 17.7 kB (checked in by sindj, 13 years ago)

Sampling finished. First experiments set up properly - sampling from posterior on parameters. JS

RevLine 
[976]1
2/*!
3\file
4\brief Robust
5\author Vasek Smidl
6
7 */
8
[1337]9#include "estim/arx.h"
[976]10#include "robustlib.h"
[1216]11#include <vector>
[1284]12#include <iostream>
[1282]13#include <fstream>
[1376]14//#include <itpp/itsignal.h>
[1361]15#include "windows.h"
16#include "ddeml.h"
17#include "stdio.h"
[1282]18
[1361]19//#include "DDEClient.h"
20//#include <conio.h>
[1358]21
[1361]22
[1208]23using namespace itpp;
[1337]24using namespace bdm;
[976]25
[1361]26//const int emlig_size = 2;
27//const int utility_constant = 5;
[1268]28
[1393]29const int max_model_order = 1;
[1389]30const double apriorno     = 0.01;
[1396]31const int max_window_size = 121;
[1272]32
[1376]33/*
[1361]34HDDEDATA CALLBACK DdeCallback(
[1376]35        UINT uType,     // Transaction type.
36        UINT uFmt,      // Clipboard data format.
37        HCONV hconv,    // Handle to the conversation.
38        HSZ hsz1,       // Handle to a string.
39        HSZ hsz2,       // Handle to a string.
40        HDDEDATA hdata, // Handle to a global memory object.
41        DWORD dwData1,  // Transaction-specific data.
42        DWORD dwData2)  // Transaction-specific data.
[1361]43{
[1376]44        return 0;
[1361]45}
46
47void DDERequest(DWORD idInst, HCONV hConv, char* szItem)
48{
49        HSZ hszItem = DdeCreateStringHandle(idInst, szItem, 0);
50        HDDEDATA hData = DdeClientTransaction(NULL,0,hConv,hszItem,CF_TEXT,
[1365]51                                                                        XTYP_ADVSTART,TIMEOUT_ASYNC , NULL); //TIMEOUT_ASYNC
[1361]52        if (hData==NULL)
53        {
54                printf("Request failed: %s\n", szItem);
55        }
56
57        if (hData==0)
58        {
59                printf("Request failed: %s\n", szItem);
60        }
61}
62
[1367]63DWORD WINAPI ThrdFunc( LPVOID n )
64{   
65    return 0;
66}
[1376]67*/
[1367]68
[1361]69class model
70{
71public:
[1376]72        set<pair<int,int>> ar_components;
[1358]73
[1361]74        // Best thing would be to inherit the two models from a single souce, this is planned, but now structurally
75        // problematic.
[1376]76        RARX* my_rarx; //vzmenovane parametre pre triedu model
[1379]77        ARXwin* my_arx;
[1361]78
79        bool has_constant;
[1376]80        int  window_size;  //musi byt vacsia ako pocet krokov ak to nema ovplyvnit
[1361]81        int  predicted_channel;
82        mat* data_matrix;
[1383]83        vec  predictions;
[1393]84        char name[80];
[1361]85       
[1376]86        model(set<pair<int,int>> ar_components, //funkcie treidz model-konstruktor
[1361]87                  bool robust, 
88                  bool has_constant, 
89                  int window_size, 
[1376]90                  int predicted_channel,
[1361]91                  mat* data_matrix)
[1358]92        {
[1376]93                this->ar_components.insert(ar_components.begin(),ar_components.end());
[1393]94
95                strcpy(name,"M");
96
97                for(set<pair<int,int>>::iterator ar_ref = ar_components.begin();ar_ref!=ar_components.end();ar_ref++)
98                {
99                        char buffer1[2];
100                        char buffer2[2];
101                        itoa((*ar_ref).first,buffer1,10);
102                        itoa((*ar_ref).second,buffer2,10);
103
104                        strcat(name,buffer1);
105                        strcat(name,buffer2);
106                        strcat(name,"_");
107                }
108
[1376]109                this->has_constant      = has_constant;
[1393]110
111                if(has_constant)
112                {
113                        strcat(name,"C");
114                }
115
[1376]116                this->window_size       = window_size;
117                this->predicted_channel = predicted_channel;
118                this->data_matrix       = data_matrix;
[1361]119
120                if(robust)
121                {
[1393]122                        strcat(name,"R");
123
[1361]124                        if(has_constant)
125                        {
[1395]126                                my_rarx = new RARX(ar_components.size()+1,window_size,true,sqrt(2*apriorno),sqrt(2*apriorno),ar_components.size()+4);
[1361]127                                my_arx  = NULL;
128                        }
[1376]129                else
[1361]130                        {
[1395]131                                my_rarx = new RARX(ar_components.size(),window_size,false,sqrt(2*apriorno),sqrt(2*apriorno),ar_components.size()+3);
[1361]132                                my_arx  = NULL;
133                        }
134                }
135                else
136                {
137                        my_rarx = NULL;
[1379]138                        my_arx  = new ARXwin();
[1361]139                        mat V0;
140
141                        if(has_constant)
142                        {                               
[1376]143                                V0  = apriorno * eye(ar_components.size()+2); //aj tu konst
[1384]144                                //V0(0,0) = 0;
[1379]145                                my_arx->set_constant(true);                             
[1361]146                        }
147                        else
148                        {
149                               
[1376]150                                V0  = apriorno * eye(ar_components.size()+1);//menit konstantu
[1396]151                                //V0(0,1) = -0.01;
152                                //V0(1,0) = -0.01;
[1361]153                                my_arx->set_constant(false);                           
154                               
155                        }
156
[1384]157                        my_arx->set_statistics(1, V0, V0.rows()+2);                     
[1379]158                        my_arx->set_parameters(window_size);
[1361]159                        my_arx->validate();
[1396]160
161                        vec mean = my_arx->posterior().mean();
162                        cout << mean << endl;
[1361]163                }
[1358]164        }
[1361]165
[1376]166        void data_update(int time) //vlozime cas a ono vlozi do data_vector podmineky(conditions) a predikce, ktore pouzije do bayes
[1358]167        {
[1376]168                vec data_vector;
169                for(set<pair<int,int>>::iterator ar_iterator = ar_components.begin();ar_iterator!=ar_components.end();ar_iterator++)
170                {  //ar?iterator ide len od 1 pod 2, alebo niekedy len 1
171                        data_vector.ins(data_vector.size(),(*data_matrix).get(ar_iterator->first,time-ar_iterator->second));
172// do data vector vlozi pre dany typ regresoru prislusne cisla z data_matrix. Ale ako? preco time-ar_iterator->second?
[1358]173                }
[1376]174                if(my_rarx!=NULL)
[1383]175                {       //pre robust priradi az tu do data_vector aj predikciu
[1376]176                        data_vector.ins(0,(*data_matrix).get(predicted_channel,time));
177                        my_rarx->bayes(data_vector);
178                }
[1358]179                else
180                {
[1376]181                        vec pred_vec;//tu sa predikcia zadava zvlast
182                        pred_vec.ins(0,(*data_matrix).get(predicted_channel,time));
183                        my_arx->bayes(pred_vec,data_vector);
[1361]184                }
185        }
186
[1376]187        pair<vec,vec> predict(int sample_size, int time, itpp::Laplace_RNG* LapRNG)  //nerozumiem, ale vraj to netreba, nepouziva to
[1367]188        {
[1376]189                vec condition_vector;
190                for(set<pair<int,int>>::iterator ar_iterator = ar_components.begin();ar_iterator!=ar_components.end();ar_iterator++)
[1367]191                {
[1376]192                        condition_vector.ins(condition_vector.size(),(*data_matrix).get(ar_iterator->first,time-ar_iterator->second+1));
193                }
[1367]194
[1376]195                if(my_rarx!=NULL)
196                {
[1396]197                        pair<vec,mat> imp_samples = my_rarx->posterior->sample(sample_size,false);
[1367]198
[1393]199                        //cout << imp_samples.first << endl;                   
[1376]200                       
201                        vec sample_prediction;                 
202                        for(int t = 0;t<sample_size;t++)
[1367]203                        {
[1376]204                                vec lap_sample = condition_vector;
[1367]205                               
[1376]206                                if(has_constant)
[1367]207                                {
[1376]208                                        lap_sample.ins(lap_sample.size(),1.0);
[1367]209                                }
[1376]210                               
[1393]211                                lap_sample.ins(lap_sample.size(),(*LapRNG)());
[1367]212
[1376]213                                sample_prediction.ins(0,lap_sample*imp_samples.second.get_col(t));                             
[1367]214                        }
215
[1376]216                        return pair<vec,vec>(imp_samples.first,sample_prediction);
[1393]217                }       
[1376]218                else
219                {
[1383]220                        mat samples = my_arx->posterior().sample_mat(sample_size);                     
[1376]221                       
222                        vec sample_prediction;
223                        for(int t = 0;t<sample_size;t++)
224                        {
225                                vec gau_sample = condition_vector;
[1367]226                               
[1376]227                                if(has_constant)
[1367]228                                {
[1376]229                                        gau_sample.ins(gau_sample.size(),1.0);
[1367]230                                }
[1376]231                               
[1383]232                                gau_sample.ins(gau_sample.size(),randn());
[1367]233
[1376]234                                sample_prediction.ins(0,gau_sample*samples.get_col(t));                         
[1367]235                        }
[1376]236
237                        return pair<vec,vec>(ones(sample_prediction.size()),sample_prediction);
[1367]238                }
239       
240        }
241
242
[1376]243        static set<set<pair<int,int>>> possible_models_recurse(int max_order,int number_of_channels)
[1361]244        {
[1376]245                set<set<pair<int,int>>> created_model_types;           
[1361]246
[1376]247                if(max_order == 1)//ukoncovacia vetva
[1361]248                {                       
[1376]249                        for(int channel = 0;channel<number_of_channels;channel++)//pre AR 1 model vytvori kombinace kanalov v prvom kroku poyadu
[1358]250                        {
[1376]251                                set<pair<int,int>> returned_type;
252                                returned_type.insert(pair<int,int>(channel,1));  //??
253                                created_model_types.insert(returned_type);
[1358]254                        }
[1361]255
256                        return created_model_types;
257                }
258                else
259                {
[1376]260                        created_model_types = possible_models_recurse(max_order-1,number_of_channels);//tu uz mame ulozene kombinace o jeden krok dozadu  //rekuryivne volanie
261                        set<set<pair<int,int>>> returned_types;
[1361]262                       
[1376]263                        for(set<set<pair<int,int>>>::iterator model_ref = created_model_types.begin();model_ref!=created_model_types.end();model_ref++)
[1361]264                        {                               
265                               
266                                for(int order = 1; order<=max_order; order++)
[1358]267                                {
[1361]268                                        for(int channel = 0;channel<number_of_channels;channel++)
269                                        {
[1376]270                                                set<pair<int,int>> returned_type;
271                                                pair<int,int> new_pair = pair<int,int>(channel,order);//??
272                                                if(find((*model_ref).begin(),(*model_ref).end(),new_pair)==(*model_ref).end()) //??
[1361]273                                                {
[1376]274                                                        returned_type.insert((*model_ref).begin(),(*model_ref).end()); //co vlozi na zaciatok retuned_type?
275                                                        returned_type.insert(new_pair);
276                                                       
277
278                                                        returned_types.insert(returned_type);                                                   
[1361]279                                                }
280                                        }
[1358]281                                }
282                        }
[1361]283
[1376]284                        created_model_types.insert(returned_types.begin(),returned_types.end());
[1361]285
286                        return created_model_types;
287                }               
[1358]288        }
[1361]289};
290
291
292
293
[1383]294int main ( int argc, char* argv[] ) 
295{
[1358]296       
[1376]297        // EXPERIMENT: A moving window estimation and prediction of RARX is tested on data generated from
298    // y_t=0.95*y_(t-1)+0.05*y_(t-2)+0.2*e_t, where e_t is normally, student(4) and cauchy distributed. It
299    // can be compared to the classical setup.
300       
301        itpp::Laplace_RNG LapRNG = Laplace_RNG();       
[1301]302
[1376]303        vector<vector<string>> strings;
[1301]304
[1396]305        char* file_string =  "C:\\results\\cauchy"; // "C:\\dataADClosePercDiff"; // 
[1301]306
[1376]307        char dfstring[80];
308        strcpy(dfstring,file_string);
309        strcat(dfstring,".txt");
310       
311       
312        mat data_matrix;
313        ifstream myfile(dfstring);
314        if (myfile.is_open())
315        {               
316                string line;
317                while(getline(myfile,line))
318                {                       
319                        vec data_vector;
320                        while(line.find(',') != string::npos) //zmenil som ciarku za medzeru
321                        {
[1383]322                                //line.erase(0,1); // toto som sem pridal
[1376]323                                int loc2 = line.find('\n');
324                                int loc  = line.find(',');
325                                data_vector.ins(data_vector.size(),atof(line.substr(0,loc).c_str()));                           
326                                line.erase(0,loc+1);                                   
327                        }
[1301]328
[1376]329                        data_matrix.ins_row(data_matrix.rows(),data_vector);
330                }               
[1361]331
[1376]332                myfile.close(); 
333        }
334        else
335        {
336                cout << "Can't open data file!" << endl;
337        }
338       
339        //konec nacitavania dat
340        set<set<pair<int,int>>> model_types = model::possible_models_recurse(max_model_order,data_matrix.rows()); //volanie funkce kde robi kombinace modelov
341                                                                                                //to priradime do model_types, data_matrix.row urcuje pocet kanalov dat
342        vector<model*> models;
343        for(set<set<pair<int,int>>>::iterator model_type = model_types.begin();model_type!=model_types.end();model_type++)
344        {// prechadza rozne typy kanalov, a poctu regresorov
[1396]345                for(int window_size = max_window_size-1;window_size < max_window_size;window_size++)
[1376]346                {
[1396]347                        //models.push_back(new model((*model_type),true,true,window_size,0,&data_matrix));   // to su len konstruktory, len inicializujeme rozne typy
348                        //models.push_back(new model((*model_type),false,true,window_size,0,&data_matrix));
[1376]349                        models.push_back(new model((*model_type),true,false,window_size,0,&data_matrix));
[1384]350                        models.push_back(new model((*model_type),false,false,window_size,0,&data_matrix));             
[1376]351                }
[1365]352
[1379]353                //set<pair<int,int>> empty_list;
354                //models.push_back(new model(empty_list,false,true,100,0,&data_matrix));
[1376]355        }
356       
357        mat result_lognc;
358        // mat result_preds;
359
[1383]360        ofstream myfilew;
[1393]361        //char fstring[80];                                     
362        //strcpy(fstring,file_string);
[1389]363        //strcat(fstring,"lognc.txt");
[1393]364        //strcat(fstring,"preds.txt"); 
[1383]365
[1376]366        for(int time = max_model_order;time<data_matrix.cols();time++) //time<data_matrix.cols()
[1396]367        {       
368                if(time==max_window_size)
369                {
370                        exit(1);
371                }
372               
373                //pocet stlpcov data_matrix je pocet casovych krokov
[1376]374                vec cur_res_lognc;
375                // vec preds;
376                vector<string> nazvy;
377                for(vector<model*>::iterator model_ref = models.begin();model_ref!=models.end();model_ref++)
378                {//posuvam s apo models, co je pole modelov urobene o cyklus vyssie. Teda som v case time a robim to tam pre vsetky typy modelov, kombinace regresorov
379                        (*model_ref)->data_update(time); //pozret sa preco je toto tu nutne
[1379]380
381                        cout << "Updated." << endl;
[1376]382                        //if (time = max_model_order) nazvy.push_back(models.model_ref]);// ako by som mohol dostat nazov modelu?
383
[1393]384                        if((*model_ref)->my_rarx!=NULL) //vklada normalizacni faktor do cur_res_lognc
[1376]385                        {
[1396]386                                cout << "Maxlik vertex:" << (*model_ref)->my_rarx->posterior->minimal_vertex->get_coordinates() << endl;
[1384]387                                cur_res_lognc.ins(cur_res_lognc.size(),(*model_ref)->my_rarx->posterior->_ll());                               
[1361]388                        }
[1376]389                        else
390                        {
[1384]391                                cur_res_lognc.ins(cur_res_lognc.size(),(*model_ref)->my_arx->_ll());
[1376]392                        }
[1393]393                       
[1396]394                        if(time == max_window_size-1)
[1393]395                        {
[1396]396                                //***********************
397                                int sample_size = 100000;
398                                //***********************
399                               
400                                pair<vec,mat> samples;
401                                if((*model_ref)->my_arx!=NULL)
402                                {
403                                        mat samp_mat = (*model_ref)->my_arx->posterior().sample_mat(sample_size);
404                                        samples = pair<vec,mat>(ones(samp_mat.cols()),samp_mat);
405                                }
406                                else
407                                {
408                                        samples = (*model_ref)->my_rarx->posterior->sample(sample_size,true);                                   
409                                }
410
[1393]411                                char fstring[80];                                       
412                                strcpy(fstring,file_string);
413                                strcat(fstring,(*model_ref)->name);
414                                strcat(fstring,".txt");
415                               
[1396]416                                //cout << samples.first << endl;
[1393]417                               
418                                myfilew.open(fstring,ios::app);
[1396]419                               
420                                /*
421                                for(int i = 0;i<samples.first.size();i++)
422                                {
423                                        myfilew << samples.first.get(i) << ",";
424                                }
425                                myfilew << endl;
426                                */
427
428                                for(int j = 0;j<samples.second.rows()+1;j++)
429                                {                       
430                                        for(int i = 0;i<samples.second.cols();i++)
431                                        {
432                                                if(j!=samples.second.rows())
433                                                {
434                                                        myfilew << samples.second.get(j,i) << ",";
435                                                }
436                                                /*
437                                                else
438                                                {
439                                                        myfilew << "0,";
440                                                }
441                                                */
442                                        }                               
443                                        myfilew << endl;
444                                }
445
446                                cout << "*************************************" << endl;
447
448                                myfilew.close();                               
449                        }
[1393]450                       
451                        /* // PREDICTIONS
[1389]452                        pair<vec,vec> predictions = (*model_ref)->predict(500,time,&LapRNG);
[1367]453
[1383]454                        cout << predictions.first << endl << predictions.second << endl;
[1361]455
[1383]456                        double avg_prediction = (predictions.first*predictions.second)/(predictions.first*ones(predictions.first.size()));
457
458                        (*model_ref)->predictions.ins((*model_ref)->predictions.size(),avg_prediction);
[1393]459                                       
[1383]460                        myfilew.open(fstring,ios::app);
[1393]461                        myfilew << avg_prediction << ",";
[1383]462                        myfilew.close();
[1393]463                        */
[1383]464
465                        //preds.ins(0,data_matrix.get(0,time+1));
[1376]466                }
[1367]467
[1389]468               
[1393]469                /* // REAL PRICE
[1383]470                myfilew.open(fstring,ios::app);
471                myfilew << data_matrix.get(0,time+1) << endl;
472                myfilew.close();
[1393]473                */
[1383]474
[1376]475                result_lognc.ins_col(result_lognc.cols(),cur_res_lognc);
476                // result_preds.ins_col(result_preds.cols(),preds);
477
[1384]478                // cout << "Updated." << endl; 
[1383]479                                                       
[1393]480                /*
[1383]481                myfilew.open(fstring,ios::app);
482               
483                // myfile << my_rarx->posterior->minimal_vertex->get_coordinates()[0];
484               
485                if(time == max_model_order)
486                {
487                        for(int i = 0;i<cur_res_lognc.size();i++)
[1301]488                        {
[1383]489                                for(set<pair<int,int>>::iterator ar_ref = models[i]->ar_components.begin();ar_ref != models[i]->ar_components.end();ar_ref++)
490                                {
491                                        myfilew << (*ar_ref).second << (*ar_ref).first;                                                 
492                                }
[1301]493
[1383]494                                myfilew << ".";
[1301]495
[1383]496                                if(models[i]->my_arx == NULL)
497                                {
498                                        myfilew << "1";
499                                }
500                                else
501                                {
502                                        myfilew << "0";
503                                }
[1301]504                                       
[1383]505                                if(models[i]->has_constant)
[1301]506                                {
[1383]507                                        myfilew << "1";
508                                }
509                                else
510                                {
511                                        myfilew << "0";
512                                }
[1324]513
[1383]514                                myfilew << ",";
[1376]515                        }
[1337]516
[1383]517                        myfilew << endl;
518                }
519               
[1393]520               
521                // for(int i = 0;i<cur_res_lognc.size();i++)
522                // {
523                //         myfilew << cur_res_lognc[i] << ' ';//zmenil som ciarku ze medzeru
524                // }
525               
[1301]526
[1383]527                myfilew << endl;                               
528               
529                myfilew.close();
[1393]530                */
[1383]531               
532}
533       
[1301]534
[1337]535
536        // EXPERIMENT: One step ahead price prediction. Comparison of classical and robust model using optimal trading
537    //             with maximization of logarithm of one-step ahead wealth.
538
539       
[1301]540               
541                /*
542                cout << "One experiment finished." << endl;
543
544                ofstream myfile;
545                myfile.open("c:\\robust_ar1.txt",ios::app);
546                myfile << endl;
547                myfile.close();
548
549                myfile.open("c:\\robust_ar2.txt",ios::app);
550                myfile << endl;
551                myfile.close();*/
[1300]552       
[1301]553
554        //emlig* emlig1 = new emlig(emlig_size);
555
556        //emlig1->step_me(0);
557        //emlig* emlig2 = new emlig(emlig_size);
[1300]558       
[1267]559        /*
560        emlig1->set_correction_factors(4);
[1266]561
[1267]562        for(int j = 0;j<emlig1->correction_factors.size();j++)
563        {
564                for(set<my_ivec>::iterator vec_ref = emlig1->correction_factors[j].begin();vec_ref!=emlig1->correction_factors[j].end();vec_ref++)
565                {
[1268]566                        cout << j << "    ";
567                       
[1267]568                        for(int i=0;i<(*vec_ref).size();i++)
569                        {
570                                cout << (*vec_ref)[i];
571                        }
572
573                        cout << endl;
574                }
[1268]575        }*/
576       
[1301]577        /*
[1300]578    vec condition5 = "1.0 1.0 1.01";//"-0.3 1.7 1.5";
579
[1299]580        emlig1->add_condition(condition5);
[1301]581        //emlig1->step_me(0);
582
583
584        vec condition1a = "-1.0 1.02 0.5";
[1300]585        //vec condition1b = "1.0 1.0 1.01";
[1301]586        emlig1->add_condition(condition1a);
[1300]587        //emlig2->add_condition(condition1b);
[1267]588
[1301]589        vec condition2a = "-0.3 1.7 1.5";
[1300]590        //vec condition2b = "-1.0 1.0 1.0";
[1301]591        emlig1->add_condition(condition2a);
[1300]592        //emlig2->add_condition(condition2b);
[1234]593
[1301]594        vec condition3a = "0.5 -1.01 1.0";
[1300]595        //vec condition3b = "0.5 -1.01 1.0";
[1280]596
[1301]597        emlig1->add_condition(condition3a);
[1300]598        //emlig2->add_condition(condition3b);   
[1280]599
[1301]600        vec condition4a = "-0.5 -1.0 1.0";
[1300]601        //vec condition4b = "-0.5 -1.0 1.0";   
602
[1301]603        emlig1->add_condition(condition4a);
[1300]604        //cout << "************************************************" << endl;
605        //emlig2->add_condition(condition4b);
606        //cout << "************************************************" << endl;
607       
[1299]608        //cout << emlig1->minimal_vertex->get_coordinates();
[1300]609       
[1301]610        //emlig1->remove_condition(condition3a);
611        //emlig1->step_me(0);
612        //emlig1->remove_condition(condition2a);
613        //emlig1->remove_condition(condition1a);
614        //emlig1->remove_condition(condition5);
615       
[1275]616
[1299]617        //emlig1->step_me(0);
618        //emlig2->step_me(0);
619       
[1282]620
621        // DA SE POUZIT PRO VYPIS DO SOUBORU
[1275]622        // emlig1->step_me(0);
623
624        //emlig1->remove_condition(condition1);
625       
[1301]626       
[1275]627
628       
[1301]629       
[1275]630        /*
[1282]631        for(int i = 0;i<100;i++)
[1219]632        {
[1282]633                cout << endl << "Step:" << i << endl;           
[1208]634
[1268]635                double condition[emlig_size+1];         
[1220]636
[1268]637                for(int k = 0;k<=emlig_size;k++)
638                {
[1272]639                        condition[k] = (rand()-RAND_MAX/2)/1000.0;             
[1268]640                }
641                       
[1216]642
[1268]643                vec* condition_vec = new vec(condition,emlig_size+1);
[1219]644                emlig1->add_condition(*condition_vec);
[1271]645
[1272]646                /*
647                for(polyhedron* toprow_ref = emlig1->statistic.rows[emlig_size]; toprow_ref != emlig1->statistic.end_poly; toprow_ref = toprow_ref->next_poly)
648                {
649                        cout << ((toprow*)toprow_ref)->probability << endl;
650                }
651                */
[1275]652                /*
[1271]653                cout << emlig1->statistic_rowsize(emlig_size) << endl << endl;
[1268]654       
[1272]655                /*
[1271]656                if(i-emlig1->number_of_parameters >= 0)
657                {
658                        pause(30);
659                }
[1272]660                */
[1219]661
[1271]662                // emlig1->step_me(i);
[1219]663               
[1272]664                /*
[1219]665                vector<int> sizevector;
666                for(int s = 0;s<=emlig1->number_of_parameters;s++)
667                {
668                        sizevector.push_back(emlig1->statistic_rowsize(s));
669                }
[1272]670                */
[1275]671        //}
672   
[1219]673
674
675       
676        /*
677        emlig1->step_me(1);
678
679        vec condition = "2.0 0.0 1.0"; 
680
[1208]681        emlig1->add_condition(condition);
682
[1216]683        vector<int> sizevector;
684        for(int s = 0;s<=emlig1->number_of_parameters;s++)
685        {
686                sizevector.push_back(emlig1->statistic_rowsize(s));
687        }
688
[1219]689        emlig1->step_me(2);
[1216]690
[1219]691        condition = "2.0 1.0 0.0";
[1216]692
693        emlig1->add_condition(condition);
694
695        sizevector.clear();
696        for(int s = 0;s<=emlig1->number_of_parameters;s++)
697        {
698                sizevector.push_back(emlig1->statistic_rowsize(s));
699        }
[1219]700        */
[1216]701
[1376]702        return 0;
703}
[976]704
[1282]705
Note: See TracBrowser for help on using the browser.