variable_scale.hpp file
VariableScale struct and VariableScaleMap for LP variable scaling.
Provides a JSON-configurable mechanism for defining LP variable scale factors per element class, variable name, and optional element UID.
The VariableScale struct defines a single scale entry: {"class_name": "Reservoir", "variable": "energy", "scale": 1000.0}
An array of these entries lives in PlanningOptions::variable_scales and is resolved at runtime by VariableScaleMap::lookup() with the following priority:
- Per-element override (matching class + variable + UID)
- Per-class default (matching class + variable, no UID)
- Fallback default (1.0 = no scaling)
Per-element fields (Battery::energy_scale, Reservoir::energy_scale) take precedence over entries in variable_scales.
Global options (scale_theta, scale_alpha) are auto-injected into the variable_scales array by PlanningOptionsLP. All scales follow the same convention physical = LP × scale:
Bus.theta: scale_theta = 1e-4 (theta ~0.01 rad → LP ~100)Sddp.alpha: scale_alpha = 1e7 (alpha ~1e8 $ → LP ~10)Reservoir.energy: energy_scale = 1000 (energy ~1e6 → LP ~1000)
Users can override per-element (UID-specific) entries in variable_scales for fine-grained control.
Namespaces
- namespace gtopt
Classes
- struct gtopt::VariableScale
- Scale definition for an LP variable.
- class gtopt::VariableScaleMap
- Lookup table for variable scales built from an array of VariableScale.