SparseCol class
#include <gtopt/sparse_col.hpp>
Represents a variable column in a linear program.
This class provides a fluent interface for setting variable properties including bounds, objective coefficients, integrality constraints, and a physical-to-LP scale factor.
The scale field records the relationship between the LP variable and the corresponding physical quantity:
physical_value = LP_value × scale
For example, a voltage angle column with scale_theta = 0.0001 stores scale = 0.0001 because theta_physical = theta_LP × 0.0001. A reservoir energy column with energy_scale = 100000 stores scale = 100000 because volume_physical = volume_LP × 100000. All scales follow the same convention — no inversions.
The scale is used by:
- Output rescaling: primal
x_phys = x_LP × scale, reduced costrc_phys = rc_LP / scale. - User constraints (PAMPL):
LinearProblem::get_col_scale()returns the scale so that constraint coefficients are correctly adjusted. - Cross-element references (e.g. ReservoirSeepageLP reading reservoir volume scale to convert seepage slope to LP units).
All methods are constexpr to enable compile-time construction of problems.