#include <gtopt/object_lp.hpp>
template<typename ObjectType>
ObjectLP class
Wrapper class that adds LP capabilities to objects.
| Template parameters | |
|---|---|
| ObjectType | The type of object being wrapped |
This class maintains the original object while adding functionality needed for linear programming, such as activity tracking across stages.
Base classes
- class ObjectUtils
- Provides common utility methods for objects in the optimization framework.
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.
-
template<typename Object Object>struct CapacityObjectLP
- A linear programming representation of an object with capacity constraints.
-
template<typename Object Object>class StorageLP
-
template<typename Object Object>class StorageLP
-
template<typename Object Object>class StorageLP
-
template<typename Object Object>class StorageLP
Public types
- using Element = ObjectType
- using object_type = ObjectType
- Type of the wrapped object.
Constructors, destructors, conversion operators
-
template<typename OT>ObjectLP(OT&& pobject) explicit constexpr
- Constructs an ObjectLP by moving in an object.
-
template<typename OT>ObjectLP(OT&& pobject, const InputContext& ic, const LPClassName cname) explicit constexpr
-
template<typename OT>ObjectLP(OT&& pobject, const InputContext& ic, std::string_view cname) explicit constexpr
Public functions
-
template<typename Self>auto class_name(this const Self& self) -> auto noexcept
- auto id() const -> auto noexcept
-
template<typename StageLP StageLP>auto is_active(const StageLP& stage) const -> bool
- Checks if object is active in given stage.
- auto object() && -> ObjectType&& noexcept
- auto object() & -> ObjectType& noexcept
- Gets the wrapped object.
- auto object() const && -> const ObjectType&& noexcept
- auto object() const & -> const ObjectType& noexcept
- auto set_id(Uid uid, Name name) -> auto& noexcept
- Sets the object's identifier.
-
template<typename Self>auto short_name(this const Self& self) -> auto noexcept
-
template<typename 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) -> auto noexcept
- Generates a state variable key for the object.
-
template<typename Self, typename StageLP StageLP>auto sv_key(this const Self& self, const StageLP& stage, std::string_view col_name) -> auto noexcept
- auto uid() const -> auto noexcept
Typedef documentation
template<typename ObjectType>
using gtopt:: ObjectLP<ObjectType>:: Element = ObjectType
Alias for the wrapped data-struct type. Lets generic code reach the canonical LPClassName constant via T::Element::class_name where T is any LP wrapper inheriting from ObjectLP. Single source of truth for the class-name constant lives on the data struct (Bus::class_name, Reservoir::class_name, …); the LP wrappers no longer carry a duplicate ClassName member.
Function documentation
template<typename ObjectType>
template<typename OT>
gtopt:: ObjectLP<ObjectType>:: ObjectLP(OT&& pobject) explicit constexpr
Constructs an ObjectLP by moving in an object.
| Parameters | |
|---|---|
| pobject | The object to wrap and manage No InputContext is available here, so a file-backed active schedule ("active": "<file>") cannot be resolved: it is rejected with a clear error instead of failing later, at LP build, with an opaque "invalid arrow array or index" (issue #544). Every LP element wrapper must use the (object, ic, class_name) overload. |
template<typename ObjectType>
auto gtopt:: ObjectLP<ObjectType>:: id() const noexcept
| Returns | The object's complete identifier (uid + name) |
|---|
template<typename ObjectType>
ObjectType& gtopt:: ObjectLP<ObjectType>:: object() & noexcept
Gets the wrapped object.
| Returns | Reference to the wrapped object |
|---|
#include <gtopt/object_utils.hpp>
template<typename ObjectType>
template<typename Self, typename ScenarioLP ScenarioLP, typename StageLP StageLP>
auto gtopt:: ObjectLP<ObjectType>:: 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 |
#include <gtopt/object_utils.hpp>
template<typename ObjectType>
template<typename Self, typename StageLP StageLP>
auto gtopt:: ObjectLP<ObjectType>:: sv_key(this const Self& self,
const StageLP& stage,
std::string_view col_name) noexcept
template<typename ObjectType>
auto gtopt:: ObjectLP<ObjectType>:: uid() const noexcept
| Returns | The object's unique identifier |
|---|