CCL Library
1.0
|
CCL header file for learning state independent constraint. More...
#include <ccl_math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <gsl/gsl_linalg.h>
#include <gsl/gsl_blas.h>
#include <gsl/gsl_math.h>
#include <gsl/gsl_sf.h>
Go to the source code of this file.
Data Structures | |
struct | NHAT_search |
This structure defines the searching parameters for NHAT_search. More... | |
struct | NHAT_Model |
This structure defines the model parameters for NHAT_Model. More... | |
struct | NHAT_result |
This structure defines the model parameters for NHAT_result. More... | |
Macros | |
#define | NUM_SEARCH 27000 |
#define | NUM_CONSTRAINT 4 |
Functions | |
int | init_search_param (NHAT_search *search, int dim_u, int dim_n, int num_theta) |
Initialisation of the searching parameters. More... | |
int | nhat_mem_alloc_search (NHAT_search *search) |
Allocates the memory for NHAT_search. More... | |
int | nhat_mem_free_search (NHAT_search *search) |
Free the memory for NHAT_search. More... | |
int | nhat_mem_alloc_model (NHAT_Model *model, const NHAT_search *search) |
Allocates the memory for NHAT_Model. More... | |
int | nhat_mem_free_model (NHAT_Model *model) |
Free the memory for NHAT_Model. More... | |
int | nhat_duplicate_model (NHAT_Model *dest, const NHAT_Model *src) |
Duplicate the NHAT_Model model from src to dest. More... | |
void | get_unit_vector (const double *theta, int dim_t, double *alpha) |
Computation routine for generating unit vector for row vector alpha by given theta anlges. More... | |
void | generate_search_space (NHAT_search *search) |
Generate search space. More... | |
void | search_first_alpha (const double *Vn, const double *Un, NHAT_Model *model, const NHAT_search *search, double *stats) |
Search first row of A matrix. More... | |
void | search_alpha_nhat (const double *Vn, const double *Un, NHAT_Model *model, const NHAT_search *search, NHAT_Model *model_out, double *stats) |
Search the rest rows of A matrix. More... | |
void | learn_nhat (const double *Un, const int dim_u, const int dim_n, NHAT_Model *optimal) |
Main computation routine for learn nhat. More... | |
void | calclate_N (double *N, const double *A, int row, int col) |
Calculation of nullspace projection matrix. More... | |
int | nhat_mem_alloc_result (NHAT_Model *model, const NHAT_search search, int dim_c) |
Allocates the memory for model results. More... | |
int | nhat_mem_free_result (NHAT_result *result, int n_models) |
Free the memory for model results. More... | |
int | nhat_mem_alloc_optimal (NHAT_Model *optimal, const NHAT_search search, int dim_c) |
Allocates the memory for optimal model. More... | |
int | nhat_mem_free_optimal (NHAT_Model *optimal) |
Free the memory for optimal model. More... | |
CCL header file for learning state independent constraint.
#define NUM_CONSTRAINT 4 |
NUM_CONSTRAINT is the default full rank of the task constraint
#define NUM_SEARCH 27000 |
NUM_SEARCH is the search dimension
void calclate_N | ( | double * | N, |
const double * | A, | ||
int | row, | ||
int | col | ||
) |
Calculation of nullspace projection matrix.
[in] | A | Constraint matrix, must point to an array of dim_u * dim_u doubles |
[in] | row | Number of rows |
[in] | col | Number of cols |
[out] | N | Projection matrix |
void generate_search_space | ( | NHAT_search * | search | ) |
Generate search space.
[in] | search | Must point to a valid NHAT_search structure |
[out] | search | Must point to a valid NHAT_search structure |
void get_unit_vector | ( | const double * | theta, |
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 1 * dim_t doubles |
[in] | dim_t | Number of constraint parameters |
[out] | A uit vector of constraint basis, must point to an array of 1 * dim_u doubles |
int init_search_param | ( | NHAT_search * | search, |
int | dim_u, | ||
int | dim_n, | ||
int | num_theta | ||
) |
Initialisation of the searching parameters.
[in] | search | Must be pointer to a valid NHAT_search structure |
[in] | dim_u | Dimensionality of action space |
[in] | dim_n | Number of data samples |
[in] | num_theta | Number of candidate constraints (from 0 to pi) |
void learn_nhat | ( | const double * | Un, |
const int | dim_u, | ||
const int | dim_n, | ||
NHAT_Model * | optimal | ||
) |
Main computation routine for learn nhat.
[in] | Un | Observed actions |
[in] | dim_u | Dimensionality of action space |
[in] | dim_n | Number of data samples |
[out] | optimal | Must point to a valid NHAT_Model structure |
int nhat_duplicate_model | ( | NHAT_Model * | dest, |
const NHAT_Model * | src | ||
) |
Duplicate the NHAT_Model model from src to dest.
[in] | dest | Must point to a valid NHAT_Model structure |
[in] | src | Must point to a valid NHAT_Model structure |
int nhat_mem_alloc_model | ( | NHAT_Model * | model, |
const NHAT_search * | search | ||
) |
Allocates the memory for NHAT_Model.
[in] | model | Must point to a valid NHAT_Model structure |
[in] | search | Must point to a valid NHAT_search structure |
int nhat_mem_alloc_optimal | ( | NHAT_Model * | optimal, |
const NHAT_search | search, | ||
int | dim_c | ||
) |
Allocates the memory for optimal model.
[in] | optimal | Must point to a valid NHAT_Model structure |
[in] | search | Must point to a valid NHAT_search structure |
[in] | dim_c | Current dimension of constraints |
int nhat_mem_alloc_result | ( | NHAT_Model * | model, |
const NHAT_search | search, | ||
int | dim_c | ||
) |
Allocates the memory for model results.
[in] | model | Must point to a valid NHAT_Model structure |
[in] | search | Must point to a valid NHAT_search structure |
[in] | dim_c | Current dimension of constraints |
int nhat_mem_alloc_search | ( | NHAT_search * | search | ) |
Allocates the memory for NHAT_search.
[in] | search | Must point to a valid NHAT_search structure |
int nhat_mem_free_model | ( | NHAT_Model * | model | ) |
Free the memory for NHAT_Model.
[in] | model | Must point to a valid NHAT_Model structure |
int nhat_mem_free_optimal | ( | NHAT_Model * | optimal | ) |
Free the memory for optimal model.
[in] | optimal | Must point to a valid NHAT_Model structure |
int nhat_mem_free_result | ( | NHAT_result * | result, |
int | n_models | ||
) |
Free the memory for model results.
[in] | result | Must point to a valid NHAT_result structure |
[in] | n_models | Number of constraints |
int nhat_mem_free_search | ( | NHAT_search * | search | ) |
Free the memory for NHAT_search.
[in] | search | Must point to a valid NHAT_search structure |
void search_alpha_nhat | ( | const double * | Vn, |
const double * | Un, | ||
NHAT_Model * | model, | ||
const NHAT_search * | search, | ||
NHAT_Model * | model_out, | ||
double * | stats | ||
) |
Search the rest rows of A matrix.
[in] | Vn | Pre-calculation of Un*Un' |
[in] | Un | Observed actions |
[in] | model | Must point to a valid NHAT_Model structure from a previous model |
[in] | search | Must point to a valid NHAT_search structure |
[out] | model | Must point to a valid NHAT_Model structure |
[out] | stats | Statistics of model learning |
void search_first_alpha | ( | const double * | Vn, |
const double * | Un, | ||
NHAT_Model * | model, | ||
const NHAT_search * | search, | ||
double * | stats | ||
) |
Search first row of A matrix.
[in] | Vn | Pre-calculation of Un*Un' |
[in] | Un | Observed actions |
[in] | search | Must point to a valid NHAT_search structure |
[out] | model | Must point to a valid NHAT_Model structure |
[out] | stats | Statistics of model learning |