template<typename ProfileType ProfileType, typename ElementLPType ElementLPType>
gtopt::ProfileObjectLP class

Base class for profile-based LP objects.

Template parameters
ProfileType The profile type (DemandProfile/GeneratorProfile)
ElementLPType The associated element LP type (DemandLP/GeneratorLP)

Base classes

template<typename ObjectType ObjectType>
class ObjectLP<ProfileType>
Wrapper class that adds LP capabilities to objects.

Public types

using Base = ObjectLP<ProfileType>
using object_type = ProfileType
Type of the wrapped object.

Constructors, destructors, conversion operators

ProfileObjectLP(ProfileType pprofile, InputContext& ic, const LPClassName& cname) explicit
Construct a new ProfileObjectLP.

Public functions

auto add_profile_to_lp(std::string_view cname, const SystemContext& sc, const ScenarioLP& scenario, const StageLP& stage, LinearProblem& lp, std::string_view profile_name, const auto& element_cols, const std::optional<ColIndex>& capacity_col, double stage_capacity) -> bool
Add profile constraints to LP.
auto add_profile_to_output(std::string_view cname, OutputContext& out, std::string_view profile_name) const -> bool
Add profile results to output.
auto aperture_value(ScenarioUid scenario_uid, StageUid stage_uid, BlockUid block_uid) const -> std::optional<double>
Return the profile value for a given scenario/stage/block.
auto class_name(this const Self& self) -> constexpr auto 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 ProfileType&& noexcept
auto object() & -> constexpr ProfileType& noexcept
Gets the wrapped object.
auto object() const && -> constexpr const ProfileType&& noexcept
auto object() const & -> constexpr const ProfileType& 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 update_aperture(LinearInterface& li, const ScenarioLP& base_scenario, const std::function<std::optional<double>(StageUid, BlockUid)>& value_fn, const StageLP& stage) const -> bool
Update profile constraint for an aperture scenario.

Typedef documentation

template<typename ProfileType ProfileType, typename ElementLPType ElementLPType>
using gtopt::ProfileObjectLP<ProfileType, ElementLPType>::object_type = ProfileType

Type of the wrapped object.

Function documentation

template<typename ProfileType ProfileType, typename ElementLPType ElementLPType>
gtopt::ProfileObjectLP<ProfileType, ElementLPType>::ProfileObjectLP(ProfileType pprofile, InputContext& ic, const LPClassName& cname) explicit

Construct a new ProfileObjectLP.

Parameters
pprofile The profile object
ic Input context
cname Class name for labeling columns/rows

template<typename ProfileType ProfileType, typename ElementLPType ElementLPType>
bool gtopt::ProfileObjectLP<ProfileType, ElementLPType>::add_profile_to_lp(std::string_view cname, const SystemContext& sc, const ScenarioLP& scenario, const StageLP& stage, LinearProblem& lp, std::string_view profile_name, const auto& element_cols, const std::optional<ColIndex>& capacity_col, double stage_capacity)

Add profile constraints to LP.

Parameters
cname Class name prefix for labeling
sc System context
scenario Scenario
stage Stage
lp Linear problem
profile_name Profile type name ("spillover"/"unserved")
element_cols Element column indices per block
capacity_col Capacity column index (if any)
stage_capacity Stage capacity value
Returns true if successful

template<typename ProfileType ProfileType, typename ElementLPType ElementLPType>
bool gtopt::ProfileObjectLP<ProfileType, ElementLPType>::add_profile_to_output(std::string_view cname, OutputContext& out, std::string_view profile_name) const

Add profile results to output.

Parameters
cname Class name prefix for labeling
out Output context
profile_name Profile type name ("spillover"/"unserved")
Returns true if successful

template<typename ProfileType ProfileType, typename ElementLPType ElementLPType>
constexpr auto gtopt::ProfileObjectLP<ProfileType, ElementLPType>::class_name(this const Self& self) noexcept

template<typename ProfileType ProfileType, typename ElementLPType ElementLPType>
constexpr auto gtopt::ProfileObjectLP<ProfileType, ElementLPType>::id() const noexcept

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

