54 double cost = std::numeric_limits<double>::infinity();
55 std::vector<std::string>
word;
59 return cost == std::numeric_limits<double>::infinity();
85 return a.
word.size() < b.
word.size();
95 "sr_best_path requires nonnegative costs: with a negative one, "
96 "the empty derivation is no longer the best, and a cycle may "
97 "improve a derivation without end.");
99 if(cost == std::numeric_limits<double>::infinity())
103 r.
word.push_back(*label);
115 for(
const auto &x : v)
122 for(
const auto &x : v) {
126 r.
word.insert(r.
word.end(), x.word.begin(), x.word.end());
Generic directed-acyclic-graph circuit template and gate identifier.
Abstract semiring interface for provenance evaluation.
A refusal by design, or a known gap, rather than an error.
The one-best-derivation semiring over best_path_t.
virtual value_type monus(value_type x, value_type y) const override
Apply the monus (m-semiring difference) operation.
virtual bool absorptive() const override
is the best value, on both sides of a product.
static best_path_t leaf(double cost, const std::string *label)
The value of an input of cost cost and label label, no label being the empty word,...
virtual value_type one() const override
Return the multiplicative identity .
virtual value_type zero() const override
Return the additive identity .
virtual bool selective() const override
The sum is the better of two values.
virtual value_type delta(value_type x) const override
Apply the operator.
virtual bool mul_sub_left_distributive() const override
distributes over , on both sides.
virtual bool commutative() const override
Concatenation does not commute.
virtual value_type times(const std::vector< value_type > &v) const override
Apply the multiplicative operation to a list of values.
virtual value_type plus(const std::vector< value_type > &v) const override
Apply the additive operation to a list of values.
virtual value_type star(const value_type &) const override
Every star is , by absorption.
static bool better(const best_path_t &a, const best_path_t &b)
Whether a is strictly better than b.
Abstract base class for (m-)semirings.
#define PROVSQL_DELIBERATE
What kind of limit a refusal or a freezing is.
A cost and a derivation of that cost, as a word of labels.
bool operator==(const best_path_t &o) const
Equality of the cost and the word.
bool operator!=(const best_path_t &o) const
Inequality.
bool is_zero() const
Whether this is .
std::vector< std::string > word
Its labels.