Skip to content

Conversation

dellaert
Copy link
Member

@dellaert dellaert commented Jan 5, 2023

GTSAM suffers from having created many different "custom methods" in FactorGraph to add factors. It would be much nicer to be as close as possible to a std::vector. Since the hybrid API is still in complete beta, I am proposing to radically simplify, starting with HybridBayesNet, by getting rid of the non-standard methods in favor of:

  • hbn.emplace_back(new GaussianMixture...));
  • hbn.emplace_back(new GaussianConditional...));
  • hbn.emplace_back(new DiscreteConditional...));

Adding shared pointers also works, should you need them somewhere else:

  • hbn.push_back(shared_ptr_to_a_conditional);

Note, in python things are automatically shared pointers, so there we always use push_back.

Similarly, we just use at:

  • hbn.at(i).asMixture();
  • hbn.at(i).asGaussian();
  • hbn.at(i).asDiscrete();

@ProfFan was very helpful making this work.

Copy link
Contributor

@varunagrawal varunagrawal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dellaert dellaert merged commit a3b177c into develop Jan 6, 2023
@dellaert dellaert deleted the hybrid/simplifiedAPI branch January 6, 2023 03:27
@dellaert dellaert added this to the Hybrid Inference milestone Feb 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants