Repository navigation
Expand file tree
/
Copy pathvariable.cpp
More file actions
61 lines (50 loc) · 1.92 KB
/
Copy pathvariable.cpp
File metadata and controls
61 lines (50 loc) · 1.92 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
60
61
#include "dstruct/factor_graph/variable.h"
namespace dd{
Variable::Variable(){}
Variable::Variable(const long & _id, const int & _domain_type,
const bool & _is_evid, const VariableValue & _lower_bound,
const VariableValue & _upper_bound, const VariableValue & _init_value,
const VariableValue & _current_value, const int & _n_factors){
this->id = _id;
this->domain_type = _domain_type;
this->is_evid = _is_evid;
this->lower_bound = _lower_bound;
this->upper_bound = _upper_bound;
this->assignment_evid = _init_value;
this->assignment_free = _current_value;
this->n_factors = _n_factors;
this->isactive = false;
this->component_id = -1;
}
bool VariableInFactor::satisfiedUsing(int value) const{
return is_positive ? equal_to == value : !(equal_to == value);
}
VariableInFactor::VariableInFactor(){
}
VariableInFactor::VariableInFactor(int dummy,
const int & _dimension,
const long & _vid, const int & _n_position,
const bool & _is_positive){
this->dimension = _dimension;
this->vid = _vid;
this->n_position = _n_position;
this->is_positive = _is_positive;
this->equal_to = 1.0;
}
VariableInFactor::VariableInFactor(const long & _vid, const int & _n_position,
const bool & _is_positive){
this->dimension = -1;
this->vid = _vid;
this->n_position = _n_position;
this->is_positive = _is_positive;
this->equal_to = 1.0;
}
VariableInFactor::VariableInFactor(const long & _vid, const int & _n_position,
const bool & _is_positive, const VariableValue & _equal_to){
this->dimension = -1;
this->vid = _vid;
this->n_position = _n_position;
this->is_positive = _is_positive;
this->equal_to = _equal_to;
}
}