source/flow_right_lp.cpp file

Implementation of FlowRightLP methods.

Unified design: Each FlowRight installs a single LP column flow_b per (scenario, stage, block), bounded by the resolved [fmin_b, fmax_b] band. When the target schedule is resolved and at least one of fcost / uvalue is active, the kink at target is expressed via two non-negative slacks and one equality row:

flow_b − excess_b + fail_b = target_b      (`flow_kink` row)
excess_b ≥ 0,  cost(excess_b) = -uvalue·cf
fail_b   ≥ 0,  cost(fail_b)   = +fcost·cf

When use_average = true, the kink machinery is applied once at stage scope to a single qeh column instead of per-block (with stage-aggregate target_e = Σ_b dur_ratio_b × target_b and the stage-level scenario_stage_ecost cost helper).

The helper attach_flow is the single point of truth: it creates the primary column ([fmin, fmax], zero cost) and, when a target is supplied with at least one non-zero slack cost, installs the kink slacks and equality row. It is used identically per-block and once-per-stage on qeh.

The flow right is consumptive: the per-block flow_b is subtracted (coefficient -1) from the upstream Junction balance row when flow_right().junction_a is set.

Namespaces

namespace gtopt