variables.h
2.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
* 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_ */