template<typename ProfileType ProfileType, typename ElementLPType ElementLPType>
constexpr bool gtopt::ProfileObjectLP<ProfileType, ElementLPType>::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 ProfileType ProfileType, typename ElementLPType ElementLPType> template<typename Self Self, typename SystemContext SystemContext, typename... Args>
constexpr auto gtopt::ProfileObjectLP<ProfileType, ElementLPType>::lp_col_label(this const Self& self, SystemContext& sc, const ScenarioLP& scenario, const StageLP& stage, Args && ... args)

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

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

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

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

template<typename ProfileType ProfileType, typename ElementLPType ElementLPType>
constexpr ProfileType&& gtopt::ProfileObjectLP<ProfileType, ElementLPType>::object() && noexcept

template<typename ProfileType ProfileType, typename ElementLPType ElementLPType>
constexpr ProfileType& gtopt::ProfileObjectLP<ProfileType, ElementLPType>::object() & noexcept

Gets the wrapped object.

Returns Reference to the wrapped object

template<typename ProfileType ProfileType, typename ElementLPType ElementLPType>
constexpr const ProfileType&& gtopt::ProfileObjectLP<ProfileType, ElementLPType>::object() const && noexcept

template<typename ProfileType ProfileType, typename ElementLPType ElementLPType>
constexpr const ProfileType& gtopt::ProfileObjectLP<ProfileType, ElementLPType>::object() const & noexcept

template<typename ProfileType ProfileType, typename ElementLPType ElementLPType>
constexpr auto& gtopt::ProfileObjectLP<ProfileType, ElementLPType>::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 ProfileType ProfileType, typename ElementLPType ElementLPType>
constexpr auto gtopt::ProfileObjectLP<ProfileType, ElementLPType>::short_name(this const Self& self) noexcept

template<typename ProfileType ProfileType, typename ElementLPType ElementLPType> template<typename Self Self, typename SystemContext SystemContext, typename... Args>
constexpr auto gtopt::ProfileObjectLP<ProfileType, ElementLPType>::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 ProfileType ProfileType, typename ElementLPType ElementLPType> template<typename Self Self, typename SystemContext SystemContext, typename... Args>
constexpr auto gtopt::ProfileObjectLP<ProfileType, ElementLPType>::state_col_label(this const Self& self, SystemContext& sc, const ScenarioLP& scenario, const StageLP& stage, const BlockLP& block, Args && ... args)

template<typename ProfileType ProfileType, typename ElementLPType ElementLPType> template<typename Self Self, typename ScenarioLP ScenarioLP, typename StageLP StageLP>
constexpr auto gtopt::ProfileObjectLP<ProfileType, ElementLPType>::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 ProfileType ProfileType, typename ElementLPType ElementLPType> template<typename Self Self, typename StageLP StageLP>
constexpr auto gtopt::ProfileObjectLP<ProfileType, ElementLPType>::sv_key(this const Self& self, const StageLP& stage, std::string_view col_name) noexcept

template<typename ProfileType ProfileType, typename ElementLPType ElementLPType>
constexpr auto gtopt::ProfileObjectLP<ProfileType, ElementLPType>::uid() const noexcept

Returns The object's unique identifier

template<typename ProfileType ProfileType, typename ElementLPType ElementLPType>
bool gtopt::ProfileObjectLP<ProfileType, ElementLPType>::update_aperture(LinearInterface& li, const ScenarioLP& base_scenario, const std::function<std::optional<double>(StageUid, BlockUid)>& value_fn, const StageLP& stage) const

Update profile constraint for an aperture scenario.

Parameters
li Cloned LinearInterface to modify in-place.
base_scenario Original scenario (identifies stored rows).
value_fn (StageUid, BlockUid) -> optional<double> provider.
stage Stage to update.
Returns true on success.

Re-reads the profile value via value_fn and updates the constraint row accordingly. When a capacity column was used during LP construction, updates the coefficient; otherwise updates the row RHS.