165 #define SML_INTERNAL_ERROR 3
167 #define SML_VARIABLE_NAME_MAX_LEN (127)
651 #define SML_VARIABLES_LIST_FOREACH(sml, list, len, var, i) \
652 for (i = 0, len = sml_variables_list_get_length(sml, list); \
653 i < len && ((var = sml_variables_list_index(sml, list, i))); \
bool sml_variable_set_value(struct sml_object *sml, struct sml_variable *sml_variable, float value)
Set the variable value.
bool sml_set_output_state_changed_callback(struct sml_object *sml, sml_change_cb output_state_changed_cb, void *data)
Register a change callback.
uint16_t sml_variables_list_get_length(struct sml_object *sml, struct sml_variables_list *list)
Get the sml_variables_list size.
bool sml_set_max_memory_for_observations(struct sml_object *sml, unsigned int max_size)
Set maximum memory that can be used to store observation history data.
int sml_variable_get_name(struct sml_object *sml, struct sml_variable *sml_variable, char *var_name, size_t var_name_size)
Get sml_variable name.
bool sml_set_stabilization_hits(struct sml_object *sml, uint16_t hits)
Set the stabilization hits.
struct sml_variables_list * sml_get_output_list(struct sml_object *sml)
Return the output variables list.
struct sml_variable * sml_new_input(struct sml_object *sml, const char *name)
Create a new input variable.
bool(* sml_read_state_cb)(struct sml_object *sml, void *data)
A user defined callback to read the variables values.
Definition: sml.h:203
bool sml_variables_list_contains(struct sml_object *sml, struct sml_variables_list *list, struct sml_variable *var)
Check if sml_variable is present in a sml_variables_list.
void sml_print_debug(struct sml_object *sml, bool full)
Prints SML debug information.
bool sml_load(struct sml_object *sml, const char *path)
Load the SML state from the disk.
bool sml_remove_variable(struct sml_object *sml, struct sml_variable *variable)
Remove a variable from the engine.
struct sml_variable * sml_new_output(struct sml_object *sml, const char *name)
Create a new output variable.
bool sml_variable_is_enabled(struct sml_object *sml, struct sml_variable *variable)
Check if a sml_variable is enabled.
struct sml_variables_list * sml_get_input_list(struct sml_object *sml)
Return the input variables list.
bool sml_predict(struct sml_object *sml)
Make a prediction based on the most recent observations.
void(* sml_change_cb)(struct sml_object *sml, struct sml_variables_list *changed, void *data)
Called every time the SML made a prediction.
Definition: sml.h:212
float sml_variable_get_value(struct sml_object *sml, struct sml_variable *sml_variable)
Get the variable current value.
bool sml_variable_get_range(struct sml_object *sml, struct sml_variable *sml_variable, float *min, float *max)
Get variable range.
bool sml_set_learn_disabled(struct sml_object *sml, bool disable)
Disable the SML learning.
struct sml_variable * sml_get_output(struct sml_object *sml, const char *name)
Get input variable by name.
bool sml_variable_set_range(struct sml_object *sml, struct sml_variable *sml_variable, float min, float max)
Set variable range.
struct sml_variable * sml_variables_list_index(struct sml_object *sml, struct sml_variables_list *list, uint16_t index)
Get sml_variable by index.
bool sml_load_fll_file(struct sml_object *sml, const char *filename)
Reads a FLL file.
int sml_process(struct sml_object *sml)
Process variables and make predictions.
bool sml_set_read_state_callback(struct sml_object *sml, sml_read_state_cb read_state_cb, void *data)
Register a read callblack.
void sml_free(struct sml_object *sml)
Frees the SML engine.
bool sml_set_debug_log_file(struct sml_object *sml, const char *str)
Set the file to be used to debug data changes in this engine.
int sml_variable_set_enabled(struct sml_object *sml, struct sml_variable *variable, bool enabled)
Enable or disable a variable.
struct sml_variable * sml_get_input(struct sml_object *sml, const char *name)
Get input variable by name.
bool sml_save(struct sml_object *sml, const char *path)
Save the SML state on the disk.
bool sml_load_debug_log_file(struct sml_object *sml, const char *str)
Load to current engine the debug data logged to a file.
bool sml_erase_knowledge(struct sml_object *sml)
Erase all previous knowledge.