LpValidationStats struct
#include <gtopt/lp_validation.hpp>
Per-kind counters + bounded list of offenders + max/min trackers.
Each note_* method is the central hook called from the LinearInterface write path. They:
- bump the per-kind count,
- if under the warning cap and the value is out of band, emit a single spdlog::warn line with the location (column / row name, index, or both),
- record the value in
first_huge_*if room remains.
The struct is cheap to construct and lives on LinearInterface. When the LP completes, log_summary() emits one info line summarising the counts (or stays silent when nothing tripped).
Public types
- struct Offender
-
using OffenderList = boost::container::small_vector<Offender, k_
offenders_ capped>
Public static variables
- static size_t k_offenders_capped
Public functions
- auto clean() const -> bool noexcept
- Returns true when no validation event has been recorded.
- void log_summary() const
- Convenience wrapper using spdlog's default logger.
- void log_summary(spdlog::logger& lg) const
-
template<class Loc>void note_bound(double v, const Loc& loc, const LpValidationOptions& cfg)
- void note_bound(double v, std::string_view location, const LpValidationOptions& cfg)
-
template<class Loc>void note_coeff(double v, const Loc& loc, const LpValidationOptions& cfg)
-
template<class RowLoc, class ColLoc>void note_coeff(double v, const RowLoc& row, const ColLoc& col, const LpValidationOptions& cfg)
- void note_coeff(double v, std::string_view location, const LpValidationOptions& cfg)
-
template<class Loc>void note_filtered(double original, double eps, const Loc& loc, const LpValidationOptions& cfg)
- void note_filtered(double original, double eps, std::string_view location, const LpValidationOptions& cfg)
- void note_nan(double v, std::string_view kind, std::string_view location, const LpValidationOptions& cfg)
-
template<class Loc>void note_obj(double v, const Loc& loc, const LpValidationOptions& cfg)
- void note_obj(double v, std::string_view location, const LpValidationOptions& cfg)
-
template<class Loc>void note_rhs(double v, const Loc& loc, const LpValidationOptions& cfg)
- void note_rhs(double v, std::string_view location, const LpValidationOptions& cfg)
- void reset() noexcept
- Reset all counters (used between phases / scenes).
- auto total_count() const -> size_t noexcept
Public variables
- size_t bound_huge_count
- size_t coeff_filtered_count
- size_t coeff_huge_count
- Per-kind counts (always incremented, even past the warn cap).
- size_t coeff_tiny_count
- OffenderList first_filtered_coeffs
- OffenderList first_huge_bounds
- OffenderList first_huge_coeffs
- First k_offenders_capped offenders for each kind (for the summary).
- OffenderList first_huge_obj
- OffenderList first_huge_rhs
- OffenderList first_nans
- OffenderList first_tiny_coeffs
- double max_abs_coeff
- double min_abs_coeff
- size_t nan_count
- size_t obj_huge_count
- size_t rhs_huge_count
Function documentation
void gtopt:: LpValidationStats:: log_summary(spdlog::logger& lg) const
Emit one spdlog::info summary line covering all six counters. Stays silent when every count is zero (clean LP).
void gtopt:: LpValidationStats:: note_filtered(double original,
double eps,
std::string_view location,
const LpValidationOptions& cfg)
original was filtered out by the matrix eps even though it was non-zero. Bookkeeping: if the dropped value is large enough to be physically meaningful, a warning is emitted; otherwise only the count is bumped.
void gtopt:: LpValidationStats:: note_nan(double v,
std::string_view kind,
std::string_view location,
const LpValidationOptions& cfg)
Record a NaN seen by any hook (kind names the hook for the log). Always logged at ERROR (up to the per-kind cap) — NaN is a hard modelling/numerics fault, unlike the threshold WARNs above.
size_t gtopt:: LpValidationStats:: total_count() const noexcept
Total number of warnings emitted (across all kinds). Used by the post-equilibration verdict to decide whether to escalate from info to warn.
Variable documentation
static size_t gtopt:: LpValidationStats:: k_offenders_capped
Maximum number of offending values stored verbatim per kind. Beyond this only counts are kept.
double gtopt:: LpValidationStats:: max_abs_coeff
Min/max |coefficient| seen across all note_coeff calls (for the summary verdict). These are always tracked when validation is on, regardless of the warn thresholds.
size_t gtopt:: LpValidationStats:: nan_count
NaN values seen by any hook. Unlike ±infinity (a legitimate "no bound" sentinel the solvers handle correctly, silently skipped by the magnitude checks), NaN is NEVER legitimate — a NaN row can make CPLEX iterate forever (its termination tests never satisfy; observed 2026-07-02 as a multi-hour wedge on a NaN Benders cut).