new helper constructor for DiscreteConditional
parent
73f54083a7
commit
a71008d7fd
|
@ -24,13 +24,13 @@
|
||||||
#include <gtsam/hybrid/HybridValues.h>
|
#include <gtsam/hybrid/HybridValues.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <cassert>
|
||||||
#include <random>
|
#include <random>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using std::pair;
|
using std::pair;
|
||||||
|
@ -47,6 +47,15 @@ DiscreteConditional::DiscreteConditional(const size_t nrFrontals,
|
||||||
const DecisionTreeFactor& f)
|
const DecisionTreeFactor& f)
|
||||||
: BaseFactor(f / (*f.sum(nrFrontals))), BaseConditional(nrFrontals) {}
|
: BaseFactor(f / (*f.sum(nrFrontals))), BaseConditional(nrFrontals) {}
|
||||||
|
|
||||||
|
/* ************************************************************************** */
|
||||||
|
DiscreteConditional::DiscreteConditional(size_t nrFrontals,
|
||||||
|
const DecisionTreeFactor& f,
|
||||||
|
const Ordering& orderedKeys)
|
||||||
|
: BaseFactor(f), BaseConditional(nrFrontals) {
|
||||||
|
keys_.clear();
|
||||||
|
keys_.insert(keys_.end(), orderedKeys.begin(), orderedKeys.end());
|
||||||
|
}
|
||||||
|
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
DiscreteConditional::DiscreteConditional(size_t nrFrontals,
|
DiscreteConditional::DiscreteConditional(size_t nrFrontals,
|
||||||
const DiscreteKeys& keys,
|
const DiscreteKeys& keys,
|
||||||
|
|
|
@ -56,6 +56,17 @@ class GTSAM_EXPORT DiscreteConditional
|
||||||
/// Construct from factor, taking the first `nFrontals` keys as frontals.
|
/// Construct from factor, taking the first `nFrontals` keys as frontals.
|
||||||
DiscreteConditional(size_t nFrontals, const DecisionTreeFactor& f);
|
DiscreteConditional(size_t nFrontals, const DecisionTreeFactor& f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Construct from DecisionTreeFactor,
|
||||||
|
* taking the first `nrFrontals` from `orderedKeys`.
|
||||||
|
*
|
||||||
|
* @param nrFrontals The number of frontal variables.
|
||||||
|
* @param f The DecisionTreeFactor to construct from.
|
||||||
|
* @param orderedKeys Ordered list of keys involved in the conditional.
|
||||||
|
*/
|
||||||
|
DiscreteConditional(size_t nrFrontals, const DecisionTreeFactor& f,
|
||||||
|
const Ordering& orderedKeys);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct from DiscreteKeys and AlgebraicDecisionTree, taking the first
|
* Construct from DiscreteKeys and AlgebraicDecisionTree, taking the first
|
||||||
* `nFrontals` keys as frontals, in the order given.
|
* `nFrontals` keys as frontals, in the order given.
|
||||||
|
|
Loading…
Reference in New Issue