From a5f1e1471e2ad2d144d2c727002d40c8263f92d1 Mon Sep 17 00:00:00 2001 From: schroedtert Date: Wed, 22 Nov 2023 16:25:25 +0100 Subject: [PATCH] OperationalDecisionSystem Factory --- .../src/OperationalDecisionSystem.hpp | 27 ++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/libsimulator/src/OperationalDecisionSystem.hpp b/libsimulator/src/OperationalDecisionSystem.hpp index 589c360b04..e36da2f7d2 100644 --- a/libsimulator/src/OperationalDecisionSystem.hpp +++ b/libsimulator/src/OperationalDecisionSystem.hpp @@ -8,6 +8,7 @@ #include "NeighborhoodSearch.hpp" #include "OperationalModel.hpp" #include "OperationalModelType.hpp" +#include "OptimalStepsModel.hpp" #include "SimulationError.hpp" #include @@ -16,7 +17,24 @@ #include #include -class OperationalDecisionSystem +class OperationalDecisionSystemInterface +{ +public: + virtual ~OperationalDecisionSystemInterface() = default; + virtual void + Run(double dT, + double /*t_in_sec*/, + const NeighborhoodSearch& neighborhoodSearch, + const CollisionGeometry& geometry, + std::vector& agents) const = 0; + + virtual void ValidateAgent( + const GenericAgent& agent, + const NeighborhoodSearch& neighborhoodSearch, + const CollisionGeometry& geometry) const = 0; +}; + +class OperationalDecisionSystem : public OperationalDecisionSystemInterface { std::unique_ptr _model{}; @@ -37,7 +55,7 @@ class OperationalDecisionSystem double /*t_in_sec*/, const NeighborhoodSearch& neighborhoodSearch, const CollisionGeometry& geometry, - std::vector& agents) const + std::vector& agents) const override { std::vector> updates{}; updates.reserve(agents.size()); @@ -64,8 +82,11 @@ class OperationalDecisionSystem void ValidateAgent( const GenericAgent& agent, const NeighborhoodSearch& neighborhoodSearch, - const CollisionGeometry& geometry) const + const CollisionGeometry& geometry) const override { _model->CheckModelConstraint(agent, neighborhoodSearch, geometry); } }; + +std::unique_ptr +MakeOperationalDecisionSystem(std::unique_ptr&& model); \ No newline at end of file