Changeset 1064 for library/bdm/design

Show
Ignore:
Timestamp:
06/09/10 14:00:40 (14 years ago)
Author:
mido
Message:

astyle applied all over the library

Location:
library/bdm/design
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • library/bdm/design/arx_ctrl.h

    r896 r1064  
    2222class LQG_ARX : public Controller { 
    2323protected: 
    24         //! Internal ARX estimator 
    25         shared_ptr<ARX> ar; 
    26         //! Internal LQG designer 
    27         LQG lq; 
    28         //! Intermediate StateSpace model 
    29         shared_ptr<StateFromARX> Stsp; 
    30         //! AR predictor 
    31         shared_ptr<mlnorm<chmat> > pred; 
    32         //! datalink from rvc to ar.bayes 
    33         datalink rvc2ar_y; 
    34         //! datalink from rvc to ar.bayes 
    35         datalink_buffered rvc2ar_cond; 
     24    //! Internal ARX estimator 
     25    shared_ptr<ARX> ar; 
     26    //! Internal LQG designer 
     27    LQG lq; 
     28    //! Intermediate StateSpace model 
     29    shared_ptr<StateFromARX> Stsp; 
     30    //! AR predictor 
     31    shared_ptr<mlnorm<chmat> > pred; 
     32    //! datalink from rvc to ar.bayes 
     33    datalink rvc2ar_y; 
     34    //! datalink from rvc to ar.bayes 
     35    datalink_buffered rvc2ar_cond; 
    3636 
    37         //! flag to use iterations spread in time (ist) 
    38         bool ist; 
    39         //! flag to use windsurfer approach 
    40         bool windsurfer; 
     37    //! flag to use iterations spread in time (ist) 
     38    bool ist; 
     39    //! flag to use windsurfer approach 
     40    bool windsurfer; 
    4141public: 
    42         //! Default constructor 
    43         LQG_ARX() : ar(), lq() { } 
     42    //! Default constructor 
     43    LQG_ARX() : ar(), lq() { } 
    4444 
    45         //! adaptation is to store arx estimates in stsp 
    46         void adapt ( const vec &data ) { 
    47                 ar->bayes ( rvc2ar_y.pushdown ( data ), rvc2ar_cond.pushdown ( data ) ); 
    48                 rvc2ar_cond.store_data ( data ); 
    49                 ar->ml_predictor_update ( *pred ); 
    50         } 
    51         void redesign() { 
    52                 Stsp->update_from ( *pred ); 
    53                 if ( windsurfer ) { 
    54                         mat Ry = pred->_R(); 
    55                         lq.set_control_Qy ( inv ( Ry ) ); 
    56                 } 
    57                 if ( !ist ) { 
    58                         lq.initial_belmann(); 
    59                 } 
    60                 lq.redesign(); 
    61         } 
    62         vec ctrlaction ( const vec &cond ) const { 
    63                 //cond is xt + ut 
    64                 vec state = cond.left ( Stsp->_A().rows() ); 
    65                 if ( Stsp->_have_constant() ) { 
    66                         state ( state.length() - 1 ) = 1; 
    67                 } 
    68                 vec tmp=lq.ctrlaction ( state, cond.right ( Stsp->_B().cols() ) ); 
    69                 if (!std::isfinite(sum(tmp))) { 
    70                         cout << "infinite ctrl action"; 
    71                 } 
    72                 return tmp; 
    73         } 
    74         //! 
    75         //! LQG is defined by quadratic loss function 
    76         /*! \f[ L(y,u) = (y-y_{req})'Q_y (y-y_{req}) + (u-u_{req})' Q_u (u-u_{req}) \f] 
    77                         expected input 
    78                         \code 
    79                 { class="LQG"; 
    80                         arx = {class="ARX", ...} // internal arx model, see 
    81                         Qy = ("matrix", ...); 
    82                         Qu = ("matrix", ...); 
    83                         yreq = [];               // requested output 
    84                         ureq = [];               // requested input value 
    85                 } 
    86                         \endcode 
    87         */ 
    88         void from_setting ( const Setting &set ) { 
    89                 ar = UI::build<ARX> ( set, "ARX", UI::compulsory ); 
     45    //! adaptation is to store arx estimates in stsp 
     46    void adapt ( const vec &data ) { 
     47        ar->bayes ( rvc2ar_y.pushdown ( data ), rvc2ar_cond.pushdown ( data ) ); 
     48        rvc2ar_cond.store_data ( data ); 
     49        ar->ml_predictor_update ( *pred ); 
     50    } 
     51    void redesign() { 
     52        Stsp->update_from ( *pred ); 
     53        if ( windsurfer ) { 
     54            mat Ry = pred->_R(); 
     55            lq.set_control_Qy ( inv ( Ry ) ); 
     56        } 
     57        if ( !ist ) { 
     58            lq.initial_belmann(); 
     59        } 
     60        lq.redesign(); 
     61    } 
     62    vec ctrlaction ( const vec &cond ) const { 
     63        //cond is xt + ut 
     64        vec state = cond.left ( Stsp->_A().rows() ); 
     65        if ( Stsp->_have_constant() ) { 
     66            state ( state.length() - 1 ) = 1; 
     67        } 
     68        vec tmp=lq.ctrlaction ( state, cond.right ( Stsp->_B().cols() ) ); 
     69        if (!std::isfinite(sum(tmp))) { 
     70            cout << "infinite ctrl action"; 
     71        } 
     72        return tmp; 
     73    } 
     74    //! 
     75    //! LQG is defined by quadratic loss function 
     76    /*! \f[ L(y,u) = (y-y_{req})'Q_y (y-y_{req}) + (u-u_{req})' Q_u (u-u_{req}) \f] 
     77                expected input 
     78                \code 
     79        { class="LQG"; 
     80                arx = {class="ARX", ...} // internal arx model, see 
     81                Qy = ("matrix", ...); 
     82                Qu = ("matrix", ...); 
     83                yreq = [];               // requested output 
     84                ureq = [];               // requested input value 
     85        } 
     86                \endcode 
     87    */ 
     88    void from_setting ( const Setting &set ) { 
     89        ar = UI::build<ARX> ( set, "ARX", UI::compulsory ); 
    9090 
    91                 mat Qu; 
    92                 mat Qy; 
     91        mat Qu; 
     92        mat Qy; 
    9393 
    94                 UI::get ( Qu, set, "Qu", UI::compulsory ); 
    95                 UI::get ( Qy, set, "Qy", UI::compulsory ); 
     94        UI::get ( Qu, set, "Qu", UI::compulsory ); 
     95        UI::get ( Qy, set, "Qy", UI::compulsory ); 
    9696 
    97                 vec y_req; 
    98                 if ( !UI::get ( y_req, set, "yreq", UI::optional ) ) 
    99                         y_req = zeros ( ar->_yrv()._dsize() ); 
     97        vec y_req; 
     98        if ( !UI::get ( y_req, set, "yreq", UI::optional ) ) 
     99            y_req = zeros ( ar->_yrv()._dsize() ); 
    100100 
    101                 int horizon; 
    102                 UI::get ( horizon, set, "horizon", UI::compulsory ); 
    103                 lq.set_control_parameters ( Qy, Qu, y_req, horizon ); 
     101        int horizon; 
     102        UI::get ( horizon, set, "horizon", UI::compulsory ); 
     103        lq.set_control_parameters ( Qy, Qu, y_req, horizon ); 
    104104 
    105                 int wind; 
    106                 if ( UI::get ( wind, set, "windsurfer", UI::optional ) ) { 
    107                         windsurfer = wind > 0; 
    108                 } else { 
    109                         windsurfer = false; 
    110                 }; 
    111                 int ist_; 
    112                 if ( UI::get ( ist_, set, "ist", UI::optional ) ) { 
    113                         ist = ist_ > 0; 
    114                 } else { 
    115                         ist = false; 
    116                 }; 
    117                 validate(); 
    118         } 
     105        int wind; 
     106        if ( UI::get ( wind, set, "windsurfer", UI::optional ) ) { 
     107            windsurfer = wind > 0; 
     108        } else { 
     109            windsurfer = false; 
     110        }; 
     111        int ist_; 
     112        if ( UI::get ( ist_, set, "ist", UI::optional ) ) { 
     113            ist = ist_ > 0; 
     114        } else { 
     115            ist = false; 
     116        }; 
     117        validate(); 
     118    } 
    119119 
    120         void validate() { 
    121                 // ar is valid 
    122                 pred = ar->ml_predictor<chmat>(); 
    123                 Stsp = new StateFromARX; 
    124                 RV xrv; 
    125                 RV urvm; //old ut 
    126                 Stsp->connect_mlnorm ( *pred, xrv, urvm ); 
    127                 lq.set_system ( Stsp ); 
    128                 lq.validate(); 
     120    void validate() { 
     121        // ar is valid 
     122        pred = ar->ml_predictor<chmat>(); 
     123        Stsp = new StateFromARX; 
     124        RV xrv; 
     125        RV urvm; //old ut 
     126        Stsp->connect_mlnorm ( *pred, xrv, urvm ); 
     127        lq.set_system ( Stsp ); 
     128        lq.validate(); 
    129129 
    130                 rv = urvm; // rv is not shifted to t+1!! 
    131                 rvc = concat ( xrv, urvm ); 
    132                 rvc2ar_y.set_connection ( ar->_yrv(), rvc ); 
    133                 rvc2ar_cond.set_connection ( ar->_rvc(), rvc ); 
    134                 //datalink from ARX to rvc 
    135         } 
    136         void log_register ( logger &L, const string &prefix ) { 
    137                 ar->log_register ( L, prefix ); 
    138         } 
    139         void log_write ( ) const { 
    140                 ar->log_write(); 
    141         } 
    142         //! access function 
    143         const ARX& _ar() {return *ar.get();} 
    144         //! access function 
    145         mlnorm<chmat>* _pred() {return pred.get();} 
    146          
     130        rv = urvm; // rv is not shifted to t+1!! 
     131        rvc = concat ( xrv, urvm ); 
     132        rvc2ar_y.set_connection ( ar->_yrv(), rvc ); 
     133        rvc2ar_cond.set_connection ( ar->_rvc(), rvc ); 
     134        //datalink from ARX to rvc 
     135    } 
     136    void log_register ( logger &L, const string &prefix ) { 
     137        ar->log_register ( L, prefix ); 
     138    } 
     139    void log_write ( ) const { 
     140        ar->log_write(); 
     141    } 
     142    //! access function 
     143    const ARX& _ar() { 
     144        return *ar.get(); 
     145    } 
     146    //! access function 
     147    mlnorm<chmat>* _pred() { 
     148        return pred.get(); 
     149    } 
     150 
    147151 
    148152}; 
  • library/bdm/design/ctrlbase.cpp

    r744 r1064  
    44 
    55void LQG::set_system ( shared_ptr<StateSpace<chmat> > S0 ) { 
    6         S = S0; 
     6    S = S0; 
    77} 
    88 
    99void LQG::update_system() { 
    10         pr.set_submatrix ( 0, 0, S->_B() ); 
    11         pr.set_submatrix ( 0, dimu, S->_A() ); 
     10    pr.set_submatrix ( 0, 0, S->_B() ); 
     11    pr.set_submatrix ( 0, dimu, S->_A() ); 
    1212 
    13         //penalization 
    14         qux.set_submatrix ( 0, 0, Qu._Ch() ); 
    15         qux.set_submatrix ( 0, dimx + dimu + dimy, -Qu._Ch() ); 
     13    //penalization 
     14    qux.set_submatrix ( 0, 0, Qu._Ch() ); 
     15    qux.set_submatrix ( 0, dimx + dimu + dimy, -Qu._Ch() ); 
    1616 
    17         qyx.set_submatrix ( 0, 0, S->_C() ); 
    18         qyx.set_submatrix ( 0, dimx, -eye ( dimy ) ); 
     17    qyx.set_submatrix ( 0, 0, S->_C() ); 
     18    qyx.set_submatrix ( 0, dimx, -eye ( dimy ) ); 
    1919 
    20         // parts of QR 
    21         hqy = Qy.to_mat() * qyx * pr; 
     20    // parts of QR 
     21    hqy = Qy.to_mat() * qyx * pr; 
    2222 
    23         // pre_qr 
    24         pre_qr = concat_vertical ( s * pr, concat_vertical ( hqy, qux ) ); 
     23    // pre_qr 
     24    pre_qr = concat_vertical ( s * pr, concat_vertical ( hqy, qux ) ); 
    2525} 
    26          
     26 
    2727void LQG::set_control_parameters ( const mat &Qy0, const mat &Qu0, const vec &y_req0, int horizon0 ) { 
    28         Qy = Qy0; 
    29         Qu = Qu0; 
    30         y_req = y_req0; 
    31         horizon = horizon0; 
     28    Qy = Qy0; 
     29    Qu = Qu0; 
     30    y_req = y_req0; 
     31    horizon = horizon0; 
    3232} 
    3333 
    3434void LQG::validate() { 
    35         // set properties from S 
    36         dimx = S->_A().rows(); 
    37         dimy = S->_C().rows(); 
    38         dimu = S->_B().cols(); 
    39         pr = zeros ( dimx + dimu + dimy,  dimu + dimx + dimu + dimy ); 
    40         pr.set_submatrix ( dimx, dimu + dimx, eye ( dimu + dimy ) ); 
     35    // set properties from S 
     36    dimx = S->_A().rows(); 
     37    dimy = S->_C().rows(); 
     38    dimu = S->_B().cols(); 
     39    pr = zeros ( dimx + dimu + dimy,  dimu + dimx + dimu + dimy ); 
     40    pr.set_submatrix ( dimx, dimu + dimx, eye ( dimu + dimy ) ); 
    4141 
    42         //penalization 
    43         bdm_assert ( Qy.cols() == dimy, "LQG: wrong dimensions of Qy " ); 
    44         bdm_assert ( Qu.cols() == dimu, "LQG: wrong dimensions of Qu " ); 
    45         bdm_assert ( y_req.length() == dimy, "LQG: wrong dimensions of y_req " ); 
     42    //penalization 
     43    bdm_assert ( Qy.cols() == dimy, "LQG: wrong dimensions of Qy " ); 
     44    bdm_assert ( Qu.cols() == dimu, "LQG: wrong dimensions of Qu " ); 
     45    bdm_assert ( y_req.length() == dimy, "LQG: wrong dimensions of y_req " ); 
    4646 
    47         qux = zeros ( dimu, dimx + 2 * dimu + dimy ); 
    48         qyx = zeros ( dimy, dimx + dimy + dimu ); 
     47    qux = zeros ( dimu, dimx + 2 * dimu + dimy ); 
     48    qyx = zeros ( dimy, dimx + dimy + dimu ); 
    4949 
    50         // 
    51         initial_belmann(); 
    52         // parts of QR 
    53         post_qr = zeros ( pre_qr.rows(), pre_qr.cols() ); 
     50    // 
     51    initial_belmann(); 
     52    // parts of QR 
     53    post_qr = zeros ( pre_qr.rows(), pre_qr.cols() ); 
    5454 
    55         update_system(); 
     55    update_system(); 
    5656} 
    5757 
     
    5959//      pre_qr.set_submatrix ( 0, 0, s*pr ); 
    6060//      pre_qr.set_submatrix ( dimx + dimu + dimy, dimu + dimx, -Qy.to_mat() *y_req ); 
    61         if ( !qr ( pre_qr, post_qr ) ) { 
    62                 bdm_warning ( "QR in LQG unstable" ); 
    63         } 
    64         triu ( post_qr ); 
    65         // hn(m+1:2*m+n+r,m+1:2*m+n+r); 
    66         s = post_qr.get ( dimu, 2 * dimu + dimx + dimy - 1, dimu, 2 * dimu + dimx + dimy - 1 ); 
     61    if ( !qr ( pre_qr, post_qr ) ) { 
     62        bdm_warning ( "QR in LQG unstable" ); 
     63    } 
     64    triu ( post_qr ); 
     65    // hn(m+1:2*m+n+r,m+1:2*m+n+r); 
     66    s = post_qr.get ( dimu, 2 * dimu + dimx + dimy - 1, dimu, 2 * dimu + dimx + dimy - 1 ); 
    6767}; 
    6868 
    6969void LQG::redesign() { 
    70         for ( td = horizon; td > 0; td-- ) { 
    71                 update_system(); 
    72                 ricatti_step(); 
    73         } 
    74         /*                      ws=hn(1:m,m+1:2*m+n+r); 
    75                                 wsd=hn(1:m,1:m); 
    76                                 Lklq=-inv(wsd)*ws;*/ 
    77         L = -inv ( post_qr.get ( 0, dimu - 1, 0, dimu - 1 ) ) * post_qr.get ( 0, dimu - 1, dimu, 2 * dimu + dimx + dimy - 1 ); 
     70    for ( td = horizon; td > 0; td-- ) { 
     71        update_system(); 
     72        ricatti_step(); 
     73    } 
     74    /*                  ws=hn(1:m,m+1:2*m+n+r); 
     75                        wsd=hn(1:m,1:m); 
     76                        Lklq=-inv(wsd)*ws;*/ 
     77    L = -inv ( post_qr.get ( 0, dimu - 1, 0, dimu - 1 ) ) * post_qr.get ( 0, dimu - 1, dimu, 2 * dimu + dimx + dimy - 1 ); 
    7878} 
    7979 
  • library/bdm/design/ctrlbase.h

    r907 r1064  
    2121class Controller : public root { 
    2222protected: 
    23         //! identifier of the designed action; 
    24         RV rv; 
    25         //! identifier of the conditioning variables - data needed ; 
    26         RV rvc; 
     23    //! identifier of the designed action; 
     24    RV rv; 
     25    //! identifier of the conditioning variables - data needed ; 
     26    RV rvc; 
    2727public: 
    28         //! function processing new observations and adapting control strategy accordingly 
    29         virtual void adapt ( const vec &data ) {}; 
    30         //! function redesigning the control strategy 
    31         virtual void redesign() {}; 
    32         //! returns designed control action 
    33         virtual vec ctrlaction ( const vec &cond ) const { 
    34                 return vec ( 0 ); 
    35         } 
     28    //! function processing new observations and adapting control strategy accordingly 
     29    virtual void adapt ( const vec &data ) {}; 
     30    //! function redesigning the control strategy 
     31    virtual void redesign() {}; 
     32    //! returns designed control action 
     33    virtual vec ctrlaction ( const vec &cond ) const { 
     34        return vec ( 0 ); 
     35    } 
    3636 
    37         void from_setting ( const Setting &set ) { 
    38                 shared_ptr<RV> rv_ptr = UI::build<RV>( set, "rv", UI::optional ); 
    39                 if( rv_ptr ) rv = *rv_ptr; 
    40                 shared_ptr<RV> rvc_ptr = UI::build<RV>( set, "rvc", UI::optional ); 
    41                 if( rvc_ptr ) rvc = *rvc_ptr; 
    42         } 
    43         //! access function 
    44         const RV& _rv() { 
    45                 return rv; 
    46         } 
    47         //! access function 
    48         const RV& _rvc() { 
    49                 return rvc; 
    50         } 
    51         //! register this controller with given datasource under name "name" 
    52         virtual void log_register ( logger &L, const string &prefix ) { } 
    53         //! write requested values into the logger 
    54         virtual void log_write ( ) const { } 
     37    void from_setting ( const Setting &set ) { 
     38        shared_ptr<RV> rv_ptr = UI::build<RV>( set, "rv", UI::optional ); 
     39        if( rv_ptr ) rv = *rv_ptr; 
     40        shared_ptr<RV> rvc_ptr = UI::build<RV>( set, "rvc", UI::optional ); 
     41        if( rvc_ptr ) rvc = *rvc_ptr; 
     42    } 
     43    //! access function 
     44    const RV& _rv() { 
     45        return rv; 
     46    } 
     47    //! access function 
     48    const RV& _rvc() { 
     49        return rvc; 
     50    } 
     51    //! register this controller with given datasource under name "name" 
     52    virtual void log_register ( logger &L, const string &prefix ) { } 
     53    //! write requested values into the logger 
     54    virtual void log_write ( ) const { } 
    5555 
    5656}; 
     
    6060class LQG : public Controller { 
    6161protected: 
    62         //! StateSpace model from which we read data 
    63         shared_ptr<StateSpace<chmat> > S; 
    64         //! required value of the output y at time t (assumed constant) 
    65         vec y_req; 
    66         //! required value of the output y at time t (assumed constant) 
    67         vec u_req; 
     62    //! StateSpace model from which we read data 
     63    shared_ptr<StateSpace<chmat> > S; 
     64    //! required value of the output y at time t (assumed constant) 
     65    vec y_req; 
     66    //! required value of the output y at time t (assumed constant) 
     67    vec u_req; 
    6868 
    69         //! Control horizon, set to maxint for infinite horizons 
    70         int horizon; 
    71         //! penalization matrix Qy 
    72         chmat Qy; 
    73         //! penalization matrix Qu 
    74         chmat Qu; 
    75         //! time of the design step - from horizon->0 
    76         int td; 
    77         //! controller parameters 
    78         mat L; 
     69    //! Control horizon, set to maxint for infinite horizons 
     70    int horizon; 
     71    //! penalization matrix Qy 
     72    chmat Qy; 
     73    //! penalization matrix Qu 
     74    chmat Qu; 
     75    //! time of the design step - from horizon->0 
     76    int td; 
     77    //! controller parameters 
     78    mat L; 
    7979 
    80         //!@{ \name temporary storage for ricatti - use initialize 
    81         //! convenience parameters 
    82         int dimx; 
    83         //! convenience parameters 
    84         int dimy; 
    85         //! convenience parameters 
    86         int dimu; 
     80    //!@{ \name temporary storage for ricatti - use initialize 
     81    //! convenience parameters 
     82    int dimx; 
     83    //! convenience parameters 
     84    int dimy; 
     85    //! convenience parameters 
     86    int dimu; 
    8787 
    88         //!  parameters 
    89         mat pr; 
    90         //! penalization 
    91         mat qux; 
    92         //! penalization 
    93         mat qyx; 
    94         //! internal quadratic form 
    95         mat s; 
    96         //! penalization 
    97         mat qy; 
    98         //! pre_qr part 
    99         mat hqy; 
    100         //! pre qr matrix 
    101         mat pre_qr; 
    102         //! post qr matrix 
    103         mat post_qr; 
    104         //!@} 
     88    //!  parameters 
     89    mat pr; 
     90    //! penalization 
     91    mat qux; 
     92    //! penalization 
     93    mat qyx; 
     94    //! internal quadratic form 
     95    mat s; 
     96    //! penalization 
     97    mat qy; 
     98    //! pre_qr part 
     99    mat hqy; 
     100    //! pre qr matrix 
     101    mat pre_qr; 
     102    //! post qr matrix 
     103    mat post_qr; 
     104    //!@} 
    105105 
    106106public: 
    107         //! set system parameters from given matrices 
    108         void set_system ( shared_ptr<StateSpace<chmat> > S0 ); 
    109         //! update internal whan system has changed 
    110         void update_system(); 
    111         //! set penalization matrices and control horizon 
    112         void set_control_parameters ( const mat &Qy0, const mat &Qu0, const vec &y_req0, int horizon0 ); 
    113         //! set penalization matrices and control horizon 
    114         void set_control_Qy ( const mat &Qy0 ) { 
    115                 Qy = Qy0; 
    116         } 
    117         //! refresh temporary storage - inefficient can be improved 
    118         void initial_belmann() { 
    119                 s = 1e-5 * eye ( dimx + dimu + dimy ); 
    120         }; 
    121         //! validation procedure 
    122         void validate(); 
    123         //! function for future use which is called at each time td; Should call initialize()! 
    124         //! redesign one step of the 
    125         void ricatti_step(); 
    126          
    127         void redesign(); 
     107    //! set system parameters from given matrices 
     108    void set_system ( shared_ptr<StateSpace<chmat> > S0 ); 
     109    //! update internal whan system has changed 
     110    void update_system(); 
     111    //! set penalization matrices and control horizon 
     112    void set_control_parameters ( const mat &Qy0, const mat &Qu0, const vec &y_req0, int horizon0 ); 
     113    //! set penalization matrices and control horizon 
     114    void set_control_Qy ( const mat &Qy0 ) { 
     115        Qy = Qy0; 
     116    } 
     117    //! refresh temporary storage - inefficient can be improved 
     118    void initial_belmann() { 
     119        s = 1e-5 * eye ( dimx + dimu + dimy ); 
     120    }; 
     121    //! validation procedure 
     122    void validate(); 
     123    //! function for future use which is called at each time td; Should call initialize()! 
     124    //! redesign one step of the 
     125    void ricatti_step(); 
    128126 
    129         //! compute control action 
    130         vec ctrlaction ( const vec &state, const vec &ukm ) const { 
    131                 vec pom = concat ( state, ones ( dimy ), ukm ); 
    132                 return L*pom; 
    133         } 
    134         //! access function 
    135         mat _L() const { 
    136                 return L; 
    137         } 
     127    void redesign(); 
     128 
     129    //! compute control action 
     130    vec ctrlaction ( const vec &state, const vec &ukm ) const { 
     131        vec pom = concat ( state, ones ( dimy ), ukm ); 
     132        return L*pom; 
     133    } 
     134    //! access function 
     135    mat _L() const { 
     136        return L; 
     137    } 
    138138} ; 
    139139