64 std::vector<DiscreteValues> assignments;
67 friend std::ostream& operator<<(std::ostream& os,
const Slot& slot) {
68 os <<
"Slot with " << slot.assignments.size()
69 <<
" assignments, heuristic=" << slot.heuristic;
70 os <<
", factor:\n" << slot.factor->markdown() << std::endl;
83 : error(err), assignment(assign) {}
84 friend std::ostream& operator<<(std::ostream& os,
const Solution& sn) {
85 os <<
"[ error=" << sn.error <<
" assignment={" << sn.assignment <<
"}]";
108 bool buildJunctionTree =
false);
127 void print(
const std::string& name =
"DiscreteSearch: ",
138 const std::vector<Slot>&
slots()
const {
return slots_; }
150 std::vector<Solution> run(
size_t K = 1)
const;
159 double computeHeuristic();
162 std::vector<Slot> slots_;
165using DiscreteSearchSolution = DiscreteSearch::Solution;
Discrete Bayes Tree, the result of eliminating a DiscreteJunctionTree.
Global functions in a separate testing namespace.
Definition chartTesting.h:28
KeyFormatter DefaultKeyFormatter
Assign default key formatter.
Definition Key.cpp:30
std::function< std::string(Key)> KeyFormatter
Typedef for a function to format a key, i.e. to convert it to a string.
Definition Key.h:35
A Bayes net made from discrete conditional distributions.
Definition DiscreteBayesNet.h:38
A Bayes tree representing a Discrete distribution.
Definition DiscreteBayesTree.h:74
Elimination tree for discrete factors.
Definition DiscreteEliminationTree.h:33
std::shared_ptr< DiscreteFactor > shared_ptr
shared_ptr to this class
Definition DiscreteFactor.h:46
A Discrete Factor Graph is a factor graph where all factors are Discrete, i.e.
Definition DiscreteFactorGraph.h:100
An EliminatableClusterTree, i.e., a set of variable clusters with factors, arranged in a tree,...
Definition DiscreteJunctionTree.h:54
double lowerBound() const
Return lower bound on the cost-to-go for the entire search.
Definition DiscreteSearch.h:135
const std::vector< Slot > & slots() const
Read access to the slots.
Definition DiscreteSearch.h:138
void print(const std::string &name="DiscreteSearch: ", const KeyFormatter &formatter=DefaultKeyFormatter) const
Print the tree to cout.
Definition DiscreteSearch.cpp:215
static DiscreteSearch FromFactorGraph(const DiscreteFactorGraph &factorGraph, const Ordering &ordering, bool buildJunctionTree=false)
Construct from a DiscreteFactorGraph.
Definition DiscreteSearch.cpp:179
DiscreteSearch(const DiscreteEliminationTree &etree)
Construct from a DiscreteEliminationTree.
Definition DiscreteSearch.cpp:145
We structure the search as a set of slots, each with a factor and a set of variable assignments that ...
Definition DiscreteSearch.h:62
A map from keys to values.
Definition DiscreteValues.h:34