gtopt::CapacityObjectBase struct

Base class providing capacity constraint logic for LP objects.

This class handles capacity constraints, expansion capabilities, and associated costs in a linear programming formulation.

Derived classes

template<typename Object Object>
struct CapacityObjectLP
A linear programming representation of an object with capacity constraints.
template<typename Object Object>
struct CapacityObjectLP
A linear programming representation of an object with capacity constraints.
template<typename Object Object>
struct CapacityObjectLP
A linear programming representation of an object with capacity constraints.
template<typename Object Object>
struct CapacityObjectLP
A linear programming representation of an object with capacity constraints.
template<typename Object Object>
struct CapacityObjectLP
A linear programming representation of an object with capacity constraints.
template<typename Object Object>
struct CapacityObjectLP
A linear programming representation of an object with capacity constraints.

Public types

using CapacityAndCol = std::pair<std::optional<double>, std::optional<ColIndex>>
Pair of optional capacity value and optional expansion column index.

Public functions

auto add_to_lp(SystemContext& sc, const ScenarioLP& scenario, const StageLP& stage, LinearProblem& lp) -> bool
Add capacity constraints to the linear problem.
auto add_to_output(OutputContext& out) const -> bool
Add capacity solution data to output context.
auto capacity_and_col(const StageLP& stage, LinearProblem& lp) const -> CapacityAndCol -> constexpr auto
Query capacity value and optional expansion column for a stage.
auto capacity_at(const StageLP& stage, const double def_capacity = std::numeric_limits<double>::max()) const -> constexpr double
Get the capacity at a specific stage.
auto capacity_col_at(const StageLP& stage) const -> constexpr auto noexcept
Get the column index for capacity at a specific stage.
template<typename OF OF>
auto CapacityObjectBase(const InputContext& ic, const LPClassName cname, Id pid, OF&& capacity, OF&& expcap, OF&& capmax, OF&& expmod, OF&& annual_capcost, OF&& annual_derating) -> constexpr explicit
auto id() const -> constexpr const Id& noexcept
auto uid() const -> constexpr auto noexcept

Function documentation

bool gtopt::CapacityObjectBase::add_to_lp(SystemContext& sc, const ScenarioLP& scenario, const StageLP& stage, LinearProblem& lp)

Add capacity constraints to the linear problem.

Parameters
sc System context providing stage/scenario info
scenario Current scenario
stage Current stage
lp Linear problem to modify
Returns true if successful, false otherwise

Adds capacity-related variables and constraints:

  • Capacity installation variables
  • Capacity cost variables
  • Expansion model variables (if applicable)
  • Balance equations between stages
  • Cost tracking equations

bool gtopt::CapacityObjectBase::add_to_output(OutputContext& out) const

Add capacity solution data to output context.

Parameters
out Output context to populate
Returns true if successful, false otherwise

Adds:

  • Solution values for capacity variables
  • Cost values for capacity variables
  • Dual values for capacity constraints

constexpr auto gtopt::CapacityObjectBase::capacity_and_col(const StageLP& stage, LinearProblem& lp) const -> CapacityAndCol

Query capacity value and optional expansion column for a stage.

Parameters
stage The stage to query
lp Linear problem reference (needed for expansion col bounds)

Returns {std::optional<double>, std::optional<ColIndex>}. The capacity is nullopt when no expansion column exists AND no capacity schedule value is defined — i.e. when the physical capacity is truly undefined. Callers that need a numeric fallback should use value_or(default) on the returned optional.

constexpr double gtopt::CapacityObjectBase::capacity_at(const StageLP& stage, const double def_capacity = std::numeric_limits<double>::max()) const

Get the capacity at a specific stage.

Parameters
stage The stage to query capacity for
def_capacity Default value if capacity not specified (default: unlimited)
Returns The capacity at given stage or default if not specified

constexpr auto gtopt::CapacityObjectBase::capacity_col_at(const StageLP& stage) const noexcept

Get the column index for capacity at a specific stage.

Parameters
stage The stage to get column index for
Returns Optional containing column index if exists