6 #ifndef __CCL_LEARN_NCL_H
7 #define __CCL_LEARN_NCL_H
11 #include <gsl/gsl_linalg.h>
12 #include <gsl/gsl_blas.h>
13 #include <gsl/gsl_math.h>
14 #include <gsl/gsl_eigen.h>
15 #include <gsl/gsl_sf.h>
166 void ccl_learn_ncl(
const double * X,
const double *Y,
const int dim_x,
const int dim_y,
const int dim_n,
const int dim_b,
LEARN_NCL_MODEL *model);
204 void obj_ncl(
const LEARN_NCL_MODEL *model,
const double* W,
const double*BX,
const double*Y,
double*fun,
double* J);
void obj_ws_free(OBJ_WS *ws)
Free the memory for OBJ_WS structure.
int ccl_learn_ncl_model_free(LEARN_NCL_MODEL *model)
Free the memory for the learn_ncl model.
gsl_matrix * D
Diagobal matrix with eigen values of H.
Definition: ccl_learn_ncl.h:59
int dim_y
The dimensionality of the action space.
Definition: ccl_learn_ncl.h:33
double dS
The denomitor of the sqaured error is xd is taken.
Definition: ccl_learn_ncl.h:124
gsl_vector * b_n
A col vector of BX.
Definition: ccl_learn_ncl.h:74
void obj_ws_alloc(const LEARN_NCL_MODEL *model, OBJ_WS *ws)
Allocates the memory for OBJ_WS structure.
int dim_n
The number of data points.
Definition: ccl_learn_ncl.h:99
double * rd
The residual error at xd.
Definition: ccl_learn_ncl.h:122
gsl_matrix * w_
Model parameters.
Definition: ccl_learn_ncl.h:56
double * r
The returned value of the residual error.
Definition: ccl_learn_ncl.h:109
double S
The sqaure root if x is taken.
Definition: ccl_learn_ncl.h:111
double * v
The dot product of J_T and r.
Definition: ccl_learn_ncl.h:113
gsl_matrix * H
Dot product of BX and BX'.
Definition: ccl_learn_ncl.h:53
int ccl_solve_nonlin_ws_alloc(const LEARN_NCL_MODEL *model, SOLVE_NONLIN_WS *lm_ws)
Allocates the memory for SOLVE_NONLIN_WS structure.
gsl_vector * j_n_flt
Flattened jacobian vector.
Definition: ccl_learn_ncl.h:85
double Rlo
The lower bound of R.
Definition: ccl_learn_ncl.h:115
void ccl_lsqnonlin(const LEARN_NCL_MODEL *model, const double *BX, const double *Y, const OPTION option, SOLVE_NONLIN_WS *lm_ws_param, double *W)
Computation routine for optimizing non-linear objective functions using LM approach.
gsl_matrix * Y_T
Transpose of Y_.
Definition: ccl_learn_ncl.h:51
This structure describes workspace for directly learning the model parameters using linear regression...
Definition: ccl_learn_ncl.h:48
double * c
The mean of the rbf.
Definition: ccl_learn_ncl.h:35
gsl_vector * V
Eigen vector of H.
Definition: ccl_learn_ncl.h:58
int dim_x
The dimensionality of the state space.
Definition: ccl_learn_ncl.h:32
gsl_matrix * tmp2
A temporal matrix.
Definition: ccl_learn_ncl.h:86
double * d_T
The matrix transpose of d.
Definition: ccl_learn_ncl.h:127
int ccl_learn_model_ws_alloc(LEARN_NCL_MODEL *model, LEARN_MODEL_WS *ws)
Allocates the memory for LEARN_MODEL_WS structure.
void ccl_learn_ncl(const double *X, const double *Y, const int dim_x, const int dim_y, const int dim_n, const int dim_b, LEARN_NCL_MODEL *model)
Computation routine for learn nullspace component .
gsl_matrix * j_n
Row vector of analytic jacobian.
Definition: ccl_learn_ncl.h:84
double * x
The flattened and updated model parameters.
Definition: ccl_learn_ncl.h:105
double l
The adaptive learning rate.
Definition: ccl_learn_ncl.h:117
double * epsx
The tolerence of the model paramters.
Definition: ccl_learn_ncl.h:107
gsl_vector * A_inv_diag
The vector of diagonal elements of A matrix.
Definition: ccl_learn_ncl.h:134
int iter
The iteration number.
Definition: ccl_learn_ncl.h:120
double * A
The dot product of J_T and J.
Definition: ccl_learn_ncl.h:112
double R
The reduction if xd is taken.
Definition: ccl_learn_ncl.h:125
gsl_matrix * Y_
Observation actions.
Definition: ccl_learn_ncl.h:79
double a
Dot product of u_n' and Wb.
Definition: ccl_learn_ncl.h:83
gsl_matrix * g
Dot product of BX and U.
Definition: ccl_learn_ncl.h:50
int dim_b
The number of basis functions.
Definition: ccl_learn_ncl.h:31
int ccl_solve_nonlin_ws_free(SOLVE_NONLIN_WS *lm_ws)
Free the memory for SOLVE_NONLIN_WS structure.
double tmp
A temporal scalar.
Definition: ccl_learn_ncl.h:87
int dim_b
The number of basis functions.
Definition: ccl_learn_ncl.h:100
double Sd
The squared error if xd is taken.
Definition: ccl_learn_ncl.h:123
double * w
The model parameters for learning nullspace component.
Definition: ccl_learn_ncl.h:37
gsl_matrix * Wb_T
Transpose of Wb.
Definition: ccl_learn_ncl.h:81
gsl_matrix * HS
Regularization basis for the H matrix.
Definition: ccl_learn_ncl.h:49
double epsf
The tolerence fo the objective functions.
Definition: ccl_learn_ncl.h:108
double * J_T
The matrix transpose of J.
Definition: ccl_learn_ncl.h:128
gsl_matrix * A_inv
The peudo-inverse of A.
Definition: ccl_learn_ncl.h:133
double c
Dot product of Wb' and Wb.
Definition: ccl_learn_ncl.h:82
int d_ok
check if the model parameters are belowed the tolerence
Definition: ccl_learn_ncl.h:103
double * xd
The next x.
Definition: ccl_learn_ncl.h:121
gsl_matrix * BX_T
Transpose of BX_.
Definition: ccl_learn_ncl.h:54
gsl_matrix * u_n_T
Transpose of u_n.
Definition: ccl_learn_ncl.h:77
gsl_matrix * pinvH1
Peuso inverse of H1.
Definition: ccl_learn_ncl.h:57
int dim_y
The dimensionality of the action space.
Definition: ccl_learn_ncl.h:101
int r_ok
check if the objective function is belowed the tolerence
Definition: ccl_learn_ncl.h:102
double s2
The variance of the rbf.
Definition: ccl_learn_ncl.h:36
double * W_
A copy of model parameters.
Definition: ccl_learn_ncl.h:72
This structure describes a "LEARN_NCL_MODEL" (a learn ncl model). This structure constains the diment...
Definition: ccl_learn_ncl.h:30
double * D
Automatic scaling.
Definition: ccl_learn_ncl.h:114
int dim_x
The dimensionality of the state variable.
Definition: ccl_learn_ncl.h:98
CCL header file for math.
gsl_matrix * J
Jacobian matrix.
Definition: ccl_learn_ncl.h:73
double * W
Model parameters.
Definition: ccl_learn_ncl.h:71
double * xc
A copy of the initial model parameters.
Definition: ccl_learn_ncl.h:104
gsl_matrix * BX_
High dimensionality of the input data.
Definition: ccl_learn_ncl.h:55
This structure defines the workspace variables for calculating objective functions.
Definition: ccl_learn_ncl.h:70
int ccl_learn_ncl_model_alloc(LEARN_NCL_MODEL *model)
Allocates the memory for the learn_ncl model.
gsl_matrix * D_pinv
The peudo-inverse of D.
Definition: ccl_learn_ncl.h:131
double nu
The coefficient of changing learning rate.
Definition: ccl_learn_ncl.h:126
CCL header file for learning state dependent constraint.
int * idx
index
Definition: ccl_learn_ncl.h:60
void obj_ncl(const LEARN_NCL_MODEL *model, const double *W, const double *BX, const double *Y, double *fun, double *J)
Computation routine for calculating residual errors.
gsl_matrix * b_n_T
Transpose of BX.
Definition: ccl_learn_ncl.h:75
double lc
Handling situation when learning rate happends to be 0.
Definition: ccl_learn_ncl.h:118
gsl_matrix * BX_
Higher dimensionality of input variable.
Definition: ccl_learn_ncl.h:78
int ccl_learn_model_ws_free(LEARN_MODEL_WS *ws)
Free the memory for LEARN_MODEL_WS structure.
This structure defines the OPTION for the optimizer.
Definition: ccl_learn_alpha.h:145
void ccl_learn_model_dir(LEARN_NCL_MODEL *model, const double *BX, const double *Y)
Computation routine for calculating residual errors.
double * rd_T
The matrix transpose of rd.
Definition: ccl_learn_ncl.h:130
double * xf
The finalised model parameters.
Definition: ccl_learn_ncl.h:106
gsl_matrix * Y_
Output variable.
Definition: ccl_learn_ncl.h:52
This structure defines the workspace variables for solving the non-linear LM optimization.
Definition: ccl_learn_ncl.h:97
int dim_n
The number of data points.
Definition: ccl_learn_ncl.h:34
double * tmp
The temporal variable.
Definition: ccl_learn_ncl.h:129
int ccl_write_ncl_model(char *filename, LEARN_NCL_MODEL *model)
Write model parameters to .txt file.
double Rhi
The upper bound of R.
Definition: ccl_learn_ncl.h:116
void predict_ncl(const LEARN_NCL_MODEL *model, const double *BX, double *Unp)
Prediction of nullspace components.
gsl_vector * A_d
The A matrix at xd.
Definition: ccl_learn_ncl.h:132
gsl_vector * Wb
Dot product of w and b.
Definition: ccl_learn_ncl.h:80
double * d
The parameter improvement gradient.
Definition: ccl_learn_ncl.h:119
gsl_vector * u_n
A col vector of u.
Definition: ccl_learn_ncl.h:76
gsl_vector * r_T
The vector transpose of r.
Definition: ccl_learn_ncl.h:135
double * J
The jacobian at x.
Definition: ccl_learn_ncl.h:110