pulsatrix
Loading...
Searching...
No Matches
datalog_weighted_engine.hpp
Go to the documentation of this file.
1
7#pragma once
8
9#include <vector>
10
15
16namespace pulsatrix::datalog {
17
68template <typename Semiring>
70 const std::vector<Rule>& rules, const WeightedFactDatabase<typename Semiring::Value>& initial_facts);
71
98template <typename Semiring>
100 const std::vector<Rule>& rules, const WeightedFactDatabase<typename Semiring::Value>& initial_facts);
101
102// Explicit instantiation declarations -- definitions + explicit instantiations for the two
103// Semiring types Mission 1 shipped (BooleanSemiring, RealSemiring<double>) live in
104// datalog_weighted_engine.cpp, mirroring datalog_weighted_fact_database.hpp/.cpp's own
105// declaration/definition split.
107 const std::vector<Rule>&, const WeightedFactDatabase<bool>&);
108extern template WeightedFactDatabase<double> naive_evaluate_weighted<RealSemiring<double>>(
109 const std::vector<Rule>&, const WeightedFactDatabase<double>&);
111 const std::vector<Rule>&, const WeightedFactDatabase<bool>&);
112extern template WeightedFactDatabase<double> semi_naive_evaluate_weighted<RealSemiring<double>>(
113 const std::vector<Rule>&, const WeightedFactDatabase<double>&);
114
115// Phase 3 Mission 2 additive extension: a third Semiring instantiation, DualSemiring<double>
116// (see datalog_dual_semiring.hpp) -- the forward-mode-AD differentiable case. Zero changes to
117// naive_evaluate_weighted/semi_naive_evaluate_weighted's own template bodies; this is exactly
118// what Mission 1's Decision 3 (templates, not a virtual interface) was for -- a brand new
119// Semiring is "one more ordinary instantiation of one generic algorithm," not an engine change.
120extern template WeightedFactDatabase<DualNumber<double>> naive_evaluate_weighted<DualSemiring<double>>(
121 const std::vector<Rule>&, const WeightedFactDatabase<DualNumber<double>>&);
122extern template WeightedFactDatabase<DualNumber<double>> semi_naive_evaluate_weighted<DualSemiring<double>>(
123 const std::vector<Rule>&, const WeightedFactDatabase<DualNumber<double>>&);
124
125} // namespace pulsatrix::datalog
A weighted fact database: a map from ground atom to a semiring value type T (bool for the trivial/boo...
Definition datalog_weighted_fact_database.hpp:49
Forward-mode-automatic-differentiation semiring (DualNumber<T>/DualSemiring<T>) – a second,...
A Datalog rule: head :- body1, body2, ..., range-restricted (safe) by construction....
Generic provenance-semiring abstraction (zero/one/add=(+)/mul=(x)) plus the boolean (trivial) and rea...
A map from ground Datalog atom to a semiring-typed weight. Phase 3 Mission 1 of campaign_exai_dl_libr...
Definition datalog_atom.hpp:14
WeightedFactDatabase< typename Semiring::Value > naive_evaluate_weighted(const std::vector< Rule > &rules, const WeightedFactDatabase< typename Semiring::Value > &initial_facts)
Naive bottom-up fixpoint evaluation, generalized over any Semiring-shaped Semiring (see datalog_semir...
WeightedFactDatabase< typename Semiring::Value > semi_naive_evaluate_weighted(const std::vector< Rule > &rules, const WeightedFactDatabase< typename Semiring::Value > &initial_facts)
The semi-naive-named weighted counterpart of naive_evaluate_weighted.
template WeightedFactDatabase< bool > naive_evaluate_weighted< BooleanSemiring >(const std::vector< Rule > &, const WeightedFactDatabase< bool > &)
template WeightedFactDatabase< bool > semi_naive_evaluate_weighted< BooleanSemiring >(const std::vector< Rule > &, const WeightedFactDatabase< bool > &)