Show
Ignore:
Timestamp:
11/28/09 14:38:48 (15 years ago)
Author:
smidl
Message:

Working unitsteps and controlloop + corresponding fixes

Location:
applications/bdmtoolbox
Files:
1 added
4 modified

Legend:

Unmodified
Added
Removed
  • applications/bdmtoolbox/Doxyfile

    r613 r744  
    2626INLINE_INHERITED_MEMB  = YES 
    2727FULL_PATH_NAMES        = NO 
    28 STRIP_FROM_PATH        = /home/smidl/ 
     28STRIP_FROM_PATH        = /home/smidl/work/git/mixpp 
    2929STRIP_FROM_INC_PATH    =  
    3030SHORT_NAMES            = NO 
     
    246246# configuration options related to the XML output 
    247247#--------------------------------------------------------------------------- 
    248 GENERATE_XML           = yes 
     248GENERATE_XML           = NO 
    249249XML_OUTPUT             = xml 
    250250XML_SCHEMA             =  
  • applications/bdmtoolbox/mex/controlloop.cpp

    r723 r744  
    77digraph estimation{ 
    88        node [shape=box]; 
    9         {rank="same"; "Data Source"; "Bayesian Model"} 
    10         "Data Source" -> "Bayesian Model" [label="data"]; 
    11         "Bayesian Model" -> "Result Logger" [label="estimated\n statistics"]; 
     9        subgraph cl0 { 
     10        "Data Source" -> "Controller" [label="observations"]; 
     11        "Controller" -> "Data Source" [label="actions"]; 
     12        } 
     13        {rank="same"; "Controller"; "Result Logger"} 
     14        "Controller" -> "Result Logger" [label="internals"]; 
    1215        "Data Source" -> "Result Logger" [label="Simulated\n data"]; 
    1316} 
     
    8790                if ( n_input>3 ) { 
    8891                        Cfg.addGroup ( input[3],"logger" ); 
    89                 }/*else{ 
    90                 // define logger as mexlog 
    91                 Setting &S=Cfg.getRoot(); 
    92                 S.add("logger",Setting::TypeGroup); 
    93                 S["logger"].add("class",Setting::TypeString); 
    94                 S["logger"]["class"]="mexlog"; 
    95                 S["logger"].add("maxlen",Setting::TypeInt); 
    96                 int maxlen; 
    97                 S["experiment"].lookupValue("ndat",maxlen); 
    98                 S["logger"]["maxlen"]=maxlen; 
    99         }*/ 
     92                } 
    10093        } catch ( SettingException e ) { 
    10194                it_error ( "error: "+string ( e.getPath() ) ); 
     
    116109#endif 
    117110 
     111        RNG_randomize(); 
     112         
    118113        shared_ptr<DS> Ds = UI::build<DS> ( Cfg, "system" ); 
    119114        Array<shared_ptr<Controller> > Cs; 
    120115        UI::get ( Cs,Cfg, "controllers" ); 
    121116        int Ndat=100; 
     117        int burnin=10; 
    122118        if ( Cfg.exists ( "experiment" ) ) { 
    123119                if ( Cfg.getRoot().lookupValue ( "experiment.ndat",Ndat ) ) { 
     
    178174        } 
    179175 
     176        vec ut(Ds->_urv()._dsize()); 
    180177        for ( int tK=0;tK<Ndat;tK++ ) { 
    181178                Ds->getdata ( dt );                                     // read data 
     
    186183                                Cs(i) -> redesign(); 
    187184                                Cs(i) -> adapt( Dlsc(i) ->pushdown(dt)); 
    188                                 vec ut=Cs ( i )->ctrlaction ( Dlsc(i) ->pushdown(dt) );         // update estimates 
    189                                 Ds->write(ut, vec_1(0)); 
     185                        } 
     186                        if (tK > burnin){ 
     187                                vec uti=Cs ( i )->ctrlaction ( Dlsc(i) ->pushdown(dt) );                // update estimates 
     188                                Dlsu(i)->filldown(uti, ut); 
    190189                        } else { 
    191                                 Ds->write(0.001*randn(Ds->_urv()._dsize())); 
     190                                ut = 0.1*randn(Ds->_urv()._dsize()); 
    192191                        } 
    193192                         
    194193                        Cs ( i )->log_write (); 
    195194                } 
     195                Ds->write(ut); 
    196196                 
    197197                L->step(); 
  • applications/bdmtoolbox/tutorial/merging/merge_frag.m

    r706 r744  
    1616Merger.ncoms=20; 
    1717Merger.stop_niter=50; 
    18 Merger.effss_coef=1; 
     18Merger.effss_coef=0.9; 
    1919%Merger.dbg_file='merger_mix_dbg'; 
    2020 
     
    3232    'R',1); 
    3333% 2D support 
    34 support2.grid={[-5,5],[0.001,9]}; 
    35 support2.nbins=[30,30]; 
     34support2.class='rectangular_support'; 
     35support2.ranges={[-5,5],[0.001,9]}; 
     36support2.gridsizes=[30,30]; 
    3637 
    3738% 2D 
  • applications/bdmtoolbox/tutorial/userguide/arx_ctrl_example.m

    r724 r744  
    11% name random variables 
    22y = RV({'y'},1); 
    3 u = RV({'u'},1); 
     3u1 = RV({'u1'},1); 
     4u2 = RV({'u2'},1); 
    45 
    56% create f(y_t| y_{t-3}, u_{t-1}) 
    67fy.class = 'mlnorm<ldmat>'; 
    78fy.rv    = y; 
    8 fy.rvc   = RVtimes([y,u], [-3, -1]); 
    9 fy.A     = [0.5, -0.9]; 
     9fy.rvc   = RVtimes([y,u1,u2], [-3, 0, 0]); 
     10fy.A     = [0.5, -0.9, 0.9]; 
    1011fy.const = 0; 
    1112fy.R     = 1e-2; 
     
    1718A1.class = 'ARX'; 
    1819A1.rv = y; 
    19 A1.rgr = RVtimes([y,u],[-3,-1]) ; % correct structure is {y,y} 
     20A1.rgr = RVtimes([y,u1,u2],[-3,0,0]) ; % correct structure is {y,y} 
    2021A1.options ='logbounds,logll'; 
    2122 
    2223C1.class = 'LQG_ARX'; 
    2324C1.ARX = A1; 
    24 C1.Qu = 0.1*eye(1); 
     25C1.Qu = 0.1*eye(2); 
    2526C1.Qy = eye(1); 
    2627C1.yreq = 1; 
    2728C1.horizon = 100; 
    2829 
     30% participant 1 
     31Cp1. 
     32 
    2933M= controlloop(DS,{C1});