/* * variables.h * * Created on: 21/08/2014 * Author: pedro */ #ifndef SRC_VARIABLES_H_ #define SRC_VARIABLES_H_ #include "constraints.h" extern var* VS; // Vector with all the CSP variables extern var* VS_LOCK; // Vector with temporary CSP variables when optimizing extern var* VS_LOCK_BEST; // Vector with the current best solution when optimizing extern var* VS_AUX; // Vector with all the CSP variables for increasing size and sorting extern var* VS_AUX2; // Vector with all the CSP variables for sorting unsigned int v_new_val(unsigned int val); unsigned int v_new_vals(unsigned int* vals, unsigned int n_vals, bool to_label); unsigned int v_new_range(unsigned int min, unsigned int max, bool to_label); bool v_contains_val(var* v, unsigned int val); void vs_copy(var* v_dest, var* v_src, unsigned int n_vs); void vs_clear(); bool v_intersect_v(var *v1, var *v2); bool v_union_v(var *v1, var *v2); bool v_del_val(var* v, int val); bool v_del_singl_val(var *v_to_chg, var *singl_v); bool v_del_lt(var *v, int val); bool v_del_le(var *v, int val); bool v_del_gt(var *v, int val); bool v_del_ge(var *v, int val); bool v_del_all_except_val(var *v, int val); void vs_copy_host_to_dev(void** dev_bs, var* host_vs, unsigned int n_bs); void vs_copy_dev_to_host(var* host_vs, void** dev_bs, unsigned int n_bs); int vs_cnt_vs_to_label(var* vs, unsigned int n_vs); void v_add_constr(var* v, constr* cs); void v_rem_constr(var* v, constr* cs);; unsigned int vs_cnt_cs(var* vs, unsigned int n_vs); void vs_sort_label_first(); void vs_sort_label_more_vals_first(); void vs_sort_label_less_vals_first(); void vs_sort_constr(var* vs, unsigned int n_vs); int v_get_value(unsigned int v_id); int v_get_min(unsigned int v_id); int v_get_max(unsigned int v_id); void v_print_single_val(unsigned int v_id, unsigned int offset); void vs_print_single_val(unsigned int* vs_id, unsigned int n_vs_id, unsigned int offset); void vs_print_vals(unsigned int* vs_id, unsigned int n_vs_id, unsigned int offset); void vs_print_min(unsigned int* vs_id, unsigned int n_vs_id, unsigned int offset); void vs_print_max(unsigned int* vs_id, unsigned int n_vs_id, unsigned int offset); void v_print_cost(unsigned int offset); void vs_print_domain(unsigned int* vs_id, unsigned int n_vs_id); #endif /* SRC_VARIABLES_H_ */