55 return std::numeric_limits<double>::infinity();
61 if(v.empty())
return zero();
62 return *std::min_element(v.begin(), v.end());
76 return a >= 0 ? 0.0 : -std::numeric_limits<double>::infinity();
79 return std::accumulate(v.begin(), v.end(), 0.0);
83 return x>=y ?
zero() : x;
145 "the nonnegative tropical semiring requires nonnegative "
146 "costs (use sr_tropical without nonnegative => true for "
147 "arbitrary costs, on acyclic provenance only)");
Abstract semiring interface for provenance evaluation.
Exception thrown when a semiring operation is not supported.
Abstract base class for (m-)semirings.
Tropical (min-plus) m-semiring restricted to nonnegative costs.
virtual bool absorptive() const override
Return true if this semiring is absorptive ( for all ).
value_type parse_leaf(const char *v) const
Tropical (min-plus) m-semiring over double.
virtual value_type plus(const std::vector< value_type > &v) const override
Apply the additive operation to a list of values.
value_type parse_leaf(const char *v) const
virtual bool selective() const override
returns one of its arguments; absorptive only on nonnegative costs (TropicalNonneg).
virtual bool has_star() const override
A cycle of nonnegative cost adds nothing to the best derivation ( ), one of negative cost makes it un...
virtual bool compatibleWithBooleanRewrite() const override
No semiring homomorphism BoolFunc(Y) →+* Tropical exists (the min-plus structure cannot be made Boole...
virtual value_type star(const value_type &a) const override
, the sum of the powers of a.
virtual value_type delta(value_type x) const override
Apply the operator.
virtual bool mul_sub_left_distributive() const override
distributes over , so the HAVING MIN / MAX comparisons take the single-scan closed form (inherited by...
virtual value_type monus(value_type x, value_type y) const override
Apply the monus (m-semiring difference) operation.
virtual value_type one() const override
Return the multiplicative identity .
virtual value_type zero() const override
Return the additive identity .
virtual value_type times(const std::vector< value_type > &v) const override
Apply the multiplicative operation to a list of values.