gtopt::ScalingState struct

LP-scaling subsystem of a LinearInterface. Groups the Ruiz / equilibration column-row scale vectors, the per-column / per-row objective time-basis (cost-scale-type) vectors, the variable-scale map, the equilibration method, and the raw objective constant. Extracted verbatim from LinearInterface — every mutable qualifier and default initializer is preserved so the COW / clone semantics are bit-identical to the pre-extraction code.

Public variables

std::shared_ptr<std::vector<ConstraintScaleType>> col_cost_scale_types
std::shared_ptr<StrongIndexVector<ColIndex, double>> col_scales
LpEquilibrationMethod equilibration_method
double obj_constant_raw
bool pin_logic_rows
std::shared_ptr<std::vector<ConstraintScaleType>> row_cost_scale_types
std::shared_ptr<StrongIndexVector<RowIndex, double>> row_scales
std::shared_ptr<VariableScaleMap> variable_scale_map

Variable documentation

std::shared_ptr<std::vector<ConstraintScaleType>> gtopt::ScalingState::col_cost_scale_types

Per-column / per-row objective time-basis (Power / Energy / Raw), populated from FlatLinearProblem::col_cost_scale_types / row_cost_scale_types at load_flat. Frozen after flatten (never mutated post-load), so shared_ptr lets shallow clones share without copying — same lifecycle as col_scales. Consumed by OutputContext to choose the inverse cost-factor family when reading reduced costs / duals back to physical units. Out-of-range (post- flatten) indices default to Power via *_cost_scale_type_at.

std::shared_ptr<StrongIndexVector<ColIndex, double>> gtopt::ScalingState::col_scales

Column / row scale vectors. shared_ptr so shallow clones can share with the source — see CloneKind. The scale vectors are populated in load_flat and only mutated post-flatten by set_col_scale / set_row_scale (called when a non-unit col.scale / row.scale is added via add_col(SparseCol) / add_row_raw). Disposable adds explicitly forbid non-unit scales (see add_col_disposable / add_row_disposable) so they never trigger the COW detach branch on the clone side.

LpEquilibrationMethod gtopt::ScalingState::equilibration_method

Equilibration method used at load_flat() time. Persisted so that add_row / add_rows (the post-build cut path) apply the same per-row scaling the bulk build did, keeping kappa stable as cuts accumulate. none means the caller opted out of equilibration at build time and we leave new rows alone.

double gtopt::ScalingState::obj_constant_raw

Constant offset added to get_obj_value_raw(). Stored on the LP raw (post-scale_objective-division) cost scale so it composes additively with the solver's raw value:

get_obj_value_raw() = solver_raw + obj_constant_raw get_obj_value() = get_obj_value_raw() × m_scale_objective_

Propagated from FlatLinearProblem::obj_constant_raw at load_flat time. Copied through native clone / clone-from-flat so clones report the same algebraic objective. Default 0.0 — every model that does not opt in keeps bit-identical raw / phys reports.

Public mutators add_obj_constant / obj_constant are declared in the class's public section near get_obj_value() so callers can adjust the constant POST-load_flat. Callers always pass values in physical units; the API divides by m_scale_objective_ before accumulating here.

bool gtopt::ScalingState::pin_logic_rows

LpMatrixOptions::pin_logic_rows at load_flat() time: add_row / add_rows skip the per-row normalisation of SparseRow::pin_scale rows while it is on.

std::shared_ptr<VariableScaleMap> gtopt::ScalingState::variable_scale_map

Moved from flatten. shared_ptr so shallow clones can share it with the source instead of value-copying — see CloneKind. Mutated only via load_flat (source-side, before any clones) so the COW detach in detach_for_write is dormant in practice.