feat(policy network stack): Policies can now return the network stack

Policies can now return the network stack which allows the caller more
control over settings and running a solver against various levels of the
stack. Further, policies can return the partition function used as well
as a vector of enums which describe the structure of the network stack.
This commit is contained in:
2025-11-14 10:53:38 -05:00
parent 9417b79a32
commit a9ef20f664
5 changed files with 67 additions and 2 deletions

View File

@@ -55,7 +55,6 @@ namespace gridfire::policy {
);
auto& graphRepr = dynamic_cast<GraphEngine&>(*m_network_stack.back().get());
// graphRepr.setPrecomputation(false);
graphRepr.setUseReverseReactions(false);
@@ -97,6 +96,25 @@ namespace gridfire::policy {
return m_status;
}
const std::vector<std::unique_ptr<DynamicEngine>> &MainSequencePolicy::get_engine_stack() const {
if (m_status != NetworkPolicyStatus::INITIALIZED_VERIFIED) {
throw exceptions::PolicyError("Cannot get engine stack from MainSequencePolicy: Policy is not initialized and verified. Call construct() first.");
}
return m_network_stack;
}
std::vector<EngineTypes> MainSequencePolicy::get_engine_types_stack() const {
return {
EngineTypes::GRAPH_ENGINE,
EngineTypes::MULTISCALE_PARTITIONING_ENGINE_VIEW,
EngineTypes::ADAPTIVE_ENGINE_VIEW
};
}
const std::unique_ptr<partition::PartitionFunction>& MainSequencePolicy::get_partition_function() const {
return m_partition_function;
}
inline NetworkPolicyStatus MainSequencePolicy::check_status() const {
for (const auto& species : m_seed_species) {
if (!m_initializing_composition.contains(species)) {