LAD Project: the QUESTION Module


Summary: The QUESTION object serves the following purpose. It is a data structure that the client programmer may construct in order to create [question]s to ask function approximators. A question contains a query vector, which is a vector from in input domain. It may optionally hold an target vector, which is from the output domain. And it holds a set of boolean flags, each indexed by a req_type. So what's a req_type? Read on. A Req_type is a combination of:
a desired_value, which is one of the following #defined integer symbols: OUTPUT GRADIENT NOISE HESSIAN TARGET OPTIMUM.
a detail, which is one of the following: VALUE CONF or DIST.
The meaning of a req_type can be found by calling req_type_explain_string(req_type_of(desired_value,detail)); A req_type also has associated with it an ANSWER_TYPE, which can be one of

NUMBER_ANSWER_TYPE

DYV_ANSWER_TYPE

DYM_ANSWER_TYPE

DYM_ARRAY_ANSWER_TYPE

DIST_ANSWER_TYPE.

int req_type_of(int desired_value,int detail);
(/* Returns an integer code denoting the kind of request as a function of the desired_value, which must be of the desired_value constants #defined in question.h and the detail which must be one of the detail constants #defined in question.h

char *name_of_detail(int detail);
(/* Returns a mustn't be updated string giving the name associated with one of the #defined detail constants in question.h

char *name_of_desired_value(int desired_value);
(/* Returns a mustn't-be-updated string giving the name of the desired value

char *name_of_req_type(int req_type);
(/* Returns a mustn't be updated string denoting the req_type

char *req_type_explain_string(int req_type);
(/* Returns a mustn't be updated string explaining in 80 characters or less the meaning of requests of this req_type

int *req_type_answer_type(int req_type);
(/* Returns one of the #defined XXX_ANSWER_TYPE constants defined in question.h

[question] *mk_question(dyv *query);
(/* Makes a COPY of query

void free_question([question] *qu);
(/* Frees [question] and all its subcomponents

void fprintf_question(FILE *s,char *m1,[question] *qu,char *m2);
(/* Prints the question to s in the standard form

dyv *question_query([question] *qu);
(/* Returns a mustn't-be-updated-or-freed-only-valid-while-qu-exists pointer to a dyv. The query from which the question was made

void request([question] *qu,int req_type);
(/* Adds the request denoted by req_type to the question

bool requested([question] *qu,int req_type);
(/* Returns TRUE if and only if the request denoted by req_type is in the question

void add_target_to_question([question] *qu,dyv *target);
(/* Makes a COPY of target and stores it in question. Only relevant if the TARGET desired_value is to be used. No target may have previously been added.

dyv *question_target([question] *qu);
(/* Returns a mustn't-be-updated-or-freed-only-valid-while-qu-exists pointer to a dyv. The target stored in the dyv. Returns NULL if no target was stored.