JunctionLP class
#include <gtopt/junction_lp.hpp>
Linear programming formulation for power system junctions.
This class provides the LP formulation for network junctions, including:
- Flow balance constraints (Kirchhoff's current law)
- Optional drain/loss terms
- Scenario/stage specific constraint indexing
The class inherits from ObjectLP<Junction> to provide basic LP object functionality while adding junction-specific constraints.
Base classes
-
template<typename ObjectType ObjectType>class ObjectLP<Junction>
- Wrapper class that adds LP capabilities to objects.
Public types
- using object_type = Junction
- Type of the wrapped object.
Public static variables
- static constexpr LPClassName ClassName
Constructors, destructors, conversion operators
- JunctionLP(const Junction& pjunction, const InputContext& ic) explicit
- Construct a JunctionLP from input data.
Public functions
- auto add_to_lp(const SystemContext& sc, const ScenarioLP& scenario, const StageLP& stage, LinearProblem& lp) -> bool
- Add junction constraints to the linear program.
- auto add_to_output(OutputContext& out) const -> bool
- Add junction results to output context.
- auto balance_rows_at(const ScenarioLP& scenario, const StageLP& stage) const -> const auto&
- Get balance constraint rows for a scenario/stage combination.
- auto class_name(this const Self& self) -> constexpr auto noexcept
- auto drain() const -> constexpr auto noexcept
- auto drain_cols_at(const ScenarioLP& scenario, const StageLP& stage) const -> const auto&
- Get drain variable columns for a scenario/stage combination.
- auto id() const -> constexpr auto noexcept
- auto is_active(const StageLP& stage) const -> constexpr bool
- Checks if object is active in given stage.
- auto junction(this auto&& self) -> constexpr auto&& noexcept
- auto lp_col_label(this const Self& self, SystemContext& sc, const ScenarioLP& scenario, const StageLP& stage, Args && ... args) -> constexpr auto
- auto lp_col_label(this const Self& self, SystemContext& sc, const ScenarioLP& scenario, const StageLP& stage, const BlockLP& block, Args && ... args) -> constexpr auto
- auto lp_label(this const Self& self, SystemContext& sc, const ScenarioLP& scenario, const StageLP& stage, Args && ... args) -> constexpr auto
- auto lp_label(this const Self& self, SystemContext& sc, const ScenarioLP& scenario, const StageLP& stage, const BlockLP& block, Args && ... args) -> constexpr auto
- auto lp_label(this const Self& self, SystemContext& sc, const StageLP& stage, Args && ... args) -> constexpr auto
- auto object() && -> constexpr Junction&& noexcept
- auto object() & -> constexpr Junction& noexcept
- Gets the wrapped object.
- auto object() const && -> constexpr const Junction&& noexcept
- auto object() const & -> constexpr const Junction& 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
- 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.
- auto state_col_label(this const Self& self, SystemContext& sc, const ScenarioLP& scenario, const StageLP& stage, const BlockLP& block, Args && ... args) -> constexpr auto
- 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.
- auto sv_key(this const Self& self, const StageLP& stage, std::string_view col_name) -> constexpr auto noexcept
- auto uid() const -> constexpr auto noexcept
Typedef documentation
using gtopt:: JunctionLP:: object_type = Junction
#include <gtopt/object_lp.hpp>
Type of the wrapped object.
Function documentation
gtopt:: JunctionLP:: JunctionLP(const Junction& pjunction,
const InputContext& ic) explicit
Construct a JunctionLP from input data.
| Parameters | |
|---|---|
| pjunction | Junction data to model |
| ic | Input context providing system-wide parameters |
bool gtopt:: JunctionLP:: add_to_lp(const SystemContext& sc,
const ScenarioLP& scenario,
const StageLP& stage,
LinearProblem& lp)
Add junction constraints to the linear program.
| Parameters | |
|---|---|
| sc | System context containing model parameters |
| scenario | Current scenario LP object. |
| stage | Current stage LP object. |
| lp | Linear program to modify |
| Returns | true if successful, false otherwise |
bool gtopt:: JunctionLP:: add_to_output(OutputContext& out) const
Add junction results to output context.
| Parameters | |
|---|---|
| out | Output context to populate |
| Returns | true if successful, false otherwise |
const auto& gtopt:: JunctionLP:: balance_rows_at(const ScenarioLP& scenario,
const StageLP& stage) const
Get balance constraint rows for a scenario/stage combination.
| Parameters | |
|---|---|
| scenario | Scenario identifier |
| stage | Stage identifier |
| Returns | Const reference to the balance constraint rows |
constexpr auto gtopt:: JunctionLP:: class_name(this const Self& self) noexcept
#include <gtopt/object_lp.hpp>
const auto& gtopt:: JunctionLP:: drain_cols_at(const ScenarioLP& scenario,
const StageLP& stage) const
Get drain variable columns for a scenario/stage combination.
| Parameters | |
|---|---|
| scenario | Scenario identifier |
| stage | Stage identifier |
| Returns | Const reference to the drain variable columns |
constexpr auto gtopt:: JunctionLP:: id() const noexcept
#include <gtopt/object_lp.hpp>
| Returns | The object's complete identifier (uid + name) |
|---|
#include <gtopt/object_utils.hpp>
constexpr auto gtopt:: JunctionLP:: lp_col_label(this const Self& self,
SystemContext& sc,
const ScenarioLP& scenario,
const StageLP& stage,
Args && ... args)
#include <gtopt/object_utils.hpp>
constexpr auto gtopt:: JunctionLP:: lp_col_label(this const Self& self,
SystemContext& sc,
const ScenarioLP& scenario,
const StageLP& stage,
const BlockLP& block,
Args && ... args)
#include <gtopt/object_utils.hpp>
constexpr auto gtopt:: JunctionLP:: lp_label(this const Self& self,
SystemContext& sc,
const ScenarioLP& scenario,
const StageLP& stage,
Args && ... args)
#include <gtopt/object_utils.hpp>
constexpr auto gtopt:: JunctionLP:: lp_label(this const Self& self,
SystemContext& sc,
const ScenarioLP& scenario,
const StageLP& stage,
const BlockLP& block,
Args && ... args)
constexpr Junction&& gtopt:: JunctionLP:: object() && noexcept
#include <gtopt/object_lp.hpp>
constexpr Junction& gtopt:: JunctionLP:: object() & noexcept
#include <gtopt/object_lp.hpp>
Gets the wrapped object.
| Returns | Reference to the wrapped object |
|---|
constexpr const Junction&& gtopt:: JunctionLP:: object() const && noexcept
#include <gtopt/object_lp.hpp>
constexpr const Junction& gtopt:: JunctionLP:: object() const & noexcept
#include <gtopt/object_lp.hpp>
constexpr auto gtopt:: JunctionLP:: short_name(this const Self& self) noexcept
#include <gtopt/object_lp.hpp>
#include <gtopt/object_utils.hpp>
constexpr auto gtopt:: JunctionLP:: 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 |
#include <gtopt/object_utils.hpp>
constexpr auto gtopt:: JunctionLP:: state_col_label(this const Self& self,
SystemContext& sc,
const ScenarioLP& scenario,
const StageLP& stage,
const BlockLP& block,
Args && ... args)
#include <gtopt/object_utils.hpp>
constexpr auto gtopt:: JunctionLP:: 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 |
constexpr auto gtopt:: JunctionLP:: uid() const noexcept
#include <gtopt/object_lp.hpp>
| Returns | The object's unique identifier |
|---|