CCL Library
1.0
|
CCL header file for learning state dependent constraint. More...
#include <ccl_math.h>
#include <gsl/gsl_linalg.h>
#include <gsl/gsl_blas.h>
#include <gsl/gsl_math.h>
#include <gsl/gsl_sf.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
Go to the source code of this file.
Data Structures | |
struct | LEARN_A_MODEL |
This structure describes a "LEARN_A_MODEL" (a learn alpha model). This structure constains the dimentionality of the defined problems and the model parameters. It should always initialised with ccl_learn_alpha_model_alloc, and destroyed with ccl_learn_alpha_model_free. More... | |
struct | OPTION |
This structure defines the OPTION for the optimizer. More... | |
struct | SOLVE_LM_WS |
This structure defines the workspace variables for solving the non-linear LM optimization. More... | |
Macros | |
#define | NUM_CONSTRAINT 3 |
Functions | |
int | ccl_learn_alpha_model_alloc (LEARN_A_MODEL *model) |
Allocates the memory for the learn_alpha model. More... | |
int | ccl_learn_alpha_model_free (LEARN_A_MODEL *model) |
Free the memory for the learn_alpha model. More... | |
int | ccl_solve_lm_ws_alloc (const LEARN_A_MODEL *model, SOLVE_LM_WS *lm_ws) |
Allocates the workspace memory for the LM solver. More... | |
int | ccl_solve_lm_ws_free (SOLVE_LM_WS *lm_ws) |
Free the memory for the LM solver. More... | |
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. More... | |
void | search_learn_alpha (const double *BX, const double *RnUn, LEARN_A_MODEL *model) |
Main computation routine for learning a model of A. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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 plane and dimension R. More... | |
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. More... | |
CCL header file for learning state dependent constraint.
#define NUM_CONSTRAINT 3 |
NUM_CONSTRAINT is the default full rank of the task constraint
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.
[in] | theta | Theta from kth constrains, must point to an arrary of 1 * dim_t doubles |
[in] | currentRn | Rotation matrix from the last iteration, must point to an array of dim_u * dim_u of doubles |
[in] | model | Must be pointer to a valid LEARN_A_MODEL structure |
[in] | alpha_id | Current searching dimension of alpha |
[out] | Rn | Returned rotation matrix, must point to an array of dim_u * dum_u doubles |
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.
[in] | theta | Learned constraint parameters, must point to an array of dim_n * dim_t doubles |
[in] | dim_n | Number of data samples |
[in] | dim_t | Number of constraint parameters |
[out] | A uit vector of constraint basis, must point to an array of dim_n * dim_u doubles |
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.
[in] | Un | Observed actions, Must point to an array of dim_u * dim_n of doubles |
[in] | X | Observed state variables, Must point to an array of dim_x * dim_n of doubles |
[in] | dim_b | Number of basis functions |
[in] | dim_r | Dimensionality of the task space |
[in] | dim_n | NUmber of data points |
[in] | dim_x | Dimensionality of the state variables |
[in] | dim_u | Dimensionality of the action space |
[out] | optimal,optimal | model paramters |
int ccl_learn_alpha_model_alloc | ( | LEARN_A_MODEL * | model | ) |
Allocates the memory for the learn_alpha model.
[in] | model | Must point to a valid LEARN_A_MODEL structure |
int ccl_learn_alpha_model_free | ( | LEARN_A_MODEL * | model | ) |
Free the memory for the learn_alpha model.
[in] | model | Must point to a valid LEARN_A_MODEL structure |
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 plane and dimension R.
[in] | theta | Degree of rotation, must point to a scalar doubles |
[in] | i | Row index of matrix |
[in] | j | Col index of matrix |
[in] | dim | Dimensionality of the rotation matrix |
[out] | G | Returned rotation matrix, must point to an array of dim_u * dum_u doubles |
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.
[in] | model | Must be pointer to a valid LEARN_A_MODEL structure. |
[in] | RnUn | Pre-calculated dot product of Rn and Un, must point to an array of dim_u * dim_n of doubles |
[in] | BX | Transformed state variables, must point to an array of dim_b * dim_n of doubles |
[in] | option | Options for optimizer |
[in] | lm_ws_param | Must point to a valid structure of SOLVE_LM_WS for LM optimizer workspace variables |
[out] | W | Returned model parameter, must point to an array of dim_u-dum_k doubles |
int ccl_solve_lm_ws_alloc | ( | const LEARN_A_MODEL * | model, |
SOLVE_LM_WS * | lm_ws | ||
) |
Allocates the workspace memory for the LM solver.
[in] | model | Must point to a valid LEARN_A_MODEL structure |
[in] | lm_ws | Must point to a valid lm workspace structure |
int ccl_solve_lm_ws_free | ( | SOLVE_LM_WS * | lm_ws | ) |
Free the memory for the LM solver.
[in] | lm_ws | Must point to a valid lm workspace structure |
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.
[in] | model | Must be pointer to a valid LEARN_A_MODEL structure |
[in] | dim_x | Dimensionality of the model parameters |
[in] | BX | Transformed state variables, must point to an array of dim_b * dim_n of doubles |
[in] | RnUn | Pre-calculated dot product of Rn and Un, must point to an array of dim_u * dim_n of doubles |
[in] | y | Residual calculated at x, must point to a scalar of double. |
[in] | x | Current model parameter x, must point to an array of dim_x doubles, note here dim_x is not the dimension of the state variable |
[in] | epsx | Tolerance of the model parameters |
[out] | J | Returned jocabian matrix, must point to an array of dim_n * dim_x doubles |
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.
[in] | model | Must be pointer to a valid LEARN_A_MODEL structure. |
[in] | W | Current model parameter, must point to an array of dim_u-dum_k doubles. |
[in] | RnUn | Pre-calculated dot product of Rn and Un, must point to an array of dim_u * dim_n of doubles |
[out] | Residual value returned from the objective function, must point to a scalar of double |
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.
[in] | x | Input state variable, must point to an array of dim_x doubles |
[in] | model | Must be pointer to a valid LEARN_A_MODEL structure |
[in] | centres | Rbf centers, must point to an array of 1 * dim_b doubles. |
[in] | variance | Variance of the rbf |
[in] | Iu | Identity matrix, must point to an array of dim_u * dim_u doubles |
[out] | A | Constraint A matrix, must point to an array of dim_k * dum_u doubles |
void search_learn_alpha | ( | const double * | BX, |
const double * | RnUn, | ||
LEARN_A_MODEL * | model | ||
) |
Main computation routine for learning a model of A.
[in] | BX | Transformed state variables, must point to an array of dim_b * dim_n of doubles |
[in] | RnUn | Pre-calculated dot product of Rn and Un, must point to an array of dim_u * dim_n of doubles |
[in] | model | model paramters, must point to a valid LEARN_A_MODEL structure |
[out] | model | model paramters, must point to a valid LEARN_A_MODEL structure |