The objective function(1a) maximizes the total welfare, which is given by the total demand served and the total supply, transformation, and transport costs. Tominac and Zavala have used duality theory to show that maximizing the total welfare is equivalent to maximizing total stakeholder profit. The constraint (1b) ensures that all product flows are balanced; i.e., any products supplied to the market are consumed by another stakeholder, accounting for any product transportation or transformation. These balances hold at every geographical location n ∈ N and for each product p ∈ P. The dual variable (shadow price) of each of these constraints (π n,p ) is the clearing price of product p at the location node n. We use subsets to simplify the notation for transport: L in n,p is the subset of transport providers l ∈ L who deliver product p to node n, and similarly L out n,p are those who transport p away from n. We use a similar notation for product transformation with the set M gen n,p used to represent those technologies producing a product p at node n and M con n,p those technologies consuming it. The parameters γ m,p are the input and output yield coefficients for each technology (e.g., how many units of electricity can be produced/unit of manure). Constraints (1c) to (1f) are the capacity limitations for each stakeholder, including dairy farms, waste or electricity transporter, MP systems, and the electricity consumer.