diff --git a/.github/workflows/build-sola.yml b/.github/workflows/build-sola.yml index 9c1a9281..ef6b8e37 100644 --- a/.github/workflows/build-sola.yml +++ b/.github/workflows/build-sola.yml @@ -141,7 +141,7 @@ jobs: build/tests/unittests/DaisiDatastructureDirectedGraphTest build/tests/unittests/DaisiDatastructureWeightedDirectedGraphTest build/tests/unittests/DaisiDatastructureSimpleTemporalNetworkTest - build/tests/unittests/DaisiCppsOrderManagementStnOrderManagement + build/tests/unittests/DaisiCppsTaskManagementStnTaskManagement build/tests/unittests/DaisiCppsLogicalAuctionParticipantState build/tests/unittests/network_tcp/daisi_network_tcp_framing_manager_test - name: Run MINHTON integrationtest diff --git a/daisi/src/cpps/logical/algorithms/assignment/auction_participant_state.cpp b/daisi/src/cpps/logical/algorithms/assignment/auction_participant_state.cpp index 350341a0..ddcf973d 100644 --- a/daisi/src/cpps/logical/algorithms/assignment/auction_participant_state.cpp +++ b/daisi/src/cpps/logical/algorithms/assignment/auction_participant_state.cpp @@ -23,7 +23,7 @@ AuctionParticipantTaskState::AuctionParticipantTaskState(daisi::material_flow::T void AuctionParticipantTaskState::setInformation( const MetricsComposition &metrics_composition, - std::shared_ptr insertion_point) { + std::shared_ptr insertion_point) { metrics_composition_ = metrics_composition; insertion_point_ = insertion_point; } @@ -42,7 +42,7 @@ const MetricsComposition &AuctionParticipantTaskState::getMetricsComposition() c return metrics_composition_.value(); } -const std::shared_ptr +const std::shared_ptr AuctionParticipantTaskState::getInsertionPoint() const { return insertion_point_; } diff --git a/daisi/src/cpps/logical/algorithms/assignment/auction_participant_state.h b/daisi/src/cpps/logical/algorithms/assignment/auction_participant_state.h index 11a1e4c2..cf1996af 100644 --- a/daisi/src/cpps/logical/algorithms/assignment/auction_participant_state.h +++ b/daisi/src/cpps/logical/algorithms/assignment/auction_participant_state.h @@ -39,14 +39,14 @@ struct AuctionParticipantTaskState { const MetricsComposition &getMetricsComposition() const; - const std::shared_ptr getInsertionPoint() const; + const std::shared_ptr getInsertionPoint() const; /// @brief Checking whether both metrics and insertion point are initialized. bool isValid() const; /// @brief Setting information for both metrics and insertion point. void setInformation(const MetricsComposition &metrics_composition, - std::shared_ptr insertion_point); + std::shared_ptr insertion_point); /// @brief Making metrics and insertion point uninitialized. void removeInformation(); @@ -61,7 +61,7 @@ struct AuctionParticipantTaskState { /// @brief Storing information about how to insert the task into an auction based order /// management by the participant. - std::shared_ptr insertion_point_; + std::shared_ptr insertion_point_; }; /// @brief Helper struct for the IteratedAuctionAssignmentParticipant to store the state of open diff --git a/daisi/src/cpps/logical/algorithms/assignment/centralized_participant.cpp b/daisi/src/cpps/logical/algorithms/assignment/centralized_participant.cpp index 137770a2..ebfc44ea 100644 --- a/daisi/src/cpps/logical/algorithms/assignment/centralized_participant.cpp +++ b/daisi/src/cpps/logical/algorithms/assignment/centralized_participant.cpp @@ -20,7 +20,7 @@ namespace daisi::cpps::logical { CentralizedParticipant::CentralizedParticipant( daisi::cpps::common::CppsCommunicatorPtr communicator, - std::shared_ptr task_management) + std::shared_ptr task_management) : AssignmentParticipant(communicator), task_management_(std::move((task_management))){}; bool CentralizedParticipant::process(const AssignmentNotification &assignment_notification) { diff --git a/daisi/src/cpps/logical/algorithms/assignment/centralized_participant.h b/daisi/src/cpps/logical/algorithms/assignment/centralized_participant.h index 0e23d05b..b81765b0 100644 --- a/daisi/src/cpps/logical/algorithms/assignment/centralized_participant.h +++ b/daisi/src/cpps/logical/algorithms/assignment/centralized_participant.h @@ -28,7 +28,7 @@ namespace daisi::cpps::logical { class CentralizedParticipant : public AssignmentParticipant { public: CentralizedParticipant(daisi::cpps::common::CppsCommunicatorPtr communicator, - std::shared_ptr task_management); + std::shared_ptr task_management); ~CentralizedParticipant() override = default; /// @brief React on new task assignment and respond to it. @@ -39,7 +39,7 @@ class CentralizedParticipant : public AssignmentParticipant { private: /// @brief the AMR's task management. Simply accepts a new task assignment. - std::shared_ptr task_management_; + std::shared_ptr task_management_; }; } // namespace daisi::cpps::logical diff --git a/daisi/src/cpps/logical/algorithms/assignment/iterated_auction_assignment_participant.cpp b/daisi/src/cpps/logical/algorithms/assignment/iterated_auction_assignment_participant.cpp index 53af4b58..5aac9eee 100644 --- a/daisi/src/cpps/logical/algorithms/assignment/iterated_auction_assignment_participant.cpp +++ b/daisi/src/cpps/logical/algorithms/assignment/iterated_auction_assignment_participant.cpp @@ -23,7 +23,7 @@ namespace daisi::cpps::logical { IteratedAuctionAssignmentParticipant::IteratedAuctionAssignmentParticipant( daisi::cpps::common::CppsCommunicatorPtr communicator, - std::shared_ptr task_management, AmrDescription description) + std::shared_ptr task_management, AmrDescription description) : AssignmentParticipant(communicator), task_management_(std::move(task_management)), description_(std::move(description)) { diff --git a/daisi/src/cpps/logical/algorithms/assignment/iterated_auction_assignment_participant.h b/daisi/src/cpps/logical/algorithms/assignment/iterated_auction_assignment_participant.h index 163691c8..cc25870a 100644 --- a/daisi/src/cpps/logical/algorithms/assignment/iterated_auction_assignment_participant.h +++ b/daisi/src/cpps/logical/algorithms/assignment/iterated_auction_assignment_participant.h @@ -38,7 +38,7 @@ class IteratedAuctionAssignmentParticipant : public AssignmentParticipant { public: explicit IteratedAuctionAssignmentParticipant( daisi::cpps::common::CppsCommunicatorPtr communicator, - std::shared_ptr task_management, AmrDescription description); + std::shared_ptr task_management, AmrDescription description); ~IteratedAuctionAssignmentParticipant() override = default; @@ -65,7 +65,7 @@ class IteratedAuctionAssignmentParticipant : public AssignmentParticipant { /// @brief Pointer to the task management of the corresponding AmrLogicalAgent. /// We need access to calculate bids and add tasks after receiving WinnerNotifications. - std::shared_ptr task_management_; + std::shared_ptr task_management_; /// @brief Calculating bids for each open task in a state. /// @param state Relevant auction state. diff --git a/daisi/src/cpps/logical/amr/amr_logical_agent.cpp b/daisi/src/cpps/logical/amr/amr_logical_agent.cpp index 400ac529..39a1f226 100644 --- a/daisi/src/cpps/logical/amr/amr_logical_agent.cpp +++ b/daisi/src/cpps/logical/amr/amr_logical_agent.cpp @@ -54,7 +54,7 @@ void AmrLogicalAgent::initAlgorithms() { for (const auto &algo_type : algorithm_config_.algorithm_types) { switch (algo_type) { case AlgorithmType::kIteratedAuctionAssignmentParticipant: { - auto stn_task_management = std::make_shared( + auto stn_task_management = std::make_shared( description_, topology_, daisi::util::Pose{execution_state_.getPosition()}); task_management_ = stn_task_management; @@ -66,7 +66,7 @@ void AmrLogicalAgent::initAlgorithms() { break; } case AlgorithmType::kRoundRobinParticipant: { - auto simple_task_management = std::make_shared( + auto simple_task_management = std::make_shared( description_, topology_, daisi::util::Pose{execution_state_.getPosition()}); task_management_ = simple_task_management; diff --git a/daisi/src/cpps/logical/amr/amr_logical_agent.h b/daisi/src/cpps/logical/amr/amr_logical_agent.h index 34d58573..d63ee1dc 100644 --- a/daisi/src/cpps/logical/amr/amr_logical_agent.h +++ b/daisi/src/cpps/logical/amr/amr_logical_agent.h @@ -110,7 +110,7 @@ class AmrLogicalAgent : public LogicalAgent { /// @brief The address of the AmrPhysicalAsset after it connected to AmrLogicalAgent. ns3::Address physical_address_; - std::shared_ptr task_management_; + std::shared_ptr task_management_; }; } // namespace daisi::cpps::logical diff --git a/daisi/src/cpps/logical/task_management/auction_based_task_management.h b/daisi/src/cpps/logical/task_management/auction_based_task_management.h index 8ac453a9..27ee1687 100644 --- a/daisi/src/cpps/logical/task_management/auction_based_task_management.h +++ b/daisi/src/cpps/logical/task_management/auction_based_task_management.h @@ -22,15 +22,15 @@ namespace daisi::cpps::logical { -class AuctionBasedOrderManagement : public OrderManagement { +class AuctionBasedTaskManagement : public TaskManagement { public: struct InsertionPoint {}; - AuctionBasedOrderManagement(const AmrDescription &amr_description, const Topology &topology, - const daisi::util::Pose &pose) - : OrderManagement(amr_description, topology, pose) {} + AuctionBasedTaskManagement(const AmrDescription &amr_description, const Topology &topology, + const daisi::util::Pose &pose) + : TaskManagement(amr_description, topology, pose) {} - ~AuctionBasedOrderManagement() override = default; + ~AuctionBasedTaskManagement() override = default; virtual bool addTask(const daisi::material_flow::Task &task, std::shared_ptr insertion_point = nullptr) = 0; diff --git a/daisi/src/cpps/logical/task_management/simple_task_management.cpp b/daisi/src/cpps/logical/task_management/simple_task_management.cpp index 2553d490..8970aec3 100644 --- a/daisi/src/cpps/logical/task_management/simple_task_management.cpp +++ b/daisi/src/cpps/logical/task_management/simple_task_management.cpp @@ -19,39 +19,38 @@ using namespace daisi::material_flow; namespace daisi::cpps::logical { -SimpleOrderManagement::SimpleOrderManagement(const AmrDescription &amr_description, - const Topology &topology, - const daisi::util::Pose &pose) - : OrderManagement(amr_description, topology, pose), expected_end_position_(pose.position) { +SimpleTaskManagement::SimpleTaskManagement(const AmrDescription &amr_description, + const Topology &topology, const daisi::util::Pose &pose) + : TaskManagement(amr_description, topology, pose), expected_end_position_(pose.position) { final_metrics_.setStartTime(0); } -Metrics SimpleOrderManagement::getFinalMetrics() const { return final_metrics_; } +Metrics SimpleTaskManagement::getFinalMetrics() const { return final_metrics_; } -daisi::util::Position SimpleOrderManagement::getExpectedEndPosition() const { +daisi::util::Position SimpleTaskManagement::getExpectedEndPosition() const { if (!expected_end_position_.has_value()) { throw std::logic_error("There must exist at least a position for the AMR to start from."); } return expected_end_position_.value(); } -void SimpleOrderManagement::setCurrentTime(const daisi::util::Duration &now) { +void SimpleTaskManagement::setCurrentTime(const daisi::util::Duration &now) { if (now < time_now_) { throw std::invalid_argument("New time must be later than current time."); } time_now_ = now; } -bool SimpleOrderManagement::hasTasks() const { return active_task_.has_value(); } +bool SimpleTaskManagement::hasTasks() const { return active_task_.has_value(); } -Task SimpleOrderManagement::getCurrentTask() const { +Task SimpleTaskManagement::getCurrentTask() const { if (!hasTasks()) { throw std::logic_error("No tasks available!"); } return active_task_.value(); } -bool SimpleOrderManagement::setNextTask() { +bool SimpleTaskManagement::setNextTask() { if (!queue_.empty()) { active_task_ = queue_.front(); queue_.erase(queue_.begin()); @@ -61,14 +60,14 @@ bool SimpleOrderManagement::setNextTask() { return false; } -bool SimpleOrderManagement::canAddTask(const Task &task) { - SimpleOrderManagement copy(*this); +bool SimpleTaskManagement::canAddTask(const Task &task) { + SimpleTaskManagement copy(*this); bool result = copy.addTask(task); return result; } -bool SimpleOrderManagement::addTask(const Task &task) { +bool SimpleTaskManagement::addTask(const Task &task) { // simply add all orders in the given order const auto orders = task.getOrders(); if (orders.empty()) { @@ -92,13 +91,13 @@ bool SimpleOrderManagement::addTask(const Task &task) { if (!final_order.has_value()) { throw std::logic_error("Task must contain at least one TransportOrder or MoveOrder."); } - auto end_location = OrderManagementHelper::getEndLocationOfOrder(final_order.value()); + auto end_location = TaskManagementHelper::getEndLocationOfOrder(final_order.value()); expected_end_position_ = end_location->getPosition(); return true; } -void SimpleOrderManagement::updateFinalMetrics() { +void SimpleTaskManagement::updateFinalMetrics() { // calculate the start time and metrics for the new task auto start_time = std::max(final_metrics_.getMakespan(), time_now_); @@ -117,7 +116,7 @@ void SimpleOrderManagement::updateFinalMetrics() { final_metrics_ = new_current_metrics; } -void SimpleOrderManagement::insertOrderPropertiesIntoMetrics( +void SimpleTaskManagement::insertOrderPropertiesIntoMetrics( const Order &order, Metrics &metrics, const Task &task, const daisi::util::Duration &start_time) { if (!metrics.isStartTimeSet()) { @@ -131,7 +130,7 @@ void SimpleOrderManagement::insertOrderPropertiesIntoMetrics( std::optional previous_location; order_it++; for (; order_it != orders.rend(); order_it++) { - previous_location = OrderManagementHelper::getEndLocationOfOrder(*order_it); + previous_location = TaskManagementHelper::getEndLocationOfOrder(*order_it); if (previous_location.has_value()) { break; } diff --git a/daisi/src/cpps/logical/task_management/simple_task_management.h b/daisi/src/cpps/logical/task_management/simple_task_management.h index 3fa3a00a..1fe4dd81 100644 --- a/daisi/src/cpps/logical/task_management/simple_task_management.h +++ b/daisi/src/cpps/logical/task_management/simple_task_management.h @@ -22,12 +22,12 @@ #include "task_management.h" namespace daisi::cpps::logical { -class SimpleOrderManagement : public OrderManagement { +class SimpleTaskManagement : public TaskManagement { public: - SimpleOrderManagement(const AmrDescription &amr_description, const Topology &topology, - const daisi::util::Pose &pose); + SimpleTaskManagement(const AmrDescription &amr_description, const Topology &topology, + const daisi::util::Pose &pose); - ~SimpleOrderManagement() override = default; + ~SimpleTaskManagement() override = default; /// @brief return the metrics of the final order contained in the last task that has been added to /// the management diff --git a/daisi/src/cpps/logical/task_management/stn_task_management.cpp b/daisi/src/cpps/logical/task_management/stn_task_management.cpp index 0355fa44..caeeaaf9 100644 --- a/daisi/src/cpps/logical/task_management/stn_task_management.cpp +++ b/daisi/src/cpps/logical/task_management/stn_task_management.cpp @@ -29,15 +29,15 @@ namespace daisi::cpps::logical { template inline constexpr bool kAlwaysFalseV = false; -StnOrderManagement::StnOrderManagement(const AmrDescription &amr_description, - const Topology &topology, const daisi::util::Pose &pose) - : AuctionBasedOrderManagement(amr_description, topology, pose), +StnTaskManagement::StnTaskManagement(const AmrDescription &amr_description, + const Topology &topology, const daisi::util::Pose &pose) + : AuctionBasedTaskManagement(amr_description, topology, pose), current_task_end_location_(std::nullopt), latest_calculated_insertion_info_(std::nullopt) { current_total_metrics_.setStartTime(0); } -void StnOrderManagement::setCurrentTime(const daisi::util::Duration &now) { +void StnTaskManagement::setCurrentTime(const daisi::util::Duration &now) { if (now < time_now_) { throw std::invalid_argument("new time must be later than current time"); } @@ -46,7 +46,7 @@ void StnOrderManagement::setCurrentTime(const daisi::util::Duration &now) { time_now_ = now; } -void StnOrderManagement::updateOriginConstraints(const daisi::util::Duration &time_difference) { +void StnTaskManagement::updateOriginConstraints(const daisi::util::Duration &time_difference) { if (time_difference < 0) { return; } @@ -83,16 +83,16 @@ void StnOrderManagement::updateOriginConstraints(const daisi::util::Duration &ti } } -bool StnOrderManagement::hasTasks() const { return current_task_.has_value(); } +bool StnTaskManagement::hasTasks() const { return current_task_.has_value(); } -Task StnOrderManagement::getCurrentTask() const { +Task StnTaskManagement::getCurrentTask() const { if (!hasTasks()) { throw std::logic_error("no tasks available"); } return current_task_.value(); } -bool StnOrderManagement::setNextTask() { +bool StnTaskManagement::setNextTask() { if (!current_ordering_.empty()) { auto current_insert_info = current_ordering_.front(); current_task_ = current_insert_info.task; @@ -119,13 +119,13 @@ bool StnOrderManagement::setNextTask() { return false; } -bool StnOrderManagement::canAddTask(const Task &task, - std::shared_ptr insertion_point) { +bool StnTaskManagement::canAddTask(const Task &task, + std::shared_ptr insertion_point) { // TODO first checking whether we have the ability to execute the task latest_calculated_insertion_info_ = std::nullopt; - StnOrderManagement copy(*this); + StnTaskManagement copy(*this); copy.clearNotifyTaskAssignmentCallback(); if (copy.addTask(task, insertion_point)) { latest_calculated_insertion_info_ = copy.getLatestCalculatedInsertionInfo(); @@ -135,9 +135,8 @@ bool StnOrderManagement::canAddTask(const Task &task, return false; } -bool StnOrderManagement::addTask( - const Task &task, - std::shared_ptr insertion_point) { +bool StnTaskManagement::addTask( + const Task &task, std::shared_ptr insertion_point) { latest_calculated_insertion_info_ = std::nullopt; auto orders = task.getOrders(); @@ -145,11 +144,11 @@ bool StnOrderManagement::addTask( throw std::invalid_argument("Task must have at least one order"); } - StnOrderManagement::TaskInsertInfo info{task, {}, {}}; + StnTaskManagement::TaskInsertInfo info{task, {}, {}}; for (auto orders_it = orders.begin(); orders_it != orders.end(); orders_it++) { - StnOrderManagementVertex start_curr{*orders_it, true}; - StnOrderManagementVertex finish_curr{*orders_it, false}; + StnTaskManagementVertex start_curr{*orders_it, true}; + StnTaskManagementVertex finish_curr{*orders_it, false}; addVertex(start_curr); addVertex(finish_curr); @@ -181,7 +180,7 @@ bool StnOrderManagement::addTask( addDurationConstraints(start_curr, finish_curr, *orders_it, info); - auto end_location_of_order = OrderManagementHelper::getEndLocationOfOrder(*orders_it); + auto end_location_of_order = TaskManagementHelper::getEndLocationOfOrder(*orders_it); if (end_location_of_order.has_value()) { info.end_locations.push_back(end_location_of_order.value()); } else { @@ -195,8 +194,8 @@ bool StnOrderManagement::addTask( bool added = false; if (insertion_point) { - std::shared_ptr stn_insertion_point = - std::static_pointer_cast(insertion_point); + std::shared_ptr stn_insertion_point = + std::static_pointer_cast(insertion_point); addOrderingConstraintBetweenTasks(*stn_insertion_point, info); @@ -225,8 +224,8 @@ bool StnOrderManagement::addTask( return false; } -void StnOrderManagement::addPrecedenceConstraintBetweenTask( - const StnOrderManagementVertex &start_vertex, const std::string &precedence_task_name) { +void StnTaskManagement::addPrecedenceConstraintBetweenTask( + const StnTaskManagementVertex &start_vertex, const std::string &precedence_task_name) { auto task_info_it = std::find_if(current_ordering_.begin(), current_ordering_.end(), [&](const auto &info) { return info.task.getName() == precedence_task_name; }); @@ -237,14 +236,14 @@ void StnOrderManagement::addPrecedenceConstraintBetweenTask( } } -void StnOrderManagement::addDurationConstraints( - const StnOrderManagementVertex &start_vertex, const StnOrderManagementVertex &finish_vertex, - const Order &order, const StnOrderManagement::TaskInsertInfo &task_insert_info) { +void StnTaskManagement::addDurationConstraints( + const StnTaskManagementVertex &start_vertex, const StnTaskManagementVertex &finish_vertex, + const Order &order, const StnTaskManagement::TaskInsertInfo &task_insert_info) { addBinaryConstraint(start_vertex, finish_vertex, calcOrderDurationForInsert(order, task_insert_info), std::nullopt); } -daisi::util::Position StnOrderManagement::getLastPositionBefore(const int task_index) { +daisi::util::Position StnTaskManagement::getLastPositionBefore(const int task_index) { if (task_index == 0) { if (hasTasks()) { return current_task_end_location_->getPosition(); @@ -255,17 +254,17 @@ daisi::util::Position StnOrderManagement::getLastPositionBefore(const int task_i return current_ordering_[task_index - 1].end_locations.back().getPosition(); } -std::vector StnOrderManagement::calcInsertionPoints() { - std::vector insertion_points; +std::vector StnTaskManagement::calcInsertionPoints() { + std::vector insertion_points; if (current_ordering_.empty()) { insertion_points.push_back( - StnOrderManagement::StnInsertionPoint{{}, *vertices_.begin(), std::nullopt, 0}); + StnTaskManagement::StnInsertionPoint{{}, *vertices_.begin(), std::nullopt, 0}); } else { auto next_start = getVertexOfOrder(current_ordering_.front().task.getOrders().front(), true); insertion_points.push_back( - StnOrderManagement::StnInsertionPoint{{}, *vertices_.begin(), next_start, 0}); + StnTaskManagement::StnInsertionPoint{{}, *vertices_.begin(), next_start, 0}); } int i = 1; @@ -278,10 +277,10 @@ std::vector StnOrderManagement::calcInser auto next_start = getVertexOfOrder(next->task.getOrders().front(), true); insertion_points.push_back( - StnOrderManagement::StnInsertionPoint{{}, previous_finish, next_start, i}); + StnTaskManagement::StnInsertionPoint{{}, previous_finish, next_start, i}); } else { insertion_points.push_back( - StnOrderManagement::StnInsertionPoint{{}, previous_finish, std::nullopt, i}); + StnTaskManagement::StnInsertionPoint{{}, previous_finish, std::nullopt, i}); } i++; @@ -290,7 +289,7 @@ std::vector StnOrderManagement::calcInser return insertion_points; } -bool StnOrderManagement::solve() { +bool StnTaskManagement::solve() { bool success = SimpleTemporalNetwork::solve(); if (success) { updateCurrentOrdering(); @@ -298,7 +297,7 @@ bool StnOrderManagement::solve() { return success; } -void StnOrderManagement::updateCurrentOrdering() { +void StnTaskManagement::updateCurrentOrdering() { std::unordered_map start_time_mapping; // updating current metrics @@ -332,8 +331,8 @@ void StnOrderManagement::updateCurrentOrdering() { // sorting ordering by start time std::sort(current_ordering_.begin(), current_ordering_.end(), - [&start_time_mapping](const StnOrderManagement::TaskInsertInfo &i1, - const StnOrderManagement::TaskInsertInfo &i2) { + [&start_time_mapping](const StnTaskManagement::TaskInsertInfo &i1, + const StnTaskManagement::TaskInsertInfo &i2) { return start_time_mapping[i1.task] < start_time_mapping[i2.task]; }); @@ -344,7 +343,7 @@ void StnOrderManagement::updateCurrentOrdering() { } // set metric difference in new task - auto find_new_task_lambda = [&](const StnOrderManagement::TaskInsertInfo &info) { + auto find_new_task_lambda = [&](const StnTaskManagement::TaskInsertInfo &info) { return !info.metrics_composition.hasDiffInsertionMetrics(); }; if (std::count_if(current_ordering_.begin(), current_ordering_.end(), find_new_task_lambda) != @@ -360,8 +359,8 @@ void StnOrderManagement::updateCurrentOrdering() { newest_task_insert_info_ = new_task_it; } -std::optional>> -StnOrderManagement::addBestOrdering(StnOrderManagement::TaskInsertInfo &task_insert_info) { +std::optional>> +StnTaskManagement::addBestOrdering(StnTaskManagement::TaskInsertInfo &task_insert_info) { auto insertion_points = calcInsertionPoints(); int best_index = -1; @@ -370,7 +369,7 @@ StnOrderManagement::addBestOrdering(StnOrderManagement::TaskInsertInfo &task_ins for (auto i = 0; i < insertion_points.size(); i++) { const auto &point = insertion_points[i]; - StnOrderManagement copy(*this); + StnTaskManagement copy(*this); copy.addOrderingConstraintBetweenTasks(point, task_insert_info); bool success = copy.solve(); @@ -393,15 +392,15 @@ StnOrderManagement::addBestOrdering(StnOrderManagement::TaskInsertInfo &task_ins return std::make_pair( newest_task_insert_info_->metrics_composition, - std::make_shared(insertion_points[best_index])); + std::make_shared(insertion_points[best_index])); } return std::nullopt; } -void StnOrderManagement::addOrderingConstraintBetweenTasks( - StnOrderManagement::StnInsertionPoint insertion_point, - StnOrderManagement::TaskInsertInfo &task_insert_info) { +void StnTaskManagement::addOrderingConstraintBetweenTasks( + StnTaskManagement::StnInsertionPoint insertion_point, + StnTaskManagement::TaskInsertInfo &task_insert_info) { current_ordering_.insert(current_ordering_.begin() + insertion_point.new_index, task_insert_info); auto start_vertex = getVertexOfOrder(task_insert_info.task.getOrders().front(), true); @@ -417,7 +416,7 @@ void StnOrderManagement::addOrderingConstraintBetweenTasks( } } -daisi::util::Duration StnOrderManagement::calcOrderDurationForInsert( +daisi::util::Duration StnTaskManagement::calcOrderDurationForInsert( const Order &order, const TaskInsertInfo &task_insert_info) const { const auto orders = task_insert_info.task.getOrders(); const auto it = std::find(orders.begin(), orders.end(), order); @@ -468,9 +467,9 @@ daisi::util::Duration StnOrderManagement::calcOrderDurationForInsert( throw std::runtime_error("Unknown Order Type."); } -void StnOrderManagement::insertOrderPropertiesIntoMetrics( - const Order &order, Metrics &metrics, - const StnOrderManagement::TaskInsertInfo &task_insert_info, const int task_ordering_index) { +void StnTaskManagement::insertOrderPropertiesIntoMetrics( + const Order &order, Metrics &metrics, const StnTaskManagement::TaskInsertInfo &task_insert_info, + const int task_ordering_index) { const auto orders = task_insert_info.task.getOrders(); const auto order_it = std::find(orders.begin(), orders.end(), order); const int order_index = order_it - orders.begin(); @@ -519,24 +518,24 @@ void StnOrderManagement::insertOrderPropertiesIntoMetrics( } } -void StnOrderManagement::updateGetToStartDurationConstraint(const int task_index_to_update) { +void StnTaskManagement::updateGetToStartDurationConstraint(const int task_index_to_update) { const auto duration = calcGetToStartDuration(task_index_to_update); const auto &task_info_to_update = current_ordering_[task_index_to_update]; const auto &this_task_first_order = task_info_to_update.task.getOrders().front(); - StnOrderManagementVertex previous_finish_vertex = getOrigin(); + StnTaskManagementVertex previous_finish_vertex = getOrigin(); if (task_index_to_update > 0) { const auto &previous_task_last_order = current_ordering_[task_index_to_update - 1].task.getOrders().back(); previous_finish_vertex = getVertexOfOrder(previous_task_last_order, false); } - StnOrderManagementVertex this_start_vertex = getVertexOfOrder(this_task_first_order, true); + StnTaskManagementVertex this_start_vertex = getVertexOfOrder(this_task_first_order, true); updateLastBinaryConstraint(previous_finish_vertex, this_start_vertex, duration, std::nullopt); } -util::Duration StnOrderManagement::calcGetToStartDuration(const int task_index_to_update) { +util::Duration StnTaskManagement::calcGetToStartDuration(const int task_index_to_update) { auto last_position = getLastPositionBefore(task_index_to_update); const auto &task_info_to_update = current_ordering_[task_index_to_update]; @@ -553,10 +552,10 @@ util::Duration StnOrderManagement::calcGetToStartDuration(const int task_index_t return duration; } -StnOrderManagement::VertexIterator StnOrderManagement::getVertexIteratorOfOrder(const Order &order, - const bool start) { +StnTaskManagement::VertexIterator StnTaskManagement::getVertexIteratorOfOrder(const Order &order, + const bool start) { auto it = std::find_if(vertices_.begin(), vertices_.end(), - [&start, &order](const StnOrderManagementVertex &v) { + [&start, &order](const StnTaskManagementVertex &v) { return v.isStart() == start && order == v.getOrder(); }); @@ -567,17 +566,17 @@ StnOrderManagement::VertexIterator StnOrderManagement::getVertexIteratorOfOrder( return it; } -int StnOrderManagement::getVertexIndexOfOrder(const Order &order, const bool start) { +int StnTaskManagement::getVertexIndexOfOrder(const Order &order, const bool start) { return std::distance(vertices_.begin(), getVertexIteratorOfOrder(order, start)); } -const StnOrderManagementVertex &StnOrderManagement::getVertexOfOrder(const Order &order, - const bool start) { +const StnTaskManagementVertex &StnTaskManagement::getVertexOfOrder(const Order &order, + const bool start) { return *getVertexIteratorOfOrder(order, start); } -std::pair> -StnOrderManagement::getLatestCalculatedInsertionInfo() const { +std::pair> +StnTaskManagement::getLatestCalculatedInsertionInfo() const { if (latest_calculated_insertion_info_.has_value()) { return latest_calculated_insertion_info_.value(); } diff --git a/daisi/src/cpps/logical/task_management/stn_task_management.h b/daisi/src/cpps/logical/task_management/stn_task_management.h index 3c937365..21712d21 100644 --- a/daisi/src/cpps/logical/task_management/stn_task_management.h +++ b/daisi/src/cpps/logical/task_management/stn_task_management.h @@ -27,21 +27,21 @@ namespace daisi::cpps::logical { -class StnOrderManagement - : public AuctionBasedOrderManagement, - private daisi::datastructure::SimpleTemporalNetwork { +class StnTaskManagement + : public AuctionBasedTaskManagement, + private daisi::datastructure::SimpleTemporalNetwork { public: struct StnInsertionPoint : public InsertionPoint { - StnOrderManagementVertex previous_finish; - std::optional next_start; + StnTaskManagementVertex previous_finish; + std::optional next_start; int new_index; }; - StnOrderManagement(const AmrDescription &amr_description, const Topology &topology, - const daisi::util::Pose &pose); + StnTaskManagement(const AmrDescription &amr_description, const Topology &topology, + const daisi::util::Pose &pose); - ~StnOrderManagement() override = default; + ~StnTaskManagement() override = default; /// @brief check wether the task management has a current task assigned bool hasTasks() const override; @@ -76,7 +76,7 @@ class StnOrderManagement /// @param now void setCurrentTime(const daisi::util::Duration &now); - using VertexIterator = std::vector::iterator; + using VertexIterator = std::vector::iterator; /// @brief contains a task, the end locations, and metrics compositions for the single orders struct TaskInsertInfo { @@ -111,11 +111,11 @@ class StnOrderManagement bool solve() override; - void addPrecedenceConstraintBetweenTask(const StnOrderManagementVertex &start_vertex, + void addPrecedenceConstraintBetweenTask(const StnTaskManagementVertex &start_vertex, const std::string &precedence_task_name); - void addDurationConstraints(const StnOrderManagementVertex &start_vertex, - const StnOrderManagementVertex &finish_vertex, + void addDurationConstraints(const StnTaskManagementVertex &start_vertex, + const StnTaskManagementVertex &finish_vertex, const daisi::material_flow::Order &order, const TaskInsertInfo &task_insert_info); @@ -127,7 +127,7 @@ class StnOrderManagement TaskInsertInfo &task_insert_info); std::optional>> addBestOrdering( - StnOrderManagement::TaskInsertInfo &task_insert_info); + StnTaskManagement::TaskInsertInfo &task_insert_info); std::vector calcInsertionPoints(); @@ -154,8 +154,8 @@ class StnOrderManagement // simple helper VertexIterator getVertexIteratorOfOrder(const daisi::material_flow::Order &order, bool start); int getVertexIndexOfOrder(const daisi::material_flow::Order &order, bool start); - const StnOrderManagementVertex &getVertexOfOrder(const daisi::material_flow::Order &order, - bool start); + const StnTaskManagementVertex &getVertexOfOrder(const daisi::material_flow::Order &order, + bool start); private: void updateOriginConstraints(const daisi::util::Duration &time_difference); diff --git a/daisi/src/cpps/logical/task_management/stn_task_management_components.cpp b/daisi/src/cpps/logical/task_management/stn_task_management_components.cpp index e2bf6af0..09309347 100644 --- a/daisi/src/cpps/logical/task_management/stn_task_management_components.cpp +++ b/daisi/src/cpps/logical/task_management/stn_task_management_components.cpp @@ -20,31 +20,31 @@ using namespace daisi::material_flow; namespace daisi::cpps::logical { -StnOrderManagementVertex::StnOrderManagementVertex(Order order, const bool is_start) +StnTaskManagementVertex::StnTaskManagementVertex(Order order, const bool is_start) : order_(std::move(order)), is_start_(is_start) {} -StnOrderManagementVertex StnOrderManagementVertex::createOrigin() { +StnTaskManagementVertex StnTaskManagementVertex::createOrigin() { MoveOrder tmp( "origin", MoveOrderStep("origin", {}, Location("origin", "origin", daisi::util::Position(-1, -1)))); - auto v = StnOrderManagementVertex(tmp, true); + auto v = StnTaskManagementVertex(tmp, true); v.is_origin_ = true; return v; } -const Order &StnOrderManagementVertex::getOrder() const { return order_; } -bool StnOrderManagementVertex::isStart() const { return is_start_; } -bool StnOrderManagementVertex::isOrigin() const { return is_origin_; } +const Order &StnTaskManagementVertex::getOrder() const { return order_; } +bool StnTaskManagementVertex::isStart() const { return is_start_; } +bool StnTaskManagementVertex::isOrigin() const { return is_origin_; } -void StnOrderManagementVertex::setLastPosition(const daisi::util::Position &position) { +void StnTaskManagementVertex::setLastPosition(const daisi::util::Position &position) { if (is_start_) { position_ = position; } } -const daisi::util::Position &StnOrderManagementVertex::getLastPosition() const { return position_; } +const daisi::util::Position &StnTaskManagementVertex::getLastPosition() const { return position_; } -bool operator==(const StnOrderManagementVertex &v1, const StnOrderManagementVertex &v2) { +bool operator==(const StnTaskManagementVertex &v1, const StnTaskManagementVertex &v2) { if (v1.is_origin_ && v2.is_origin_) { return true; } diff --git a/daisi/src/cpps/logical/task_management/stn_task_management_components.h b/daisi/src/cpps/logical/task_management/stn_task_management_components.h index 2fc2c230..6e399ec0 100644 --- a/daisi/src/cpps/logical/task_management/stn_task_management_components.h +++ b/daisi/src/cpps/logical/task_management/stn_task_management_components.h @@ -26,16 +26,16 @@ namespace daisi::cpps::logical { -struct StnOrderManagementVertex { - StnOrderManagementVertex(daisi::material_flow::Order order, bool is_start); +struct StnTaskManagementVertex { + StnTaskManagementVertex(daisi::material_flow::Order order, bool is_start); - static StnOrderManagementVertex createOrigin(); + static StnTaskManagementVertex createOrigin(); const daisi::material_flow::Order &getOrder() const; bool isStart() const; bool isOrigin() const; - friend bool operator==(const StnOrderManagementVertex &v1, const StnOrderManagementVertex &v2); + friend bool operator==(const StnTaskManagementVertex &v1, const StnTaskManagementVertex &v2); void setLastPosition(const daisi::util::Position &position); @@ -51,8 +51,8 @@ struct StnOrderManagementVertex { daisi::util::Position position_; }; -struct StnOrderManagementEdge { - explicit StnOrderManagementEdge(const bool all_positive) : all_positive_(all_positive){}; +struct StnTaskManagementEdge { + explicit StnTaskManagementEdge(const bool all_positive) : all_positive_(all_positive){}; void addWeight(double weight) { if (weight >= 0 && all_positive_) { @@ -98,8 +98,8 @@ struct StnOrderManagementEdge { namespace std { -template <> struct hash { - std::size_t operator()(const daisi::cpps::logical::StnOrderManagementVertex &v) const { +template <> struct hash { + std::size_t operator()(const daisi::cpps::logical::StnTaskManagementVertex &v) const { std::string repr; if (auto move_order_pval = std::get_if(&v.getOrder())) { diff --git a/daisi/src/cpps/logical/task_management/task_management.h b/daisi/src/cpps/logical/task_management/task_management.h index 2193d0a4..c64fff5a 100644 --- a/daisi/src/cpps/logical/task_management/task_management.h +++ b/daisi/src/cpps/logical/task_management/task_management.h @@ -32,15 +32,15 @@ namespace daisi::cpps::logical { -class OrderManagement { +class TaskManagement { public: - explicit OrderManagement(AmrDescription amr_description, Topology topology, - const daisi::util::Pose &pose) + explicit TaskManagement(AmrDescription amr_description, Topology topology, + const daisi::util::Pose &pose) : amr_description_(std::move(amr_description)), topology_(std::move(topology)), current_pose_(pose) {} - virtual ~OrderManagement() = default; + virtual ~TaskManagement() = default; /// @brief check wether the task management has a current task assigned virtual bool hasTasks() const = 0; diff --git a/daisi/src/cpps/logical/task_management/task_management_helper.cpp b/daisi/src/cpps/logical/task_management/task_management_helper.cpp index e251de57..a1f771ba 100644 --- a/daisi/src/cpps/logical/task_management/task_management_helper.cpp +++ b/daisi/src/cpps/logical/task_management/task_management_helper.cpp @@ -21,7 +21,7 @@ namespace daisi::cpps::logical { template inline constexpr bool kAlwaysFalseV = false; -std::optional OrderManagementHelper::getEndLocationOfOrder(const Order &order) { +std::optional TaskManagementHelper::getEndLocationOfOrder(const Order &order) { return std::visit( [&](auto &&arg) -> std::optional { using T = std::decay_t; diff --git a/daisi/src/cpps/logical/task_management/task_management_helper.h b/daisi/src/cpps/logical/task_management/task_management_helper.h index 3375232b..a7053315 100644 --- a/daisi/src/cpps/logical/task_management/task_management_helper.h +++ b/daisi/src/cpps/logical/task_management/task_management_helper.h @@ -23,7 +23,7 @@ namespace daisi::cpps::logical { -class OrderManagementHelper { +class TaskManagementHelper { public: /// @brief get the end location of a given order. /// @param order the order to get the end location for diff --git a/daisi/tests/unittests/CMakeLists.txt b/daisi/tests/unittests/CMakeLists.txt index ed60c96f..02bccba1 100644 --- a/daisi/tests/unittests/CMakeLists.txt +++ b/daisi/tests/unittests/CMakeLists.txt @@ -51,12 +51,12 @@ target_link_libraries(DaisiDatastructureSimpleTemporalNetworkTest daisi_datastructure_simple_temporal_network ) -add_executable(DaisiCppsOrderManagementStnOrderManagement "") -target_sources(DaisiCppsOrderManagementStnOrderManagement +add_executable(DaisiCppsTaskManagementStnTaskManagement "") +target_sources(DaisiCppsTaskManagementStnTaskManagement PRIVATE cpps/task_management/stn_task_management_test.cpp ) -target_link_libraries(DaisiCppsOrderManagementStnOrderManagement +target_link_libraries(DaisiCppsTaskManagementStnTaskManagement PRIVATE Catch2::Catch2WithMain ns3::libcore @@ -64,12 +64,12 @@ target_link_libraries(DaisiCppsOrderManagementStnOrderManagement daisi_cpps_amr_physical_material_flow_functionality_mapping ) -add_executable(DaisiCppsOrderManagementSimpleOrderManagement "") -target_sources(DaisiCppsOrderManagementSimpleOrderManagement +add_executable(DaisiCppsTaskManagementSimpleTaskManagement "") +target_sources(DaisiCppsTaskManagementSimpleTaskManagement PRIVATE cpps/task_management/simple_task_management_test.cpp ) -target_link_libraries(DaisiCppsOrderManagementSimpleOrderManagement +target_link_libraries(DaisiCppsTaskManagementSimpleTaskManagement PRIVATE Catch2::Catch2WithMain ns3::libcore diff --git a/daisi/tests/unittests/cpps/logical/auction_participant_state_test.cpp b/daisi/tests/unittests/cpps/logical/auction_participant_state_test.cpp index 5a016210..782b3c59 100644 --- a/daisi/tests/unittests/cpps/logical/auction_participant_state_test.cpp +++ b/daisi/tests/unittests/cpps/logical/auction_participant_state_test.cpp @@ -107,7 +107,7 @@ TEST_CASE("Small Examples", "[pickBest]") { AuctionParticipantState state(tasks); - auto basic_insertion_point = std::make_shared(); + auto basic_insertion_point = std::make_shared(); auto m1 = getMetrics1(); auto m2 = getMetrics2(); diff --git a/daisi/tests/unittests/cpps/task_management/simple_task_management_test.cpp b/daisi/tests/unittests/cpps/task_management/simple_task_management_test.cpp index d18a95e0..7770e95e 100644 --- a/daisi/tests/unittests/cpps/task_management/simple_task_management_test.cpp +++ b/daisi/tests/unittests/cpps/task_management/simple_task_management_test.cpp @@ -44,10 +44,10 @@ daisi::util::Position p4(5, 10); daisi::util::Position p5(20, 0); daisi::util::Position p6(20, 10); -TEST_CASE("SimpleOrderManagement Empty Tasks", "[adding and removing vertices]") { +TEST_CASE("SimpleTaskManagement Empty Tasks", "[adding and removing vertices]") { // arrange auto current_pose = daisi::util::Pose(daisi::util::Position(10, 10)); - SimpleOrderManagement management(buildBasicAmrDescription(), buildBasicTopology(), current_pose); + SimpleTaskManagement management(buildBasicAmrDescription(), buildBasicTopology(), current_pose); // assert preconditions REQUIRE(!management.hasTasks()); @@ -65,10 +65,10 @@ TEST_CASE("SimpleOrderManagement Empty Tasks", "[adding and removing vertices]") REQUIRE_THROWS(management.addTask(task_empty_with_follow_ups)); } -TEST_CASE("SimpleOrderManagement One Simple Transport Order", "[adding and removing vertices]") { +TEST_CASE("SimpleTaskManagement One Simple Transport Order", "[adding and removing vertices]") { // arrange auto current_pose = daisi::util::Pose(p0); - SimpleOrderManagement management(buildBasicAmrDescription(), buildBasicTopology(), current_pose); + SimpleTaskManagement management(buildBasicAmrDescription(), buildBasicTopology(), current_pose); // assert preconditions REQUIRE(!management.hasTasks()); @@ -123,10 +123,10 @@ TEST_CASE("SimpleOrderManagement One Simple Transport Order", "[adding and remov REQUIRE(!management.hasTasks()); } -TEST_CASE("SimpleOrderManagement Two Simple Transport Orders", "[adding and removing vertices]") { +TEST_CASE("SimpleTaskManagement Two Simple Transport Orders", "[adding and removing vertices]") { // arrange auto current_pose = daisi::util::Pose(p0); - SimpleOrderManagement management(buildBasicAmrDescription(), buildBasicTopology(), current_pose); + SimpleTaskManagement management(buildBasicAmrDescription(), buildBasicTopology(), current_pose); // transport order 1 TransportOrderStep pickup_1("tos1_1", {}, Location("0x0", "type", p1)); @@ -197,11 +197,11 @@ TEST_CASE("SimpleOrderManagement Two Simple Transport Orders", "[adding and remo REQUIRE(!management.hasTasks()); } -TEST_CASE("SimpleOrderManagement Two Simple Transport Orders multiple times", +TEST_CASE("SimpleTaskManagement Two Simple Transport Orders multiple times", "[adding and removing vertices]") { // arrange auto current_pose = daisi::util::Pose(p0); - SimpleOrderManagement management(buildBasicAmrDescription(), buildBasicTopology(), current_pose); + SimpleTaskManagement management(buildBasicAmrDescription(), buildBasicTopology(), current_pose); // transport order 1 TransportOrderStep pickup_1("tos1_1", {}, Location("0x0", "type", p1)); @@ -279,10 +279,10 @@ TEST_CASE("SimpleOrderManagement Two Simple Transport Orders multiple times", REQUIRE(!management.hasTasks()); } -TEST_CASE("SimpleOrderManagement Three Simple Transport Orders", "[adding and removing vertices]") { +TEST_CASE("SimpleTaskManagement Three Simple Transport Orders", "[adding and removing vertices]") { // arrange auto current_pose = daisi::util::Pose(p0); - SimpleOrderManagement management(buildBasicAmrDescription(), buildBasicTopology(), current_pose); + SimpleTaskManagement management(buildBasicAmrDescription(), buildBasicTopology(), current_pose); // transport order 1 TransportOrderStep pickup_1("tos1_1", {}, Location("0x0", "type", p3)); @@ -324,11 +324,11 @@ TEST_CASE("SimpleOrderManagement Three Simple Transport Orders", "[adding and re REQUIRE(add_3_metrics.getMakespan() == add_2_metrics.getMakespan() + add_3_metrics.getTime()); } -TEST_CASE("SimpleOrderManagement Two Transport Orders in one Task", +TEST_CASE("SimpleTaskManagement Two Transport Orders in one Task", "[adding and removing vertices]") { // arrange auto current_pose = daisi::util::Pose(p0); - SimpleOrderManagement management(buildBasicAmrDescription(), buildBasicTopology(), current_pose); + SimpleTaskManagement management(buildBasicAmrDescription(), buildBasicTopology(), current_pose); // transport order 1 TransportOrderStep pickup_1("tos1_1", {}, Location("0x0", "type", p0)); @@ -351,11 +351,11 @@ TEST_CASE("SimpleOrderManagement Two Transport Orders in one Task", REQUIRE(add_1_metrics.getMakespan() == 58); } -TEST_CASE("SimpleOrderManagement One Transport, Move, and Action Order in one Task", +TEST_CASE("SimpleTaskManagement One Transport, Move, and Action Order in one Task", "[adding and removing vertices]") { // arrange auto current_pose = daisi::util::Pose(p0); - SimpleOrderManagement management(buildBasicAmrDescription(), buildBasicTopology(), current_pose); + SimpleTaskManagement management(buildBasicAmrDescription(), buildBasicTopology(), current_pose); TransportOrderStep pickup_1("tos1_1", {}, Location("0x0", "type", p0)); TransportOrderStep delivery_1("tos2_1", {}, Location("0x1", "type", p1)); @@ -403,7 +403,7 @@ TEST_CASE("Simple Task Management Three Simple Transport Orders with time delay" "[adding and removing vertices]") { // arrange auto current_pose = daisi::util::Pose(p0); - SimpleOrderManagement management(buildBasicAmrDescription(), buildBasicTopology(), current_pose); + SimpleTaskManagement management(buildBasicAmrDescription(), buildBasicTopology(), current_pose); // transport order 1 TransportOrderStep pickup_1("tos1_1", {}, Location("0x0", "type", p3)); diff --git a/daisi/tests/unittests/cpps/task_management/stn_task_management_test.cpp b/daisi/tests/unittests/cpps/task_management/stn_task_management_test.cpp index 090d630c..0ceb946c 100644 --- a/daisi/tests/unittests/cpps/task_management/stn_task_management_test.cpp +++ b/daisi/tests/unittests/cpps/task_management/stn_task_management_test.cpp @@ -47,7 +47,7 @@ daisi::util::Position p6(20, 10); TEST_CASE("One Simple Transport Order", "[basic]") { // arrange auto current_pose = daisi::util::Pose(p0); - StnOrderManagement management(buildBasicAmrDescription(), buildBasicTopology(), current_pose); + StnTaskManagement management(buildBasicAmrDescription(), buildBasicTopology(), current_pose); // assert preconditions REQUIRE(!management.hasTasks()); @@ -81,8 +81,8 @@ TEST_CASE("One Simple Transport Order", "[basic]") { // assert intertion point - std::shared_ptr stn_insertion_point = - std::static_pointer_cast(insertion_point); + std::shared_ptr stn_insertion_point = + std::static_pointer_cast(insertion_point); REQUIRE(stn_insertion_point->new_index == 0); REQUIRE(stn_insertion_point->previous_finish.isOrigin()); @@ -113,7 +113,7 @@ TEST_CASE("One Simple Transport Order", "[basic]") { TEST_CASE("Two Simple Transport Orders statically", "[basic]") { // arrange auto current_pose = daisi::util::Pose(p0); - StnOrderManagement management(buildBasicAmrDescription(), buildBasicTopology(), current_pose); + StnTaskManagement management(buildBasicAmrDescription(), buildBasicTopology(), current_pose); // transport order 1 without constraints TransportOrderStep pickup_1("tos1_1", {}, Location("0x0", "type", p1)); @@ -168,15 +168,15 @@ TEST_CASE("Two Simple Transport Orders statically", "[basic]") { // can add task 2 after 1 REQUIRE(management.canAddTask(simple_task_2)); - std::shared_ptr can_add_2_2_stn_insertion_point = - std::static_pointer_cast( + std::shared_ptr can_add_2_2_stn_insertion_point = + std::static_pointer_cast( std::get<1>(management.getLatestCalculatedInsertionInfo())); REQUIRE(can_add_2_2_stn_insertion_point->new_index == 1); // adding task 2 REQUIRE(management.addTask(simple_task_2)); - std::shared_ptr add_2_stn_insertion_point = - std::static_pointer_cast( + std::shared_ptr add_2_stn_insertion_point = + std::static_pointer_cast( std::get<1>(management.getLatestCalculatedInsertionInfo())); REQUIRE(add_2_stn_insertion_point->new_index == 1); REQUIRE(!add_2_stn_insertion_point->next_start.has_value()); @@ -200,7 +200,7 @@ TEST_CASE("Two Simple Transport Orders statically", "[basic]") { TEST_CASE("Two Simple Transport Orders dynamically", "[basic]") { // arrange auto current_pose = daisi::util::Pose(p0); - StnOrderManagement management(buildBasicAmrDescription(), buildBasicTopology(), current_pose); + StnTaskManagement management(buildBasicAmrDescription(), buildBasicTopology(), current_pose); // transport order 1 without constraints TransportOrderStep pickup_1("tos1_1", {}, Location("0x0", "type", p1)); @@ -226,9 +226,8 @@ TEST_CASE("Two Simple Transport Orders dynamically", "[basic]") { auto can_add_2_1_info = management.getLatestCalculatedInsertionInfo(); // insertion point should be at the first point of the current ordering - std::shared_ptr can_add_2_1_stn_insertion_point = - std::static_pointer_cast( - std::get<1>(can_add_2_1_info)); + std::shared_ptr can_add_2_1_stn_insertion_point = + std::static_pointer_cast(std::get<1>(can_add_2_1_info)); REQUIRE(can_add_2_1_stn_insertion_point->new_index == 0); REQUIRE(can_add_2_1_stn_insertion_point->previous_finish.isOrigin()); REQUIRE(!can_add_2_1_stn_insertion_point->next_start.has_value()); @@ -244,8 +243,8 @@ TEST_CASE("Two Simple Transport Orders dynamically", "[basic]") { // no change to can_add_2_1 expected REQUIRE(management.canAddTask(simple_task_2)); - std::shared_ptr can_add_2_2_stn_insertion_point = - std::static_pointer_cast( + std::shared_ptr can_add_2_2_stn_insertion_point = + std::static_pointer_cast( std::get<1>(management.getLatestCalculatedInsertionInfo())); REQUIRE(can_add_2_2_stn_insertion_point->new_index == 0); @@ -276,7 +275,7 @@ TEST_CASE("Two Simple Transport Orders dynamically", "[basic]") { TEST_CASE("Three Simple Transport Orders statically", "[basic]") { // arrange auto current_pose = daisi::util::Pose(p0); - StnOrderManagement management(buildBasicAmrDescription(), buildBasicTopology(), current_pose); + StnTaskManagement management(buildBasicAmrDescription(), buildBasicTopology(), current_pose); // transport order 1 without constraints TransportOrderStep pickup_1("tos1_1", {}, Location("0x0", "type", p3)); @@ -311,18 +310,18 @@ TEST_CASE("Three Simple Transport Orders statically", "[basic]") { add_1_metrics_comp.getCurrentMetrics().getMakespan() + add_1_metrics_comp.getCurrentMetrics().getTime()); - std::shared_ptr add_1_stn_insertion_point = - std::static_pointer_cast(std::get<1>(add_1)); + std::shared_ptr add_1_stn_insertion_point = + std::static_pointer_cast(std::get<1>(add_1)); - std::shared_ptr add_2_stn_insertion_point = - std::static_pointer_cast(std::get<1>(add_2)); + std::shared_ptr add_2_stn_insertion_point = + std::static_pointer_cast(std::get<1>(add_2)); REQUIRE(add_1_stn_insertion_point->new_index == 0); REQUIRE(add_2_stn_insertion_point->new_index == 1); // trying to add task 3, should come after task 2 REQUIRE(management.canAddTask(simple_task_3)); - std::shared_ptr can_add_3_stn_insertion_point = - std::static_pointer_cast( + std::shared_ptr can_add_3_stn_insertion_point = + std::static_pointer_cast( std::get<1>(management.getLatestCalculatedInsertionInfo())); REQUIRE((can_add_3_stn_insertion_point->new_index == 0 || can_add_3_stn_insertion_point->new_index == 2)); @@ -331,7 +330,7 @@ TEST_CASE("Three Simple Transport Orders statically", "[basic]") { TEST_CASE("Two Transport Orders in one Task", "[basic]") { // arrange auto current_pose = daisi::util::Pose(p0); - StnOrderManagement management(buildBasicAmrDescription(), buildBasicTopology(), current_pose); + StnTaskManagement management(buildBasicAmrDescription(), buildBasicTopology(), current_pose); // transport order 1 without constraints TransportOrderStep pickup_1("tos1_1", {}, Location("0x0", "type", p0)); @@ -354,7 +353,7 @@ TEST_CASE("Two Transport Orders in one Task", "[basic]") { TEST_CASE("One Transport, Move, and Action Order in one Task", "[basic]") { // arrange auto current_pose = daisi::util::Pose(p0); - StnOrderManagement management(buildBasicAmrDescription(), buildBasicTopology(), current_pose); + StnTaskManagement management(buildBasicAmrDescription(), buildBasicTopology(), current_pose); TransportOrderStep pickup_1("tos1_1", {}, Location("0x0", "type", p0)); TransportOrderStep delivery_1("tos2_1", {}, Location("0x1", "type", p1)); @@ -379,7 +378,7 @@ TEST_CASE("One Transport, Move, and Action Order in one Task", "[basic]") { TEST_CASE("One Simple Transport Order with Time Window", "[temporal]") { // arrange auto current_pose = daisi::util::Pose(p0); - StnOrderManagement management(buildBasicAmrDescription(), buildBasicTopology(), current_pose); + StnTaskManagement management(buildBasicAmrDescription(), buildBasicTopology(), current_pose); // one transport order with time window TransportOrderStep pickup1("tos1", {}, Location("0x0", "type", p1)); @@ -421,7 +420,7 @@ TEST_CASE("One Simple Transport Order with Time Window", "[temporal]") { TEST_CASE("One Simple Transport Order with too short Time Window", "[temporal]") { // arrange auto current_pose = daisi::util::Pose(p0); - StnOrderManagement management(buildBasicAmrDescription(), buildBasicTopology(), current_pose); + StnTaskManagement management(buildBasicAmrDescription(), buildBasicTopology(), current_pose); // one transport order with time window TransportOrderStep pickup1("tos1", {}, Location("0x0", "type", p1)); @@ -468,8 +467,8 @@ TEST_CASE("One Simple Transport Order with too short Time Window", "[temporal]") TEST_CASE("Two Simple Transport Orders with overlapping Time Windows", "[temporal]") { // arrange - StnOrderManagement management(buildBasicAmrDescription(), buildBasicTopology(), - daisi::util::Pose(p0)); + StnTaskManagement management(buildBasicAmrDescription(), buildBasicTopology(), + daisi::util::Pose(p0)); // transport order 1 TransportOrderStep pickup_1("tos1_1", {}, Location("0x0", "type", p1)); @@ -494,8 +493,8 @@ TEST_CASE("Two Simple Transport Orders with overlapping Time Windows", "[tempora // ---------------------------------------------------------------- - StnOrderManagement management2(buildBasicAmrDescription(), buildBasicTopology(), - daisi::util::Pose(p0)); + StnTaskManagement management2(buildBasicAmrDescription(), buildBasicTopology(), + daisi::util::Pose(p0)); REQUIRE(management2.addTask(simple_task_1)); REQUIRE(management2.canAddTask(simple_task_2)); @@ -505,8 +504,8 @@ TEST_CASE("Two Simple Transport Orders with overlapping Time Windows", "[tempora simple_task_1.setTimeWindow(TimeWindow(20, 46, 0)); simple_task_2.setTimeWindow(TimeWindow(0, 80, 0)); - StnOrderManagement management3(buildBasicAmrDescription(), buildBasicTopology(), - daisi::util::Pose(p0)); + StnTaskManagement management3(buildBasicAmrDescription(), buildBasicTopology(), + daisi::util::Pose(p0)); REQUIRE(management3.canAddTask(simple_task_1)); REQUIRE(management3.canAddTask(simple_task_2)); @@ -515,8 +514,8 @@ TEST_CASE("Two Simple Transport Orders with overlapping Time Windows", "[tempora REQUIRE(management3.canAddTask(simple_task_1)); auto res = management3.getLatestCalculatedInsertionInfo(); - std::shared_ptr insertion_point = - std::static_pointer_cast(std::get<1>(res)); + std::shared_ptr insertion_point = + std::static_pointer_cast(std::get<1>(res)); REQUIRE(insertion_point->new_index == 0); // task 1 must be before task 2 REQUIRE(management3.setNextTask());