template<typename Object Object>
gtopt::CapacityObjectLP struct

A linear programming representation of an object with capacity constraints.

Template parameters
Object The type of object being modeled, must provide capacity-related attributes

Base classes

template<typename ObjectType ObjectType>
class ObjectLP<Object>
Wrapper class that adds LP capabilities to objects.
struct CapacityObjectBase
Base class providing capacity constraint logic for LP objects.

Public types

using Base = ObjectLP<Object>
using CapacityAndCol = std::pair<std::optional<double>, std::optional<ColIndex>>
Pair of optional capacity value and optional expansion column index.
using object_type = Object
Type of the wrapped object.

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 ObjectT ObjectT>
auto CapacityObjectLP(ObjectT&& pobject, const InputContext& ic, const LPClassName cname) -> constexpr explicit
Construct a new CapacityObjectLP object.
auto class_name(this const Self& self) -> constexpr auto noexcept
auto id() const -> constexpr const Id& noexcept
auto id() const -> constexpr auto noexcept
auto is_active(const StageLP& stage) const -> constexpr bool
Checks if object is active in given stage.
template<typename Self Self, typename SystemContext SystemContext, typename... Args>
auto lp_col_label(this const Self& self, SystemContext& sc, const ScenarioLP& scenario, const StageLP& stage, Args && ... args) -> constexpr auto
template<typename Self Self, typename SystemContext SystemContext, typename... Args>
auto lp_col_label(this const Self& self, SystemContext& sc, const ScenarioLP& scenario, const StageLP& stage, const BlockLP& block, Args && ... args) -> constexpr auto
template<typename Self Self, typename SystemContext SystemContext, typename... Args>
auto lp_label(this const Self& self, SystemContext& sc, const ScenarioLP& scenario, const StageLP& stage, Args && ... args) -> constexpr auto
template<typename Self Self, typename SystemContext SystemContext, typename... Args>
auto lp_label(this const Self& self, SystemContext& sc, const ScenarioLP& scenario, const StageLP& stage, const BlockLP& block, Args && ... args) -> constexpr auto
template<typename Self Self, typename SystemContext SystemContext, typename... Args>
auto lp_label(this const Self& self, SystemContext& sc, const StageLP& stage, Args && ... args) -> constexpr auto
auto object() && -> constexpr Object&& noexcept
auto object() & -> constexpr Object& noexcept
Gets the wrapped object.
auto object() const && -> constexpr const Object&& noexcept
auto object() const & -> constexpr const Object& noexcept
auto set_id(Uid uid, Name name) -> constexpr auto& noexcept
Sets the object's identifier.
auto short_name(this const Self& self) -> constexpr auto noexcept
template<typename Self Self, typename SystemContext SystemContext, typename... Args>
auto state_col_label(this const Self& self, SystemContext& sc, const ScenarioLP& scenario, const StageLP& stage, Args && ... args) -> constexpr auto
Generates a label for a variable in the optimization problem.
template<typename Self Self, typename SystemContext SystemContext, typename... Args>
auto state_col_label(this const Self& self, SystemContext& sc, const ScenarioLP& scenario, const StageLP& stage, const BlockLP& block, Args && ... args) -> constexpr auto
template<typename Self Self, typename ScenarioLP ScenarioLP, typename StageLP StageLP>
auto sv_key(this const Self& self, const ScenarioLP& scenario, const StageLP& stage, std::string_view col_name) -> constexpr auto noexcept
Generates a state variable key for the object.
template<typename Self Self, typename StageLP StageLP>
auto sv_key(this const Self& self, const StageLP& stage, std::string_view col_name) -> constexpr auto noexcept
auto uid() const -> constexpr auto noexcept
auto uid() const -> constexpr auto noexcept

Typedef documentation

template<typename Object Object>
using gtopt::CapacityObjectLP<Object>::object_type = Object

Type of the wrapped object.

Function documentation

template<typename Object Object>
bool gtopt::CapacityObjectLP<Object>::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

template<typename Object Object>
bool gtopt::CapacityObjectLP<Object>::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

template<typename Object Object>
constexpr auto gtopt::CapacityObjectLP<Object>::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.

template<typename Object Object> template<typename ObjectT ObjectT>
constexpr gtopt::CapacityObjectLP<Object>::CapacityObjectLP(ObjectT&& pobject, const InputContext& ic, const LPClassName cname) explicit

Construct a new CapacityObjectLP object.

Template parameters
ObjectT Type of object being wrapped (deduced)
Parameters
pobject The object to wrap, will be moved if rvalue
ic Input context providing stage/scenario information
cname Class name for labeling columns/rows

