MCPcopy Create free account
hub / github.com/ElementsProject/lightning / reduced_cost

Function reduced_cost

plugins/askrene/child/algorithm.c:329–335  ·  view source on GitHub ↗

Helper. * Compute the reduced cost of an arc. */

Source from the content-addressed store, hash-verified

327/* Helper.
328 * Compute the reduced cost of an arc. */
329static s64 reduced_cost(const struct graph *graph, const struct arc arc,
330 const s64 *cost, const s64 *potential)
331{
332 struct node src = arc_tail(graph, arc);
333 struct node dst = arc_head(graph, arc);
334 return cost[arc.idx] - potential[src.idx] + potential[dst.idx];
335}
336
337/* Finds an optimal path from the source to the nearest sink node, by definition
338 * a node i is a sink if node_balance[i]<0. It uses a reduced cost:

Callers 1

mcf_refinementFunction · 0.85

Calls 2

arc_tailFunction · 0.70
arc_headFunction · 0.70

Tested by

no test coverage detected