Network Flows and Linear Programming The Mathematical Madness behind the Magic GoldSim Technology Group ©GoldSim Technology Group LLC., 2012 Objective of the Flow Module Given a system of discrete locations connected by conduits of flowing material… …determine the “optimal” flow of material through that network. ©GoldSim Technology Group LLC., 2012 ©GoldSim Technology Group LLC., 2012 ©GoldSim Technology Group LLC., 2012 ©GoldSim Technology Group LLC., 2012 ©GoldSim Technology Group LLC., 2012 Flow Solver ©GoldSim Technology Group LLC., 2012 GoldSim 10.5: Solve using iteration Benefits Optimal allocation of material Mass conservation Integrates handling of flow and transport Built-in storage functions Integrated handling of priorities and costs Influence lines represent flows ©GoldSim Technology Group LLC., 2012 What do we mean by “Optimal”? Meaning 1: Maximal Profit (e.g., commodity distribution) – – Meaning 2: Prioritized Flow (e.g., water distribution) – If the network is controlled by a single operator selling to multiple customers, then the goal is to maximize profit. Example: Natural gas distributor (PSE) In this case water is divided up based on various users’ priorities: Priority 1 users get first dibs on water until all their demands are met… …and so on until the lowest priority (farmers) get what’s left over. The prioritized flow method uses the same underlying functions as maximal profit ©GoldSim Technology Group LLC., 2012 Flowing “Media” The quantity of liquids and/or solids that flow from one discrete location to another. Examples: water, CO2, rocks, sediment in water. Assume incompressible and volume is additive, taking porosity of any solid media into account. – For example, 1 gallon of water dumped into a tank containing 1 gallon of sediment whose porosity is 0.3 would consume a total volume of 1.7 gallons (1 gal of Water + (1 – 0.3)*1 gal of Sediment). ©GoldSim Technology Group LLC., 2012 Cells (Any Flow Network Elements) Model elements that produce, consume, store, or route fluid. Examples: – Pump – Evaporation – Detention pond – A city – Stockpile Source ©GoldSim Technology Group LLC., 2012 Router Store Sink User_Spec_Media Flows (Influence Lines) Flow links transport fluid from one cell to another. We denote the value of a flow with 𝑞𝑗 . Units of media volume (or mass) per unit time (e.g., gal/day, kg/sec) Examples: – A connection from one stretch of river (a reach) to another. – A pipe leading from a lake to a farm – Deliveries to a customer ©GoldSim Technology Group LLC., 2012 Flow, 𝑞1 Flow Capacity and Costs In most cases, a flux has a maximum capacity 𝑞𝑗,𝑚𝑎𝑥 , so we have constraints of the form: 𝑞𝑗 ≤ 𝑞𝑗,𝑚𝑎𝑥 Sometimes it costs money to transport fluid along a particular flux. – This affects the net profit. ©GoldSim Technology Group LLC., 2012 0 ≤ 𝑞1 ≤ 𝑞𝑚𝑎𝑥 Source Cells A source cell feeds fluid into the system. Source cells have infinite supply, but their outflow rate(s) may be limited. Examples: – Rainfall in a particular geographic area – CO2 from a power plant – Sediments from erosion ©GoldSim Technology Group LLC., 2012 Sink Cells A sink cell removes fluid from the system. The capacity of sink to absorb fluid is infinite, but the inflow rate may be limited. Examples: – Evaporation – Outflow from a river (model boundary) – Consumers ©GoldSim Technology Group LLC., 2012 Zero-Volume Cells (Routers) Fixed-volume cells have no ability to store fluid, so their net inflow rate must match their net outflow rate: 𝑑𝑉 = 𝑑𝑡 𝑞𝑖𝑛 − 𝑞𝑜𝑢𝑡 = 0 In other words, they must have flow balance. In this example, the router would impose the constraint: 𝑞1 − 𝑞2 − 𝑞3 = 0. Specified media cells are old-style cells that are used to upgrade old CT models. ©GoldSim Technology Group LLC., 2012 𝑞1 𝑞2 𝑞3 User-Specified Cells Cells found in current GoldSim version (CT module) Distinct from Routers, which have zero volume Implications on CT models (need volume for concentration to make sense) ©GoldSim Technology Group LLC., 2012 Dynamic Volume Cells (Stores) The rate of change of fluid volume in that cell is equal to the sum of all inflows minus the sum of outflows: 𝑑𝑉 = 𝑑𝑡 𝑞𝑜𝑢𝑡 If a dynamic cell is empty, outflow must be <= inflow: 𝑑𝑉 𝑑𝑡 𝑞𝑖𝑛 − = 𝑞𝑖𝑛 − 𝑞𝑜𝑢𝑡 ≥ 0 (nondecreasing volume) If the cell is full, inflow <= outflow: 𝑑𝑉 𝑑𝑡 = 𝑞𝑖𝑛 − ©GoldSim Technology Group LLC., 2012 𝑞𝑜𝑢𝑡 ≤ 0 (nonincreasing volume) Store Cells Attributes ©GoldSim Technology Group LLC., 2012 Demand Priorities and Revenues Some cells (cities, farms) will pay for water. – This counts as revenue in the operator’s profit function. Some users have priorities (water rights) – Priorities converted to costs in the solver For each flux 𝑞𝑗 , its net benefit 𝑐𝑗 is: 𝑐𝑗 = (revenue due to 𝑞𝑗 ) – (cost of 𝑞𝑗 ). ©GoldSim Technology Group LLC., 2012 Simple Example… ©GoldSim Technology Group LLC., 2012