-
Notifications
You must be signed in to change notification settings - Fork 1
/
valbeliefvector.h
67 lines (50 loc) · 1.98 KB
/
valbeliefvector.h
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
62
63
64
65
66
67
#ifndef DSL_VALBELIEFVECTOR_H
#define DSL_VALBELIEFVECTOR_H
// {{SMILE_PUBLIC_HEADER}}
#include "nodeval.h"
#include "dmatrix.h"
//////////////////
// beliefVector //
//////////////////
class DSL_beliefVector : public DSL_nodeValue
{
public:
DSL_beliefVector(int myHandle, DSL_network *theNetwork);
DSL_beliefVector(DSL_nodeValue &likeThisOne);
~DSL_beliefVector();
int GetType() const { return DSL_BELIEFVECTOR; }
void CleanUp(int deep = 0);
int ReCreateFromNetworkStructure();
int operator =(DSL_nodeValue &likeThisOne);
int Clone(DSL_nodeValue &thisGuy);
int GetEvidence() const { return IsEvidence() ? evidence : DSL_OUT_OF_RANGE; }
int SetEvidence(int theEvidence);
int ClearEvidence();
int SetPropagatedEvidence(int theEvidence);
int ClearPropagatedEvidence();
int SetVirtualEvidence(const std::vector<double> &evidence);
int GetVirtualEvidence(std::vector<double> &evidence) const;
DSL_Dmatrix &GetBeliefs() { return beliefs; }
double GetBelief(int thisOne) { return beliefs[thisOne]; }
int SetBelief(int thisOne, double thisValue) {beliefs[thisOne] = thisValue; return DSL_OKAY;}
int SetBelief(DSL_intArray &theCoordinates, double theBelief) { beliefs.Subscript(theCoordinates) = theBelief; return DSL_OKAY; }
//------------------------
// TCL: manipulation
//------------------------
int ControlValue(int theValue);
int ClearControlledValue();
int GetControlledValue() {return IsControlled() ? evidence : DSL_OUT_OF_RANGE; }
int IsControlled() { return IsFlagSet(DSL_VALUE_CONTROLLED) && IsEvidence(); }
bool IsControllable();
// common interface
void *GetValue() { return &GetBeliefs(); }
int GetValue(DSL_Dmatrix **here) { *here = &GetBeliefs(); return DSL_OKAY; }
int SetValue(DSL_Dmatrix &withThis) { return beliefs = withThis; }
private:
int StoreEvidence(int theEvidence);
void ClearVirtualEvidence();
DSL_Dmatrix beliefs;
int evidence;
std::vector<double> *virtualEvidence;
};
#endif