Dedekind 0.0.0
A structuralist C++23 Module Library
Loading...
Searching...
No Matches
dedekind::optimization::Relax< S, Cap, CostFn > Struct Template Referenceexport

Fold step of the single-source semiring closure: relax the potential at e.head through the edge e, d(v) ← d(v) ⊕ d(u) ⊗ c(u,v). More...

Public Types

using Add = typename dedekind::algebra::semiring_ops<S>::add
 The carrier's canonical additive op ⊕ (semiring_ops).
using Mult = typename dedekind::algebra::semiring_ops<S>::mult
 The carrier's canonical multiplicative op ⊗ (semiring_ops).

Public Member Functions

constexpr FiniteNet< S, Cap > operator() (FiniteNet< S, Cap > acc, const Edge &e) const
 Relax e.head: d(head) ← d(head) ⊕ d(tail) ⊗ c(tail,head), returning the new net — the fold step op(acc, Edge).

Public Attributes

CostFn cost
 The edge-cost function c(tail,head); the only captured state.

Detailed Description

template<typename S, std::size_t Cap, typename CostFn = S (*)(std::size_t, std::size_t)>
requires dedekind::category::IsSemiring< S, typename dedekind::algebra::semiring_ops<S>::add, typename dedekind::algebra::semiring_ops<S>::mult> && requires(const CostFn& cost, std::size_t u) { { cost(u, u) } -> std::convertible_to<S>; }
struct dedekind::optimization::Relax< S, Cap, CostFn >

Fold step of the single-source semiring closure: relax the potential at e.head through the edge e, d(v) ← d(v) ⊕ d(u) ⊗ c(u,v).

The named replacement for the capturing relax lambda (#920): the closure structure — which cost the fold threads — is an inspectable type rather than a nameless closure. The semiring ops ⊕ / ⊗ are fixed by the carrier S itself (semiring_ops) rather than exposed as parameters, so cost is the only captured state. Models the fold step op(acc, Edge), returning the new net.

Note
The ops are the carrier's canonical semiring (the IsSemiring gate). cost is a bare BINARY callable (edge → weight, a raw lambda at the call site) with no Domain / Codomain, so it is gated structurally (a requires on cost), NOT by IsArrow, which models a unary morphism and would reject every caller.


The documentation for this struct was generated from the following file: