gtopt/active_ref.hpp file

Tolerant cross-element references for add_to_lp / update_lp.

Reference rule (R4 of the add_to_lp audit): a reference to another element that is inactive in the stage, or whose per-(scenario, stage) or per-block LP entity was elided (zero-bound skip, inactive cell), never throws. The consumer omits the dependent term (= 0) and, when the omission is not a routine elision, says so ONCE per element via warn_ref_once.

const auto* junction = active_ref(sc, JunctionLPSId {ref}, stage);
if (junction == nullptr) { warn_ref_once(...); return true; }
const auto* rows = junction->find_balance_rows(scenario, stage);

An UNRESOLVABLE reference (unknown uid / name) is a referential- integrity error caught by validate_planning; active_ref keeps throwing for it (through SystemContext::element).

Namespaces

namespace gtopt