root/bdm/estim/KF_ui.h @ 338

Revision 338, 1.7 kB (checked in by smidl, 15 years ago)

Multiple Models + changes in loggers

Line 
1
2/*!
3  \file
4  \brief UserInfo for Kalman filters and extensions
5  \author Vaclav Smidl.
6
7  -----------------------------------
8  BDM++ - C++ library for Bayesian Decision Making under Uncertainty
9
10  Using IT++ for numerical operations
11  -----------------------------------
12*/
13
14#include "libKF.h"
15#include <uibuilder.h>
16
17class UIEKF: public UIbuilder {
18        public:
19        UIEKF():UIbuilder("EKF"){};
20        bdmroot* build ( Setting &S ) const {
21                diffbifn* IM; UIbuild(S["IM"],IM);
22                diffbifn* OM; UIbuild(S["OM"],OM);
23               
24                //parameters
25                EKFCh* E; E=new EKFCh;
26                //EKFfull* E; E=new EKFfull;
27               
28                //statistics
29                int dim=IM->dimension();
30                vec mu0;
31                mat P0;
32                if (S.exists("mu0")){mu0=getvec(S["mu0"]);}else{mu0=zeros(dim);};
33                if (S.exists("P0")){P0=getmat(S["P0"],dim);}else{P0=eye(dim);};
34                if (S.exists("dP0")){P0=diag(getvec(S["dP0"]));}else{P0=eye(dim);};
35                E->set_statistics(mu0,P0);
36               
37                //parameters
38                E->set_parameters(IM, OM, diag(getvec(S["dQ"])), diag(getvec(S["dR"])));
39
40                //connect
41                RV* drv; UIbuild(S["drv"],drv);
42                E->set_drv(*drv);
43                RV* rv; UIbuild(S["rv"],rv);
44                E->set_rv(*rv);
45               
46                if (S.exists("options")){E->set_options(S["options"]);};
47               
48                return E;
49        }       
50};
51UIREGISTER ( UIEKF );
52
53class UIMultiModel: public UIbuilder {
54        public:
55                UIMultiModel():UIbuilder("MultiModel"){};
56                bdmroot* build ( Setting &S ) const {
57                        Array<EKFCh*> A;
58                        MultiModel* MM; MM=new MultiModel;
59                               
60                        Setting& mod=S["models"];
61                        A.set_length(mod.getLength());
62                        for (int i=0;i<A.length();i++){
63                                UIbuild(mod[i], A(i));
64                        }
65                       
66                        MM->set_parameters(A);
67                        MM->set_drv(A(0)->_drv());
68                        //MM->set_rv(A(0)->_rv());
69               
70                        if (S.exists("options")){MM->set_options(S["options"]);};
71               
72                        return MM;
73                }       
74};
75UIREGISTER ( UIMultiModel );
Note: See TracBrowser for help on using the browser.