Initializes all capacity-related schedules from the wrapped object:

  • Base capacity
  • Expansion capacity
  • Maximum capacity
  • Expansion model
  • Annual capacity costs
  • Annual derating factors

template<typename Object Object>
constexpr auto gtopt::CapacityObjectLP<Object>::class_name(this const Self& self) noexcept

template<typename Object Object>
constexpr auto gtopt::CapacityObjectLP<Object>::id() const noexcept

Returns The object's complete identifier (uid + name)

template<typename Object Object>
constexpr bool gtopt::CapacityObjectLP<Object>::is_active(const StageLP& stage) const

Checks if object is active in given stage.

Parameters
stage The stage to check
Returns true if active in stage, false otherwise

template<typename Object Object> template<typename Self Self, typename SystemContext SystemContext, typename... Args>
constexpr auto gtopt::CapacityObjectLP<Object>::lp_col_label(this const Self& self, SystemContext& sc, const ScenarioLP& scenario, const StageLP& stage, Args && ... args)

template<typename Object Object> template<typename Self Self, typename SystemContext SystemContext, typename... Args>
constexpr auto gtopt::CapacityObjectLP<Object>::lp_col_label(this const Self& self, SystemContext& sc, const ScenarioLP& scenario, const StageLP& stage, const BlockLP& block, Args && ... args)

template<typename Object Object> template<typename Self Self, typename SystemContext SystemContext, typename... Args>
constexpr auto gtopt::CapacityObjectLP<Object>::lp_label(this const Self& self, SystemContext& sc, const ScenarioLP& scenario, const StageLP& stage, Args && ... args)

template<typename Object Object> template<typename Self Self, typename SystemContext SystemContext, typename... Args>
constexpr auto gtopt::CapacityObjectLP<Object>::lp_label(this const Self& self, SystemContext& sc, const ScenarioLP& scenario, const StageLP& stage, const BlockLP& block, Args && ... args)

template<typename Object Object> template<typename Self Self, typename SystemContext SystemContext, typename... Args>
constexpr auto gtopt::CapacityObjectLP<Object>::lp_label(this const Self& self, SystemContext& sc, const StageLP& stage, Args && ... args)

template<typename Object Object>
constexpr Object&& gtopt::CapacityObjectLP<Object>::object() && noexcept

template<typename Object Object>
constexpr Object& gtopt::CapacityObjectLP<Object>::object() & noexcept

Gets the wrapped object.

Returns Reference to the wrapped object

template<typename Object Object>
constexpr const Object&& gtopt::CapacityObjectLP<Object>::object() const && noexcept

template<typename Object Object>
constexpr const Object& gtopt::CapacityObjectLP<Object>::object() const & noexcept

template<typename Object Object>
constexpr auto& gtopt::CapacityObjectLP<Object>::set_id(Uid uid, Name name) noexcept

Sets the object's identifier.

Parameters
uid Unique identifier
name Human-readable name
Returns Reference to self for chaining

template<typename Object Object>
constexpr auto gtopt::CapacityObjectLP<Object>::short_name(this const Self& self) noexcept

template<typename Object Object> template<typename Self Self, typename SystemContext SystemContext, typename... Args>
constexpr auto gtopt::CapacityObjectLP<Object>::state_col_label(this const Self& self, SystemContext& sc, const ScenarioLP& scenario, const StageLP& stage, Args && ... args)

Generates a label for a variable in the optimization problem.

Parameters
self Reference to the object
sc System context
scenario Scenario context
stage Stage context
args Additional arguments to include in the label
Returns Label string

template<typename Object Object> template<typename Self Self, typename SystemContext SystemContext, typename... Args>
constexpr auto gtopt::CapacityObjectLP<Object>::state_col_label(this const Self& self, SystemContext& sc, const ScenarioLP& scenario, const StageLP& stage, const BlockLP& block, Args && ... args)

template<typename Object Object> template<typename Self Self, typename ScenarioLP ScenarioLP, typename StageLP StageLP>
constexpr auto gtopt::CapacityObjectLP<Object>::sv_key(this const Self& self, const ScenarioLP& scenario, const StageLP& stage, std::string_view col_name) noexcept

Generates a state variable key for the object.

Parameters
self Reference to the object
scenario Scenario context
stage Stage context
col_name The column name for the state variable
Returns StateVariable::Key

template<typename Object Object> template<typename Self Self, typename StageLP StageLP>
constexpr auto gtopt::CapacityObjectLP<Object>::sv_key(this const Self& self, const StageLP& stage, std::string_view col_name) noexcept

template<typename Object Object>
constexpr auto gtopt::CapacityObjectLP<Object>::uid() const noexcept

Returns The object's unique identifier