103 #ifndef __CCL_LEARN_ALPHA_H
104 #define __CCL_LEARN_ALPHA_H
107 #include <gsl/gsl_linalg.h>
108 #include <gsl/gsl_blas.h>
109 #include <gsl/gsl_math.h>
110 #include <gsl/gsl_sf.h>
115 #define NUM_CONSTRAINT 3
249 void ccl_learn_alpha(
const double * Un,
const double *X,
const int dim_b,
const int dim_r,
const int dim_n,
const int dim_x,
const int dim_u,
LEARN_A_MODEL optimal);
266 void obj_AUn (
const LEARN_A_MODEL* model,
const double* W,
const double* BX,
const double * RnUn,
double* fun_out);
299 void findjac(
const LEARN_A_MODEL* model,
const int dim_x,
const double* BX,
const double * RnUn,
const double *y,
const double*x,
double epsx,
double* J);
int dim_t
Number of parameters needed to represent an unit vector.
Definition: ccl_learn_alpha.h:130
double Sd
The squared error if xd is taken.
Definition: ccl_learn_alpha.h:186
double R
The reduction if xd is taken.
Definition: ccl_learn_alpha.h:188
int dim_k
The dimensionality of the constraints.
Definition: ccl_learn_alpha.h:164
gsl_matrix * D_pinv
The peudo-inverse of D.
Definition: ccl_learn_alpha.h:194
void predict_proj_alpha(double *x, LEARN_A_MODEL *model, double *centres, double variance, double *Iu, double *A)
Computation routine for prediction of the A matrix.
void ccl_get_rotation_matrix(const double *theta, const double *currentRn, const LEARN_A_MODEL *model, const int alpha_id, double *Rn)
Computation routine for rotation matrix after finding the k^th constraint vector. ...
double * J_T
The matrix transpose of J.
Definition: ccl_learn_alpha.h:191
int iter
The iteration number.
Definition: ccl_learn_alpha.h:181
gsl_vector * A_inv_diag
The vector of diagonal elements of A matrix.
Definition: ccl_learn_alpha.h:197
int dim_n
The number of data points.
Definition: ccl_learn_alpha.h:162
double var
The variance of the Un.
Definition: ccl_learn_alpha.h:133
double epsf
The tolerence fo the objective functions.
Definition: ccl_learn_alpha.h:169
gsl_vector * A_d
The A matrix at xd.
Definition: ccl_learn_alpha.h:195
double * xd
The next x.
Definition: ccl_learn_alpha.h:184
double * x
The flattened and updated model parameters.
Definition: ccl_learn_alpha.h:166
int dim_k
The dimensionality of the constraints.
Definition: ccl_learn_alpha.h:131
gsl_vector * r_T
The vector transpose of r.
Definition: ccl_learn_alpha.h:198
gsl_matrix * A_inv
The peudo-inverse of A.
Definition: ccl_learn_alpha.h:196
double * rd
The residual error at xd.
Definition: ccl_learn_alpha.h:185
int dim_r
The dimensionality of the task space.
Definition: ccl_learn_alpha.h:127
#define NUM_CONSTRAINT
Definition: ccl_learn_alpha.h:115
double l
The adaptive learning rate.
Definition: ccl_learn_alpha.h:178
int dim_u
The dimensionality of the action space.
Definition: ccl_learn_alpha.h:161
double Rhi
The upper bound of R.
Definition: ccl_learn_alpha.h:177
int ccl_solve_lm_ws_alloc(const LEARN_A_MODEL *model, SOLVE_LM_WS *lm_ws)
Allocates the workspace memory for the LM solver.
double * d
The parameter improvement gradient.
Definition: ccl_learn_alpha.h:180
double * D
Automatic scaling.
Definition: ccl_learn_alpha.h:175
int dim_x
The dimensionality of the state space.
Definition: ccl_learn_alpha.h:128
int ccl_solve_lm_ws_free(SOLVE_LM_WS *lm_ws)
Free the memory for the LM solver.
double dS
The denomitor of the sqaured error is xd is taken.
Definition: ccl_learn_alpha.h:187
double * c
The mean of the rbf.
Definition: ccl_learn_alpha.h:136
double Rlo
The lower bound of R.
Definition: ccl_learn_alpha.h:176
double * d_T
The matrix transpose of d.
Definition: ccl_learn_alpha.h:190
int dim_b
The number of basis functions.
Definition: ccl_learn_alpha.h:163
This structure defines the workspace variables for solving the non-linear LM optimization.
Definition: ccl_learn_alpha.h:159
void search_learn_alpha(const double *BX, const double *RnUn, LEARN_A_MODEL *model)
Main computation routine for learning a model of A.
int x_ok
check if the model parameters are belowed the tolerence
Definition: ccl_learn_alpha.h:183
void findjac(const LEARN_A_MODEL *model, const int dim_x, const double *BX, const double *RnUn, const double *y, const double *x, double epsx, double *J)
Computation routine for numerical approximation of the objevtive jacobian matrix. ...
int ccl_learn_alpha_model_free(LEARN_A_MODEL *model)
Free the memory for the learn_alpha model.
double * A
The dot product of J_T and J.
Definition: ccl_learn_alpha.h:173
double * r
The returned value of the residual error.
Definition: ccl_learn_alpha.h:170
int dim_x
The dimensionality of the state variable.
Definition: ccl_learn_alpha.h:160
CCL header file for math.
int dim_n
The number of data points.
Definition: ccl_learn_alpha.h:132
double S
The sqaure root if x is taken.
Definition: ccl_learn_alpha.h:172
void ccl_make_given_matrix(const double theta, int i, int j, int dim, double *G)
Computation routine for generating roation matrix of a plane rotation of degree theta in an arbitrary...
int dim_u
The dimensionality of the action space.
Definition: ccl_learn_alpha.h:129
double nmse
The normalised mean square error of the model.
Definition: ccl_learn_alpha.h:134
double s2
The variance of the rbf.
Definition: ccl_learn_alpha.h:137
int ccl_learn_alpha_model_alloc(LEARN_A_MODEL *model)
Allocates the memory for the learn_alpha model.
void ccl_get_unit_vector_from_matrix(const double *theta, int dim_n, int dim_t, double *alpha)
Computation routine for generating unit vector for row vector alpha by given theta anlges...
void obj_AUn(const LEARN_A_MODEL *model, const double *W, const double *BX, const double *RnUn, double *fun_out)
Computation routine for learning constraint by increasing the dimensionality of k.
double nu
The coefficient of changing learning rate.
Definition: ccl_learn_alpha.h:189
double * tmp
The temporal variable.
Definition: ccl_learn_alpha.h:192
double * xc
A copy of the initial model parameters.
Definition: ccl_learn_alpha.h:165
void ccl_solve_lm(const LEARN_A_MODEL *model, const double *RnUn, const double *BX, const OPTION option, SOLVE_LM_WS *lm_ws_param, double *W)
Computation routine for optimizing non-linear objective functions using LM approach.
This structure defines the OPTION for the optimizer.
Definition: ccl_learn_alpha.h:145
double * J
The jacobian at x.
Definition: ccl_learn_alpha.h:171
double * rd_T
The matrix transpose of rd.
Definition: ccl_learn_alpha.h:193
double lc
Handling situation when learning rate happends to be 0.
Definition: ccl_learn_alpha.h:179
double * xf
The finalised model parameters.
Definition: ccl_learn_alpha.h:167
void ccl_learn_alpha(const double *Un, const double *X, const int dim_b, const int dim_r, const int dim_n, const int dim_x, const int dim_u, LEARN_A_MODEL optimal)
Main computation routine for learning state dependent constraint A.
This structure describes a "LEARN_A_MODEL" (a learn alpha model). This structure constains the diment...
Definition: ccl_learn_alpha.h:125
double * v
The dot product of J_T and r.
Definition: ccl_learn_alpha.h:174
int r_ok
check if the objective function is belowed the tolerence
Definition: ccl_learn_alpha.h:182
int dim_b
The number of basis functions.
Definition: ccl_learn_alpha.h:126
double * epsx
The tolerence of the model paramters.
Definition: ccl_learn_alpha.h:168