From 71cb01c0328e724cebfa79a88a0489f882d22e58 Mon Sep 17 00:00:00 2001 From: jgoedeke Date: Wed, 20 Sep 2023 11:54:12 +0200 Subject: [PATCH 1/2] refactor(daisi): Rename disposition to assignment --- cppcheck.conf | 4 +- .../common/scenariofile/cpps_scenariofile.h | 4 +- .../cpps/logical/algorithms/CMakeLists.txt | 2 +- .../logical/algorithms/algorithm_config.h | 4 +- .../CMakeLists.txt | 0 .../assignment/assignment_initiator.h | 54 +++++++++++++++++++ .../assignment/assignment_participant.h | 41 ++++++++++++++ .../auction_initiator_state.cpp | 0 .../auction_initiator_state.h | 6 +-- .../auction_participant_state.cpp | 0 .../auction_participant_state.h | 8 +-- .../centralized_initiator.cpp | 2 +- .../centralized_initiator.h | 8 +-- .../centralized_participant.cpp | 2 +- .../centralized_participant.h | 8 +-- ...iterated_auction_assignment_initiator.cpp} | 46 ++++++++-------- .../iterated_auction_assignment_initiator.h} | 18 +++---- ...erated_auction_assignment_participant.cpp} | 16 +++--- ...iterated_auction_assignment_participant.h} | 14 ++--- .../layered_precedence_graph.cpp | 0 .../layered_precedence_graph.h | 4 +- .../layered_precedence_graph_components.h | 4 +- .../round_robin_initiator.cpp | 0 .../round_robin_initiator.h | 4 +- .../disposition/disposition_initiator.h | 16 +++--- .../disposition/disposition_participant.h | 14 ++--- daisi/src/cpps/logical/amr/CMakeLists.txt | 4 +- .../cpps/logical/amr/amr_logical_agent.cpp | 8 +-- .../cpps/logical/material_flow/CMakeLists.txt | 4 +- .../material_flow_logical_agent.cpp | 12 ++--- daisi/tests/unittests/CMakeLists.txt | 2 +- .../auction_participant_state_test.cpp | 2 +- 32 files changed, 203 insertions(+), 108 deletions(-) rename daisi/src/cpps/logical/algorithms/{disposition => assignment}/CMakeLists.txt (100%) create mode 100644 daisi/src/cpps/logical/algorithms/assignment/assignment_initiator.h create mode 100644 daisi/src/cpps/logical/algorithms/assignment/assignment_participant.h rename daisi/src/cpps/logical/algorithms/{disposition => assignment}/auction_initiator_state.cpp (100%) rename daisi/src/cpps/logical/algorithms/{disposition => assignment}/auction_initiator_state.h (95%) rename daisi/src/cpps/logical/algorithms/{disposition => assignment}/auction_participant_state.cpp (100%) rename daisi/src/cpps/logical/algorithms/{disposition => assignment}/auction_participant_state.h (91%) rename daisi/src/cpps/logical/algorithms/{disposition => assignment}/centralized_initiator.cpp (98%) rename daisi/src/cpps/logical/algorithms/{disposition => assignment}/centralized_initiator.h (94%) rename daisi/src/cpps/logical/algorithms/{disposition => assignment}/centralized_participant.cpp (96%) rename daisi/src/cpps/logical/algorithms/{disposition => assignment}/centralized_participant.h (86%) rename daisi/src/cpps/logical/algorithms/{disposition/iterated_auction_disposition_initiator.cpp => assignment/iterated_auction_assignment_initiator.cpp} (82%) rename daisi/src/cpps/logical/algorithms/{disposition/iterated_auction_disposition_initiator.h => assignment/iterated_auction_assignment_initiator.h} (88%) rename daisi/src/cpps/logical/algorithms/{disposition/iterated_auction_disposition_participant.cpp => assignment/iterated_auction_assignment_participant.cpp} (90%) rename daisi/src/cpps/logical/algorithms/{disposition/iterated_auction_disposition_participant.h => assignment/iterated_auction_assignment_participant.h} (87%) rename daisi/src/cpps/logical/algorithms/{disposition => assignment}/layered_precedence_graph.cpp (100%) rename daisi/src/cpps/logical/algorithms/{disposition => assignment}/layered_precedence_graph.h (97%) rename daisi/src/cpps/logical/algorithms/{disposition => assignment}/layered_precedence_graph_components.h (93%) rename daisi/src/cpps/logical/algorithms/{disposition => assignment}/round_robin_initiator.cpp (100%) rename daisi/src/cpps/logical/algorithms/{disposition => assignment}/round_robin_initiator.h (96%) diff --git a/cppcheck.conf b/cppcheck.conf index d47abd8f..605eb0d2 100644 --- a/cppcheck.conf +++ b/cppcheck.conf @@ -29,10 +29,10 @@ constParameter:daisi/src/path_planning/message/handover_message.h constParameter:daisi/src/path_planning/consensus/paxos/message/response_message.h # avoid assignment inside initiatorList for readability -useInitializationList:daisi/src/cpps/logical/algorithms/disposition/centralized_initiator.cpp +useInitializationList:daisi/src/cpps/logical/algorithms/assignment/centralized_initiator.cpp # https://trac.cppcheck.net/ticket/10739 -internalAstError:daisi/src/cpps/logical/algorithms/disposition/iterated_auction_disposition_initiator.cpp +internalAstError:daisi/src/cpps/logical/algorithms/assignment/iterated_auction_assignment_initiator.cpp # Suppress third party *:third_party/* diff --git a/daisi/src/cpps/common/scenariofile/cpps_scenariofile.h b/daisi/src/cpps/common/scenariofile/cpps_scenariofile.h index eb906820..5571e22c 100644 --- a/daisi/src/cpps/common/scenariofile/cpps_scenariofile.h +++ b/daisi/src/cpps/common/scenariofile/cpps_scenariofile.h @@ -48,13 +48,13 @@ struct AlgorithmScenario { const std::unordered_map assignment_strategy_to_initiator_algorithm_type = { - {"iterated_auction", logical::AlgorithmType::kIteratedAuctionDispositionInitiator}, + {"iterated_auction", logical::AlgorithmType::kIteratedAuctionAssignmentInitiator}, {"round_robin", logical::AlgorithmType::kRoundRobinInitiator}, }; const std::unordered_map assignment_strategy_to_participant_algorithm_type = { - {"iterated_auction", logical::AlgorithmType::kIteratedAuctionDispositionParticipant}, + {"iterated_auction", logical::AlgorithmType::kIteratedAuctionAssignmentParticipant}, {"round_robin", logical::AlgorithmType::kRoundRobinParticipant}, }; diff --git a/daisi/src/cpps/logical/algorithms/CMakeLists.txt b/daisi/src/cpps/logical/algorithms/CMakeLists.txt index 5324f962..96915cf9 100644 --- a/daisi/src/cpps/logical/algorithms/CMakeLists.txt +++ b/daisi/src/cpps/logical/algorithms/CMakeLists.txt @@ -1,5 +1,5 @@ -add_subdirectory(disposition) +add_subdirectory(assignment) add_library(daisi_cpps_logical_algorithms_algorithm_config INTERFACE) target_sources(daisi_cpps_logical_algorithms_algorithm_config diff --git a/daisi/src/cpps/logical/algorithms/algorithm_config.h b/daisi/src/cpps/logical/algorithms/algorithm_config.h index acedb1f2..8e56a9b9 100644 --- a/daisi/src/cpps/logical/algorithms/algorithm_config.h +++ b/daisi/src/cpps/logical/algorithms/algorithm_config.h @@ -22,8 +22,8 @@ namespace daisi::cpps::logical { enum class AlgorithmType { - kIteratedAuctionDispositionInitiator, - kIteratedAuctionDispositionParticipant, + kIteratedAuctionAssignmentInitiator, + kIteratedAuctionAssignmentParticipant, kRoundRobinInitiator, kRoundRobinParticipant }; diff --git a/daisi/src/cpps/logical/algorithms/disposition/CMakeLists.txt b/daisi/src/cpps/logical/algorithms/assignment/CMakeLists.txt similarity index 100% rename from daisi/src/cpps/logical/algorithms/disposition/CMakeLists.txt rename to daisi/src/cpps/logical/algorithms/assignment/CMakeLists.txt diff --git a/daisi/src/cpps/logical/algorithms/assignment/assignment_initiator.h b/daisi/src/cpps/logical/algorithms/assignment/assignment_initiator.h new file mode 100644 index 00000000..da04f411 --- /dev/null +++ b/daisi/src/cpps/logical/algorithms/assignment/assignment_initiator.h @@ -0,0 +1,54 @@ +// Copyright 2023 The SOLA authors +// +// This file is part of DAISI. +// +// DAISI is free software: you can redistribute it and/or modify it under the terms of the GNU +// General Public License as published by the Free Software Foundation; version 2. +// +// DAISI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +// Public License for more details. +// +// You should have received a copy of the GNU General Public License along with DAISI. If not, see +// . +// +// SPDX-License-Identifier: GPL-2.0-only + +#ifndef DAISI_CPPS_LOGICAL_ALGORITHMS_ASSIGNMENT_ASSIGNMENT_INITIATOR_H_ +#define DAISI_CPPS_LOGICAL_ALGORITHMS_ASSIGNMENT_ASSIGNMENT_INITIATOR_H_ + +#include +#include + +#include "../algorithm_interface.h" +#include "cpps/common/cpps_communicator.h" +#include "cpps/common/cpps_logger_ns3.h" +#include "material_flow/model/material_flow.h" + +namespace daisi::cpps::logical { + +/// @brief Algorithm for assigning tasks from a material flow to fitting AMRs. +/// This algorithm is initiating and coordinating the procedure. +/// There always must be a corresponding derived class from AssignmentParticipant. +class AssignmentInitiator : public AlgorithmInterface { +public: + AssignmentInitiator(daisi::cpps::common::CppsCommunicatorPtr communicator, + std::shared_ptr logger) + : AlgorithmInterface(communicator), logger_(std::move(logger)){}; + + ~AssignmentInitiator() override = default; + + /// @brief Adding a material flow whose tasks should be allocated. + /// @param scheduler MFDL Scheduler + virtual void addMaterialFlow(std::shared_ptr scheduler) = 0; + + virtual void logMaterialFlowContent(const std::string &material_flow_uuid) = 0; + +protected: + /// @brief For logging material flow tasks and orders + std::shared_ptr logger_; +}; + +} // namespace daisi::cpps::logical + +#endif diff --git a/daisi/src/cpps/logical/algorithms/assignment/assignment_participant.h b/daisi/src/cpps/logical/algorithms/assignment/assignment_participant.h new file mode 100644 index 00000000..674cb674 --- /dev/null +++ b/daisi/src/cpps/logical/algorithms/assignment/assignment_participant.h @@ -0,0 +1,41 @@ +// Copyright 2023 The SOLA authors +// +// This file is part of DAISI. +// +// DAISI is free software: you can redistribute it and/or modify it under the terms of the GNU +// General Public License as published by the Free Software Foundation; version 2. +// +// DAISI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +// Public License for more details. +// +// You should have received a copy of the GNU General Public License along with DAISI. If not, see +// . +// +// SPDX-License-Identifier: GPL-2.0-only + +#ifndef DAISI_CPPS_LOGICAL_ALGORITHMS_ASSIGNMENT_ASSIGNMENT_PARTICIPANT_H_ +#define DAISI_CPPS_LOGICAL_ALGORITHMS_ASSIGNMENT_ASSIGNMENT_PARTICIPANT_H_ + +#include +#include + +#include "cpps/common/cpps_communicator.h" +#include "cpps/logical/algorithms/algorithm_interface.h" + +namespace daisi::cpps::logical { + +/// @brief Algorithm for assigning tasks from a material flow to fitting AMRs. +/// This algorithm is participating in the procedure which is beeing coordinated by an initiator. +/// There always must be a corresponding derived class from AssignmentInitiator. +class AssignmentParticipant : public AlgorithmInterface { +public: + explicit AssignmentParticipant(daisi::cpps::common::CppsCommunicatorPtr communicator) + : AlgorithmInterface(communicator){}; + + ~AssignmentParticipant() override = default; +}; + +} // namespace daisi::cpps::logical + +#endif diff --git a/daisi/src/cpps/logical/algorithms/disposition/auction_initiator_state.cpp b/daisi/src/cpps/logical/algorithms/assignment/auction_initiator_state.cpp similarity index 100% rename from daisi/src/cpps/logical/algorithms/disposition/auction_initiator_state.cpp rename to daisi/src/cpps/logical/algorithms/assignment/auction_initiator_state.cpp diff --git a/daisi/src/cpps/logical/algorithms/disposition/auction_initiator_state.h b/daisi/src/cpps/logical/algorithms/assignment/auction_initiator_state.h similarity index 95% rename from daisi/src/cpps/logical/algorithms/disposition/auction_initiator_state.h rename to daisi/src/cpps/logical/algorithms/assignment/auction_initiator_state.h index 7c85bdd6..9e7240e2 100644 --- a/daisi/src/cpps/logical/algorithms/disposition/auction_initiator_state.h +++ b/daisi/src/cpps/logical/algorithms/assignment/auction_initiator_state.h @@ -14,8 +14,8 @@ // // SPDX-License-Identifier: GPL-2.0-only -#ifndef DAISI_CPPS_LOGICAL_ALGORITHMS_DISPOSITION_AUCTION_INITIATOR_STATE_H_ -#define DAISI_CPPS_LOGICAL_ALGORITHMS_DISPOSITION_AUCTION_INITIATOR_STATE_H_ +#ifndef DAISI_CPPS_LOGICAL_ALGORITHMS_ASSIGNMENT_AUCTION_INITIATOR_STATE_H_ +#define DAISI_CPPS_LOGICAL_ALGORITHMS_ASSIGNMENT_AUCTION_INITIATOR_STATE_H_ #include @@ -27,7 +27,7 @@ namespace daisi::cpps::logical { -/// @brief Helper class for the IteratedAuctionDispositionInitiator to handle and store the state of +/// @brief Helper class for the IteratedAuctionAssignmentInitiator to handle and store the state of /// received bids and winner responses. class AuctionInitiatorState { public: diff --git a/daisi/src/cpps/logical/algorithms/disposition/auction_participant_state.cpp b/daisi/src/cpps/logical/algorithms/assignment/auction_participant_state.cpp similarity index 100% rename from daisi/src/cpps/logical/algorithms/disposition/auction_participant_state.cpp rename to daisi/src/cpps/logical/algorithms/assignment/auction_participant_state.cpp diff --git a/daisi/src/cpps/logical/algorithms/disposition/auction_participant_state.h b/daisi/src/cpps/logical/algorithms/assignment/auction_participant_state.h similarity index 91% rename from daisi/src/cpps/logical/algorithms/disposition/auction_participant_state.h rename to daisi/src/cpps/logical/algorithms/assignment/auction_participant_state.h index a00588cf..aaeb5ced 100644 --- a/daisi/src/cpps/logical/algorithms/disposition/auction_participant_state.h +++ b/daisi/src/cpps/logical/algorithms/assignment/auction_participant_state.h @@ -14,8 +14,8 @@ // // SPDX-License-Identifier: GPL-2.0-only -#ifndef DAISI_CPPS_LOGICAL_ALGORITHMS_DISPOSITION_AUCTION_PARTICIPANT_STATE_H_ -#define DAISI_CPPS_LOGICAL_ALGORITHMS_DISPOSITION_AUCTION_PARTICIPANT_STATE_H_ +#ifndef DAISI_CPPS_LOGICAL_ALGORITHMS_ASSIGNMENT_AUCTION_PARTICIPANT_STATE_H_ +#define DAISI_CPPS_LOGICAL_ALGORITHMS_ASSIGNMENT_AUCTION_PARTICIPANT_STATE_H_ #include #include @@ -27,7 +27,7 @@ namespace daisi::cpps::logical { -/// @brief Helper struct for the IteratedAuctionDispositionParticipant, used inside of the +/// @brief Helper struct for the IteratedAuctionAssignmentParticipant, used inside of the /// AuctionParticipantState, to store information related to exactly one task. /// This includes the previously calculated bids (metrics) and insertion points. struct AuctionParticipantTaskState { @@ -64,7 +64,7 @@ struct AuctionParticipantTaskState { std::shared_ptr insertion_point_; }; -/// @brief Helper struct for the IteratedAuctionDispositionParticipant to store the state of open +/// @brief Helper struct for the IteratedAuctionAssignmentParticipant to store the state of open /// auction processes, calculated bids (metrics) and insertion points. /// Each AuctionParticipantState is only responsible for one auction process by one dedicated /// initiator. diff --git a/daisi/src/cpps/logical/algorithms/disposition/centralized_initiator.cpp b/daisi/src/cpps/logical/algorithms/assignment/centralized_initiator.cpp similarity index 98% rename from daisi/src/cpps/logical/algorithms/disposition/centralized_initiator.cpp rename to daisi/src/cpps/logical/algorithms/assignment/centralized_initiator.cpp index 0b266b57..9b9d7c13 100644 --- a/daisi/src/cpps/logical/algorithms/disposition/centralized_initiator.cpp +++ b/daisi/src/cpps/logical/algorithms/assignment/centralized_initiator.cpp @@ -19,7 +19,7 @@ namespace daisi::cpps::logical { CentralizedInitiator::CentralizedInitiator(daisi::cpps::common::CppsCommunicatorPtr communicator, std::shared_ptr logger) - : DispositionInitiator(communicator, logger) { + : AssignmentInitiator(communicator, logger) { // create request to gain information about all active AMR's sola::Request amr_request; amr_request.all = true; diff --git a/daisi/src/cpps/logical/algorithms/disposition/centralized_initiator.h b/daisi/src/cpps/logical/algorithms/assignment/centralized_initiator.h similarity index 94% rename from daisi/src/cpps/logical/algorithms/disposition/centralized_initiator.h rename to daisi/src/cpps/logical/algorithms/assignment/centralized_initiator.h index 04196c81..0c492942 100644 --- a/daisi/src/cpps/logical/algorithms/disposition/centralized_initiator.h +++ b/daisi/src/cpps/logical/algorithms/assignment/centralized_initiator.h @@ -14,18 +14,18 @@ // // SPDX-License-Identifier: GPL-2.0-only -#ifndef DAISI_CPPS_LOGICAL_ALGORITHMS_DISPOSITION_CENTRALIZED_INITIATOR_H_ -#define DAISI_CPPS_LOGICAL_ALGORITHMS_DISPOSITION_CENTRALIZED_INITIATOR_H_ +#ifndef DAISI_CPPS_LOGICAL_ALGORITHMS_ASSIGNMENT_CENTRALIZED_INITIATOR_H_ +#define DAISI_CPPS_LOGICAL_ALGORITHMS_ASSIGNMENT_CENTRALIZED_INITIATOR_H_ +#include "assignment_initiator.h" #include "cpps/common/cpps_communicator.h" -#include "disposition_initiator.h" namespace daisi::cpps::logical { /// @brief Algorithm that centrally assigns tasks of incoming material flows to the /// corresponding centralized participants. Should be implemented by any concrete centralized task /// assignment algorithm. -class CentralizedInitiator : public DispositionInitiator { +class CentralizedInitiator : public AssignmentInitiator { public: CentralizedInitiator(daisi::cpps::common::CppsCommunicatorPtr communicator, std::shared_ptr logger); diff --git a/daisi/src/cpps/logical/algorithms/disposition/centralized_participant.cpp b/daisi/src/cpps/logical/algorithms/assignment/centralized_participant.cpp similarity index 96% rename from daisi/src/cpps/logical/algorithms/disposition/centralized_participant.cpp rename to daisi/src/cpps/logical/algorithms/assignment/centralized_participant.cpp index 35c25ed6..5e053628 100644 --- a/daisi/src/cpps/logical/algorithms/disposition/centralized_participant.cpp +++ b/daisi/src/cpps/logical/algorithms/assignment/centralized_participant.cpp @@ -21,7 +21,7 @@ namespace daisi::cpps::logical { CentralizedParticipant::CentralizedParticipant( daisi::cpps::common::CppsCommunicatorPtr communicator, std::shared_ptr order_management) - : DispositionParticipant(communicator), order_management_(std::move((order_management))){}; + : AssignmentParticipant(communicator), order_management_(std::move((order_management))){}; bool CentralizedParticipant::process(const AssignmentNotification &assignment_notification) { const material_flow::Task assigned_task = assignment_notification.getTask(); diff --git a/daisi/src/cpps/logical/algorithms/disposition/centralized_participant.h b/daisi/src/cpps/logical/algorithms/assignment/centralized_participant.h similarity index 86% rename from daisi/src/cpps/logical/algorithms/disposition/centralized_participant.h rename to daisi/src/cpps/logical/algorithms/assignment/centralized_participant.h index 88d257b2..321052bf 100644 --- a/daisi/src/cpps/logical/algorithms/disposition/centralized_participant.h +++ b/daisi/src/cpps/logical/algorithms/assignment/centralized_participant.h @@ -14,18 +14,18 @@ // // SPDX-License-Identifier: GPL-2.0-only -#ifndef DAISI_CPPS_LOGICAL_ALGORITHMS_DISPOSITION_CENTRALIZED_PARTICIPANT_H_ -#define DAISI_CPPS_LOGICAL_ALGORITHMS_DISPOSITION_CENTRALIZED_PARTICIPANT_H_ +#ifndef DAISI_CPPS_LOGICAL_ALGORITHMS_ASSIGNMENT_CENTRALIZED_PARTICIPANT_H_ +#define DAISI_CPPS_LOGICAL_ALGORITHMS_ASSIGNMENT_CENTRALIZED_PARTICIPANT_H_ +#include "assignment_participant.h" #include "cpps/common/cpps_communicator.h" #include "cpps/logical/order_management/simple_order_management.h" -#include "disposition_participant.h" namespace daisi::cpps::logical { /// @brief Participant of a centralized task assignment strategy. Since the task assignment strategy /// is defined by the central allocator, the participant only needs to handle new task assignments. -class CentralizedParticipant : public DispositionParticipant { +class CentralizedParticipant : public AssignmentParticipant { public: CentralizedParticipant(daisi::cpps::common::CppsCommunicatorPtr communicator, std::shared_ptr order_management); diff --git a/daisi/src/cpps/logical/algorithms/disposition/iterated_auction_disposition_initiator.cpp b/daisi/src/cpps/logical/algorithms/assignment/iterated_auction_assignment_initiator.cpp similarity index 82% rename from daisi/src/cpps/logical/algorithms/disposition/iterated_auction_disposition_initiator.cpp rename to daisi/src/cpps/logical/algorithms/assignment/iterated_auction_assignment_initiator.cpp index ed71d924..dfa3a6a7 100644 --- a/daisi/src/cpps/logical/algorithms/disposition/iterated_auction_disposition_initiator.cpp +++ b/daisi/src/cpps/logical/algorithms/assignment/iterated_auction_assignment_initiator.cpp @@ -14,25 +14,25 @@ // // SPDX-License-Identifier: GPL-2.0-only -#include "iterated_auction_disposition_initiator.h" +#include "iterated_auction_assignment_initiator.h" #include "cpps/amr/model/amr_fleet.h" #include "ns3/simulator.h" namespace daisi::cpps::logical { -IteratedAuctionDispositionInitiator::IteratedAuctionDispositionInitiator( +IteratedAuctionAssignmentInitiator::IteratedAuctionAssignmentInitiator( daisi::cpps::common::CppsCommunicatorPtr communicator, std::shared_ptr logger) - : DispositionInitiator(communicator, logger) { + : AssignmentInitiator(communicator, logger) { // assuming that sola is fully initialized at this point auto preparation_duration = prepareInteraction(); ns3::Simulator::Schedule(ns3::Seconds(preparation_duration), - &IteratedAuctionDispositionInitiator::setPreparationFinished, this); + &IteratedAuctionAssignmentInitiator::setPreparationFinished, this); } -void IteratedAuctionDispositionInitiator::addMaterialFlow( +void IteratedAuctionAssignmentInitiator::addMaterialFlow( std::shared_ptr scheduler) { if (layered_precedence_graph_) { throw std::runtime_error("A material flow is already processed currently. Support of multiple " @@ -53,7 +53,7 @@ void IteratedAuctionDispositionInitiator::addMaterialFlow( } } -daisi::util::Duration IteratedAuctionDispositionInitiator::prepareInteraction() { +daisi::util::Duration IteratedAuctionAssignmentInitiator::prepareInteraction() { auto available_abilities = AmrFleet::get().getAllExistingAbilities(); uint8_t topic_counter = 0; @@ -70,18 +70,18 @@ daisi::util::Duration IteratedAuctionDispositionInitiator::prepareInteraction() return delays_.subscribe_topic * topic_counter; } -void IteratedAuctionDispositionInitiator::setPreparationFinished() { preparation_finished_ = true; } +void IteratedAuctionAssignmentInitiator::setPreparationFinished() { preparation_finished_ = true; } -void IteratedAuctionDispositionInitiator::startIteration() { +void IteratedAuctionAssignmentInitiator::startIteration() { // Sending CallForProposal messages to initiate the auction. callForProposal(); // Starting loop to assign all auctionable tasks ns3::Simulator::Schedule(ns3::Seconds(delays_.waiting_to_receive_bids), - &IteratedAuctionDispositionInitiator::bidProcessing, this); + &IteratedAuctionAssignmentInitiator::bidProcessing, this); } -void IteratedAuctionDispositionInitiator::finishIteration() { +void IteratedAuctionAssignmentInitiator::finishIteration() { // Moving all free tasks from the free layer to the scheduled layer // and updating the other layers accordingly layered_precedence_graph_->next(); @@ -98,7 +98,7 @@ void IteratedAuctionDispositionInitiator::finishIteration() { } } -void IteratedAuctionDispositionInitiator::bidProcessing() { +void IteratedAuctionAssignmentInitiator::bidProcessing() { // Receiving bids in the meantime auction_initiator_state_->countBidSubmissionProcessing(); @@ -110,18 +110,18 @@ void IteratedAuctionDispositionInitiator::bidProcessing() { // Scheduling the processing of winner responses ns3::Simulator::Schedule(ns3::Seconds(delays_.waiting_to_receive_winner_responses), - &IteratedAuctionDispositionInitiator::winnerResponseProcessing, this); + &IteratedAuctionAssignmentInitiator::winnerResponseProcessing, this); } else { // If no winners were found, we renotify the participants with IterationNotifcations iterationNotification(layered_precedence_graph_->getAuctionableTasks()); // Continuing the loop ns3::Simulator::Schedule(ns3::Seconds(delays_.waiting_to_receive_bids), - &IteratedAuctionDispositionInitiator::bidProcessing, this); + &IteratedAuctionAssignmentInitiator::bidProcessing, this); } } -void IteratedAuctionDispositionInitiator::winnerResponseProcessing() { +void IteratedAuctionAssignmentInitiator::winnerResponseProcessing() { // Receiving WinnerResponse messages in the meantime auction_initiator_state_->countWinnerResponseProcessing(); @@ -136,11 +136,11 @@ void IteratedAuctionDispositionInitiator::winnerResponseProcessing() { } else { // Continuing the loop as there are still unscheduled tasks left in this iteration ns3::Simulator::Schedule(ns3::Seconds(delays_.waiting_to_receive_bids), - &IteratedAuctionDispositionInitiator::bidProcessing, this); + &IteratedAuctionAssignmentInitiator::bidProcessing, this); } } -void IteratedAuctionDispositionInitiator::callForProposal() { +void IteratedAuctionAssignmentInitiator::callForProposal() { auto initiator_connection = communicator_->network.getConnectionString(); // Mapping of which tasks should be published with a CallForProposal on which ability topic. @@ -156,7 +156,7 @@ void IteratedAuctionDispositionInitiator::callForProposal() { } } -void IteratedAuctionDispositionInitiator::iterationNotification( +void IteratedAuctionAssignmentInitiator::iterationNotification( const std::vector &tasks) { auto initiator_connection = communicator_->network.getConnectionString(); @@ -178,7 +178,7 @@ void IteratedAuctionDispositionInitiator::iterationNotification( } } -void IteratedAuctionDispositionInitiator::notifyWinners( +void IteratedAuctionAssignmentInitiator::notifyWinners( const std::vector &winners) { auction_initiator_state_->clearWinnerAcceptions(); auto initiator_connection = communicator_->network.getConnectionString(); @@ -193,7 +193,7 @@ void IteratedAuctionDispositionInitiator::notifyWinners( std::unordered_map, amr::AmrStaticAbilityHasher> -IteratedAuctionDispositionInitiator::getTaskAbilityMapping( +IteratedAuctionAssignmentInitiator::getTaskAbilityMapping( const std::vector &tasks) { std::unordered_map, amr::AmrStaticAbilityHasher> @@ -210,7 +210,7 @@ IteratedAuctionDispositionInitiator::getTaskAbilityMapping( return task_ability_mapping; } -void IteratedAuctionDispositionInitiator::logMaterialFlowContent( +void IteratedAuctionAssignmentInitiator::logMaterialFlowContent( const std::string &material_flow_uuid) { for (const auto &task : layered_precedence_graph_->getTasks()) { logger_->logMaterialFlowTask(task, material_flow_uuid); @@ -223,7 +223,7 @@ void IteratedAuctionDispositionInitiator::logMaterialFlowContent( } } -void IteratedAuctionDispositionInitiator::logMaterialFlowOrderStatesOfTask( +void IteratedAuctionAssignmentInitiator::logMaterialFlowOrderStatesOfTask( const material_flow::Task &task, const OrderStates &order_state) { for (auto i = 0; i < task.getOrders().size(); i++) { MaterialFlowOrderUpdateLoggingInfo logging_info; @@ -235,12 +235,12 @@ void IteratedAuctionDispositionInitiator::logMaterialFlowOrderStatesOfTask( } } -bool IteratedAuctionDispositionInitiator::process(const BidSubmission &bid_submission) { +bool IteratedAuctionAssignmentInitiator::process(const BidSubmission &bid_submission) { auction_initiator_state_->addBidSubmission(bid_submission); return true; } -bool IteratedAuctionDispositionInitiator::process(const WinnerResponse &winner_response) { +bool IteratedAuctionAssignmentInitiator::process(const WinnerResponse &winner_response) { if (winner_response.doesAccept()) { auto task = layered_precedence_graph_->getTask(winner_response.getTaskUuid()); logMaterialFlowOrderStatesOfTask(task, OrderStates::kQueued); diff --git a/daisi/src/cpps/logical/algorithms/disposition/iterated_auction_disposition_initiator.h b/daisi/src/cpps/logical/algorithms/assignment/iterated_auction_assignment_initiator.h similarity index 88% rename from daisi/src/cpps/logical/algorithms/disposition/iterated_auction_disposition_initiator.h rename to daisi/src/cpps/logical/algorithms/assignment/iterated_auction_assignment_initiator.h index 8ada1fdd..128e46bd 100644 --- a/daisi/src/cpps/logical/algorithms/disposition/iterated_auction_disposition_initiator.h +++ b/daisi/src/cpps/logical/algorithms/assignment/iterated_auction_assignment_initiator.h @@ -14,35 +14,35 @@ // // SPDX-License-Identifier: GPL-2.0-only -#ifndef DAISI_CPPS_LOGICAL_ALGORITHMS_DISPOSITION_ITERATED_AUCTION_DISPOSITION_INITIATOR_H_ -#define DAISI_CPPS_LOGICAL_ALGORITHMS_DISPOSITION_ITERATED_AUCTION_DISPOSITION_INITIATOR_H_ +#ifndef DAISI_CPPS_LOGICAL_ALGORITHMS_ASSIGNMENT_ITERATED_AUCTION_ASSIGNMENT_INITIATOR_H_ +#define DAISI_CPPS_LOGICAL_ALGORITHMS_ASSIGNMENT_ITERATED_AUCTION_ASSIGNMENT_INITIATOR_H_ #include #include +#include "assignment_initiator.h" #include "auction_initiator_state.h" #include "cpps/common/cpps_communicator.h" -#include "disposition_initiator.h" #include "layered_precedence_graph.h" #include "utils/structure_helpers.h" namespace daisi::cpps::logical { -/// @brief The initiator class for auction-based disposition, based on the TePSSI algorithm from +/// @brief The initiator class for auction-based assignment, based on the TePSSI algorithm from /// Nunes, E., McIntire, M., & Gini, M. (2017). Decentralized multi-robot allocation of tasks with /// temporal and precedence constraints. Advanced Robotics, 31(22), 1193-1207. /// -/// This class is the counterpart of the IteratedAuctionDispositionParticipant. +/// This class is the counterpart of the IteratedAuctionAssignmentParticipant. /// /// Modifications were made to the algorithm by sending CallForPropsal and IterationNotification /// messages on separate topcis by assuming separate topics for robots (AMRs) with different /// physical properties (abilities). -class IteratedAuctionDispositionInitiator : public DispositionInitiator { +class IteratedAuctionAssignmentInitiator : public AssignmentInitiator { public: - IteratedAuctionDispositionInitiator(daisi::cpps::common::CppsCommunicatorPtr communicator, - std::shared_ptr logger); + IteratedAuctionAssignmentInitiator(daisi::cpps::common::CppsCommunicatorPtr communicator, + std::shared_ptr logger); - ~IteratedAuctionDispositionInitiator() override = default; + ~IteratedAuctionAssignmentInitiator() override = default; /// @brief Storing bid submission information in a helper class to determine winners. REGISTER_IMPLEMENTATION(BidSubmission) diff --git a/daisi/src/cpps/logical/algorithms/disposition/iterated_auction_disposition_participant.cpp b/daisi/src/cpps/logical/algorithms/assignment/iterated_auction_assignment_participant.cpp similarity index 90% rename from daisi/src/cpps/logical/algorithms/disposition/iterated_auction_disposition_participant.cpp rename to daisi/src/cpps/logical/algorithms/assignment/iterated_auction_assignment_participant.cpp index 2cbf1548..33e2b173 100644 --- a/daisi/src/cpps/logical/algorithms/disposition/iterated_auction_disposition_participant.cpp +++ b/daisi/src/cpps/logical/algorithms/assignment/iterated_auction_assignment_participant.cpp @@ -14,24 +14,24 @@ // // SPDX-License-Identifier: GPL-2.0-only -#include "iterated_auction_disposition_participant.h" +#include "iterated_auction_assignment_participant.h" #include "cpps/amr/model/amr_fleet.h" #include "cpps/logical/message/auction_based/bid_submission.h" namespace daisi::cpps::logical { -IteratedAuctionDispositionParticipant::IteratedAuctionDispositionParticipant( +IteratedAuctionAssignmentParticipant::IteratedAuctionAssignmentParticipant( daisi::cpps::common::CppsCommunicatorPtr communicator, std::shared_ptr order_management, AmrDescription description) - : DispositionParticipant(communicator), + : AssignmentParticipant(communicator), order_management_(std::move(order_management)), description_(std::move(description)) { auto topic = AmrFleet::get().getTopicForAbility(description_.getLoadHandling().getAbility()); communicator_->sola.subscribeTopic(topic); } -bool IteratedAuctionDispositionParticipant::process(const CallForProposal &call_for_proposal) { +bool IteratedAuctionAssignmentParticipant::process(const CallForProposal &call_for_proposal) { AuctionParticipantState state(call_for_proposal.getTasks()); auto initiator_connection = call_for_proposal.getInitiatorConnection(); @@ -52,7 +52,7 @@ bool IteratedAuctionDispositionParticipant::process(const CallForProposal &call_ return true; } -bool IteratedAuctionDispositionParticipant::process( +bool IteratedAuctionAssignmentParticipant::process( const IterationNotification &iteration_notification) { std::string initiator_connection = iteration_notification.getInitiatorConnection(); @@ -74,7 +74,7 @@ bool IteratedAuctionDispositionParticipant::process( return true; } -bool IteratedAuctionDispositionParticipant::process(const WinnerNotification &winner_notification) { +bool IteratedAuctionAssignmentParticipant::process(const WinnerNotification &winner_notification) { std::string initiator_connection = winner_notification.getInitiatorConnection(); std::string task_uuid = winner_notification.getTaskUuid(); @@ -130,7 +130,7 @@ bool IteratedAuctionDispositionParticipant::process(const WinnerNotification &wi return true; } -void IteratedAuctionDispositionParticipant::calculateBids(AuctionParticipantState &state) { +void IteratedAuctionAssignmentParticipant::calculateBids(AuctionParticipantState &state) { for (auto &pair : state.task_state_mapping) { // Iterating through each task state of this auction process @@ -147,7 +147,7 @@ void IteratedAuctionDispositionParticipant::calculateBids(AuctionParticipantStat state.prune(); } -void IteratedAuctionDispositionParticipant::submitBid(const std::string &initiator_connection) { +void IteratedAuctionAssignmentParticipant::submitBid(const std::string &initiator_connection) { auto it_state = initiator_auction_state_mapping_.find(initiator_connection); if (it_state == initiator_auction_state_mapping_.end()) { throw std::runtime_error("Auction state for initiator connection not found."); diff --git a/daisi/src/cpps/logical/algorithms/disposition/iterated_auction_disposition_participant.h b/daisi/src/cpps/logical/algorithms/assignment/iterated_auction_assignment_participant.h similarity index 87% rename from daisi/src/cpps/logical/algorithms/disposition/iterated_auction_disposition_participant.h rename to daisi/src/cpps/logical/algorithms/assignment/iterated_auction_assignment_participant.h index d93b073f..d6b352ef 100644 --- a/daisi/src/cpps/logical/algorithms/disposition/iterated_auction_disposition_participant.h +++ b/daisi/src/cpps/logical/algorithms/assignment/iterated_auction_assignment_participant.h @@ -14,33 +14,33 @@ // // SPDX-License-Identifier: GPL-2.0-only -#ifndef DAISI_CPPS_LOGICAL_ALGORITHMS_DISPOSITION_ITERATED_AUCTION_DISPOSITION_PARTICIPANT_H_ -#define DAISI_CPPS_LOGICAL_ALGORITHMS_DISPOSITION_ITERATED_AUCTION_DISPOSITION_PARTICIPANT_H_ +#ifndef DAISI_CPPS_LOGICAL_ALGORITHMS_ASSIGNMENT_ITERATED_AUCTION_ASSIGNMENT_PARTICIPANT_H_ +#define DAISI_CPPS_LOGICAL_ALGORITHMS_ASSIGNMENT_ITERATED_AUCTION_ASSIGNMENT_PARTICIPANT_H_ #include #include +#include "assignment_participant.h" #include "auction_participant_state.h" #include "cpps/common/cpps_communicator.h" #include "cpps/logical/order_management/auction_based_order_management.h" -#include "disposition_participant.h" namespace daisi::cpps::logical { -/// @brief This class is the counterpart of the IteratedAuctionDispositionInitiator, particpanting +/// @brief This class is the counterpart of the IteratedAuctionAssignmentInitiator, particpanting /// in the iterated auction procedure. It must be able to process, IterationNotification, and /// WinnerNotification messages. /// /// The participant is responsible for managing states of each auction it is taking place, /// represented by different initiator connection strings, and storing which bids with insertion /// infos it has submitted. -class IteratedAuctionDispositionParticipant : public DispositionParticipant { +class IteratedAuctionAssignmentParticipant : public AssignmentParticipant { public: - explicit IteratedAuctionDispositionParticipant( + explicit IteratedAuctionAssignmentParticipant( daisi::cpps::common::CppsCommunicatorPtr communicator, std::shared_ptr order_management, AmrDescription description); - ~IteratedAuctionDispositionParticipant() override = default; + ~IteratedAuctionAssignmentParticipant() override = default; /// @brief To process a CallForProposal we need to initiate AuctionParticipantState for this /// auction process, initially calculate possible bids for each open task, and consequently submit diff --git a/daisi/src/cpps/logical/algorithms/disposition/layered_precedence_graph.cpp b/daisi/src/cpps/logical/algorithms/assignment/layered_precedence_graph.cpp similarity index 100% rename from daisi/src/cpps/logical/algorithms/disposition/layered_precedence_graph.cpp rename to daisi/src/cpps/logical/algorithms/assignment/layered_precedence_graph.cpp diff --git a/daisi/src/cpps/logical/algorithms/disposition/layered_precedence_graph.h b/daisi/src/cpps/logical/algorithms/assignment/layered_precedence_graph.h similarity index 97% rename from daisi/src/cpps/logical/algorithms/disposition/layered_precedence_graph.h rename to daisi/src/cpps/logical/algorithms/assignment/layered_precedence_graph.h index ac0f32be..dd391f74 100644 --- a/daisi/src/cpps/logical/algorithms/disposition/layered_precedence_graph.h +++ b/daisi/src/cpps/logical/algorithms/assignment/layered_precedence_graph.h @@ -14,8 +14,8 @@ // // SPDX-License-Identifier: GPL-2.0-only -#ifndef DAISI_CPPS_LOGICAL_ALGORITHMS_DISPOSITION_LAYERED_PRECEDENCE_GRAPH_H_ -#define DAISI_CPPS_LOGICAL_ALGORITHMS_DISPOSITION_LAYERED_PRECEDENCE_GRAPH_H_ +#ifndef DAISI_CPPS_LOGICAL_ALGORITHMS_ASSIGNMENT_LAYERED_PRECEDENCE_GRAPH_H_ +#define DAISI_CPPS_LOGICAL_ALGORITHMS_ASSIGNMENT_LAYERED_PRECEDENCE_GRAPH_H_ #include #include diff --git a/daisi/src/cpps/logical/algorithms/disposition/layered_precedence_graph_components.h b/daisi/src/cpps/logical/algorithms/assignment/layered_precedence_graph_components.h similarity index 93% rename from daisi/src/cpps/logical/algorithms/disposition/layered_precedence_graph_components.h rename to daisi/src/cpps/logical/algorithms/assignment/layered_precedence_graph_components.h index 04a488fd..acce7bb1 100644 --- a/daisi/src/cpps/logical/algorithms/disposition/layered_precedence_graph_components.h +++ b/daisi/src/cpps/logical/algorithms/assignment/layered_precedence_graph_components.h @@ -14,8 +14,8 @@ // // SPDX-License-Identifier: GPL-2.0-only -#ifndef DAISI_CPPS_LOGICAL_ALGORITHMS_DISPOSITION_LAYERED_PRECEDENCE_GRAPH_COMPONENTS_H_ -#define DAISI_CPPS_LOGICAL_ALGORITHMS_DISPOSITION_LAYERED_PRECEDENCE_GRAPH_COMPONENTS_H_ +#ifndef DAISI_CPPS_LOGICAL_ALGORITHMS_ASSIGNMENT_LAYERED_PRECEDENCE_GRAPH_COMPONENTS_H_ +#define DAISI_CPPS_LOGICAL_ALGORITHMS_ASSIGNMENT_LAYERED_PRECEDENCE_GRAPH_COMPONENTS_H_ #include #include diff --git a/daisi/src/cpps/logical/algorithms/disposition/round_robin_initiator.cpp b/daisi/src/cpps/logical/algorithms/assignment/round_robin_initiator.cpp similarity index 100% rename from daisi/src/cpps/logical/algorithms/disposition/round_robin_initiator.cpp rename to daisi/src/cpps/logical/algorithms/assignment/round_robin_initiator.cpp diff --git a/daisi/src/cpps/logical/algorithms/disposition/round_robin_initiator.h b/daisi/src/cpps/logical/algorithms/assignment/round_robin_initiator.h similarity index 96% rename from daisi/src/cpps/logical/algorithms/disposition/round_robin_initiator.h rename to daisi/src/cpps/logical/algorithms/assignment/round_robin_initiator.h index 2c12574c..f6672381 100644 --- a/daisi/src/cpps/logical/algorithms/disposition/round_robin_initiator.h +++ b/daisi/src/cpps/logical/algorithms/assignment/round_robin_initiator.h @@ -14,8 +14,8 @@ // // SPDX-License-Identifier: GPL-2.0-only -#ifndef DAISI_CPPS_LOGICAL_ALGORITHMS_DISPOSITION_ROUND_ROBIN_INITIATOR_H_ -#define DAISI_CPPS_LOGICAL_ALGORITHMS_DISPOSITION_ROUND_ROBIN_INITIATOR_H_ +#ifndef DAISI_CPPS_LOGICAL_ALGORITHMS_ASSIGNMENT_ROUND_ROBIN_INITIATOR_H_ +#define DAISI_CPPS_LOGICAL_ALGORITHMS_ASSIGNMENT_ROUND_ROBIN_INITIATOR_H_ #include #include diff --git a/daisi/src/cpps/logical/algorithms/disposition/disposition_initiator.h b/daisi/src/cpps/logical/algorithms/disposition/disposition_initiator.h index baf84148..da04f411 100644 --- a/daisi/src/cpps/logical/algorithms/disposition/disposition_initiator.h +++ b/daisi/src/cpps/logical/algorithms/disposition/disposition_initiator.h @@ -14,8 +14,8 @@ // // SPDX-License-Identifier: GPL-2.0-only -#ifndef DAISI_CPPS_LOGICAL_ALGORITHMS_DISPOSITION_DISPOSITION_INITIATOR_H_ -#define DAISI_CPPS_LOGICAL_ALGORITHMS_DISPOSITION_DISPOSITION_INITIATOR_H_ +#ifndef DAISI_CPPS_LOGICAL_ALGORITHMS_ASSIGNMENT_ASSIGNMENT_INITIATOR_H_ +#define DAISI_CPPS_LOGICAL_ALGORITHMS_ASSIGNMENT_ASSIGNMENT_INITIATOR_H_ #include #include @@ -27,16 +27,16 @@ namespace daisi::cpps::logical { -/// @brief Algorithm for disposing tasks from a material flow to fitting AMRs. +/// @brief Algorithm for assigning tasks from a material flow to fitting AMRs. /// This algorithm is initiating and coordinating the procedure. -/// There always must be a corresponding derived class from DispositionParticipant. -class DispositionInitiator : public AlgorithmInterface { +/// There always must be a corresponding derived class from AssignmentParticipant. +class AssignmentInitiator : public AlgorithmInterface { public: - DispositionInitiator(daisi::cpps::common::CppsCommunicatorPtr communicator, - std::shared_ptr logger) + AssignmentInitiator(daisi::cpps::common::CppsCommunicatorPtr communicator, + std::shared_ptr logger) : AlgorithmInterface(communicator), logger_(std::move(logger)){}; - ~DispositionInitiator() override = default; + ~AssignmentInitiator() override = default; /// @brief Adding a material flow whose tasks should be allocated. /// @param scheduler MFDL Scheduler diff --git a/daisi/src/cpps/logical/algorithms/disposition/disposition_participant.h b/daisi/src/cpps/logical/algorithms/disposition/disposition_participant.h index e18d9cce..674cb674 100644 --- a/daisi/src/cpps/logical/algorithms/disposition/disposition_participant.h +++ b/daisi/src/cpps/logical/algorithms/disposition/disposition_participant.h @@ -14,8 +14,8 @@ // // SPDX-License-Identifier: GPL-2.0-only -#ifndef DAISI_CPPS_LOGICAL_ALGORITHMS_DISPOSITION_DISPOSITION_PARTICIPANT_H_ -#define DAISI_CPPS_LOGICAL_ALGORITHMS_DISPOSITION_DISPOSITION_PARTICIPANT_H_ +#ifndef DAISI_CPPS_LOGICAL_ALGORITHMS_ASSIGNMENT_ASSIGNMENT_PARTICIPANT_H_ +#define DAISI_CPPS_LOGICAL_ALGORITHMS_ASSIGNMENT_ASSIGNMENT_PARTICIPANT_H_ #include #include @@ -25,15 +25,15 @@ namespace daisi::cpps::logical { -/// @brief Algorithm for disposing tasks from a material flow to fitting AMRs. +/// @brief Algorithm for assigning tasks from a material flow to fitting AMRs. /// This algorithm is participating in the procedure which is beeing coordinated by an initiator. -/// There always must be a corresponding derived class from DispositionInitiator. -class DispositionParticipant : public AlgorithmInterface { +/// There always must be a corresponding derived class from AssignmentInitiator. +class AssignmentParticipant : public AlgorithmInterface { public: - explicit DispositionParticipant(daisi::cpps::common::CppsCommunicatorPtr communicator) + explicit AssignmentParticipant(daisi::cpps::common::CppsCommunicatorPtr communicator) : AlgorithmInterface(communicator){}; - ~DispositionParticipant() override = default; + ~AssignmentParticipant() override = default; }; } // namespace daisi::cpps::logical diff --git a/daisi/src/cpps/logical/amr/CMakeLists.txt b/daisi/src/cpps/logical/amr/CMakeLists.txt index 9586e72a..884be7de 100644 --- a/daisi/src/cpps/logical/amr/CMakeLists.txt +++ b/daisi/src/cpps/logical/amr/CMakeLists.txt @@ -8,8 +8,8 @@ target_sources(daisi_cpps_logical_amr_amr_logical_agent PRIVATE target_link_libraries(daisi_cpps_logical_amr_amr_logical_agent PUBLIC daisi_cpps_logical_logical_agent - daisi_cpps_logical_algorithms_disposition_iterated_auction_disposition_participant - daisi_cpps_logical_algorithms_disposition_centralized_participant + daisi_cpps_logical_algorithms_assignment_iterated_auction_assignment_participant + daisi_cpps_logical_algorithms_assignment_centralized_participant daisi_cpps_amr_message_serializer ns3::libcore daisi_cpps_amr_physical_material_flow_functionality_mapping diff --git a/daisi/src/cpps/logical/amr/amr_logical_agent.cpp b/daisi/src/cpps/logical/amr/amr_logical_agent.cpp index 97bea69d..5204e1c1 100644 --- a/daisi/src/cpps/logical/amr/amr_logical_agent.cpp +++ b/daisi/src/cpps/logical/amr/amr_logical_agent.cpp @@ -17,8 +17,8 @@ #include "amr_logical_agent.h" #include "cpps/amr/physical/material_flow_functionality_mapping.h" -#include "cpps/logical/algorithms/disposition/centralized_participant.h" -#include "cpps/logical/algorithms/disposition/iterated_auction_disposition_participant.h" +#include "cpps/logical/algorithms/assignment/centralized_participant.h" +#include "cpps/logical/algorithms/assignment/iterated_auction_assignment_participant.h" #include "cpps/logical/message/material_flow_update.h" #include "cpps/logical/order_management/simple_order_management.h" #include "cpps/logical/order_management/stn_order_management.h" @@ -53,12 +53,12 @@ void AmrLogicalAgent::initAlgorithms() { for (const auto &algo_type : algorithm_config_.algorithm_types) { switch (algo_type) { - case AlgorithmType::kIteratedAuctionDispositionParticipant: { + case AlgorithmType::kIteratedAuctionAssignmentParticipant: { auto stn_order_management = std::make_shared( description_, topology_, daisi::util::Pose{execution_state_.getPosition()}); order_management_ = stn_order_management; - algorithms_.push_back(std::make_unique( + algorithms_.push_back(std::make_unique( communicator_, stn_order_management, description_)); order_management_->addNotifyTaskAssignmentCallback( diff --git a/daisi/src/cpps/logical/material_flow/CMakeLists.txt b/daisi/src/cpps/logical/material_flow/CMakeLists.txt index c20450eb..65604c91 100644 --- a/daisi/src/cpps/logical/material_flow/CMakeLists.txt +++ b/daisi/src/cpps/logical/material_flow/CMakeLists.txt @@ -7,8 +7,8 @@ target_sources(daisi_cpps_logical_material_flow_material_flow_logical_agent target_link_libraries(daisi_cpps_logical_material_flow_material_flow_logical_agent PUBLIC daisi_cpps_logical_logical_agent - daisi_cpps_logical_algorithms_disposition_iterated_auction_disposition_initiator - daisi_cpps_logical_algorithms_disposition_round_robin_initiator + daisi_cpps_logical_algorithms_assignment_iterated_auction_assignment_initiator + daisi_cpps_logical_algorithms_assignment_round_robin_initiator daisi_material_flow_model_material_flow NetworkUDPMessage PRIVATE diff --git a/daisi/src/cpps/logical/material_flow/material_flow_logical_agent.cpp b/daisi/src/cpps/logical/material_flow/material_flow_logical_agent.cpp index 30daf45a..4becf3a6 100644 --- a/daisi/src/cpps/logical/material_flow/material_flow_logical_agent.cpp +++ b/daisi/src/cpps/logical/material_flow/material_flow_logical_agent.cpp @@ -17,8 +17,8 @@ #include "material_flow_logical_agent.h" #include "cpps/logical/algorithms/algorithm_interface.h" -#include "cpps/logical/algorithms/disposition/iterated_auction_disposition_initiator.h" -#include "cpps/logical/algorithms/disposition/round_robin_initiator.h" +#include "cpps/logical/algorithms/assignment/iterated_auction_assignment_initiator.h" +#include "cpps/logical/algorithms/assignment/round_robin_initiator.h" #include "cpps/logical/message/material_flow_update.h" #include "logging/logger_manager.h" #include "solanet/uuid.h" @@ -62,9 +62,9 @@ void MaterialFlowLogicalAgent::start() { void MaterialFlowLogicalAgent::initAlgorithms() { for (const auto &algo_type : algorithm_config_.algorithm_types) { switch (algo_type) { - case AlgorithmType::kIteratedAuctionDispositionInitiator: + case AlgorithmType::kIteratedAuctionAssignmentInitiator: algorithms_.push_back( - std::make_unique(communicator_, logger_)); + std::make_unique(communicator_, logger_)); break; case AlgorithmType::kRoundRobinInitiator: algorithms_.push_back(std::make_unique(communicator_, logger_)); @@ -114,10 +114,10 @@ void MaterialFlowLogicalAgent::addMaterialFlow(std::string mfdl_program) { // TODO there could be multiple algorithm interfaces in the future // TODO Currently only algorithm and logger assert(algorithms_.size() == 2); - assert(dynamic_cast(algorithms_[0].get())); + assert(dynamic_cast(algorithms_[0].get())); assert(dynamic_cast(algorithms_[1].get())); - auto tmp = dynamic_cast(algorithms_[0].get()); + auto tmp = dynamic_cast(algorithms_[0].get()); tmp->addMaterialFlow(scheduler); const std::string ip = communicator_->network.getIP(); diff --git a/daisi/tests/unittests/CMakeLists.txt b/daisi/tests/unittests/CMakeLists.txt index a32efdb0..72bff7b7 100644 --- a/daisi/tests/unittests/CMakeLists.txt +++ b/daisi/tests/unittests/CMakeLists.txt @@ -83,5 +83,5 @@ target_sources(DaisiCppsLogicalAuctionParticipantState target_link_libraries(DaisiCppsLogicalAuctionParticipantState PRIVATE Catch2::Catch2WithMain - daisi_cpps_logical_algorithms_disposition_auction_participant_state + daisi_cpps_logical_algorithms_assignment_auction_participant_state ) 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 9ed24edd..9c45e76a 100644 --- a/daisi/tests/unittests/cpps/logical/auction_participant_state_test.cpp +++ b/daisi/tests/unittests/cpps/logical/auction_participant_state_test.cpp @@ -14,7 +14,7 @@ // // SPDX-License-Identifier: GPL-2.0-only -#include "cpps/logical/algorithms/disposition/auction_participant_state.h" +#include "cpps/logical/algorithms/assignment/auction_participant_state.h" #include #include From 61d8c5fd9620ea5cf8dd0a4ff4e4d1c89ee3884c Mon Sep 17 00:00:00 2001 From: jgoedeke Date: Wed, 20 Sep 2023 11:59:11 +0200 Subject: [PATCH 2/2] fix(daisi): Missing disposition replacement --- .../algorithms/assignment/CMakeLists.txt | 90 +++++++++---------- .../disposition/disposition_initiator.h | 54 ----------- .../disposition/disposition_participant.h | 41 --------- 3 files changed, 45 insertions(+), 140 deletions(-) delete mode 100644 daisi/src/cpps/logical/algorithms/disposition/disposition_initiator.h delete mode 100644 daisi/src/cpps/logical/algorithms/disposition/disposition_participant.h diff --git a/daisi/src/cpps/logical/algorithms/assignment/CMakeLists.txt b/daisi/src/cpps/logical/algorithms/assignment/CMakeLists.txt index 28ed14cf..13359f41 100644 --- a/daisi/src/cpps/logical/algorithms/assignment/CMakeLists.txt +++ b/daisi/src/cpps/logical/algorithms/assignment/CMakeLists.txt @@ -1,9 +1,9 @@ -add_library(daisi_cpps_logical_algorithms_disposition_disposition_initiator INTERFACE) -target_sources(daisi_cpps_logical_algorithms_disposition_disposition_initiator +add_library(daisi_cpps_logical_algorithms_assignment_assignment_initiator INTERFACE) +target_sources(daisi_cpps_logical_algorithms_assignment_assignment_initiator INTERFACE - disposition_initiator.h + assignment_initiator.h ) -target_link_libraries(daisi_cpps_logical_algorithms_disposition_disposition_initiator +target_link_libraries(daisi_cpps_logical_algorithms_assignment_assignment_initiator INTERFACE daisi_cpps_logical_algorithms_algorithm_interface daisi_material_flow_model_material_flow @@ -11,119 +11,119 @@ target_link_libraries(daisi_cpps_logical_algorithms_disposition_disposition_init daisi_cpps_common_cpps_communicator ) -add_library(daisi_cpps_logical_algorithms_disposition_disposition_participant INTERFACE) -target_sources(daisi_cpps_logical_algorithms_disposition_disposition_participant +add_library(daisi_cpps_logical_algorithms_assignment_assignment_participant INTERFACE) +target_sources(daisi_cpps_logical_algorithms_assignment_assignment_participant INTERFACE - disposition_participant.h + assignment_participant.h ) -target_link_libraries(daisi_cpps_logical_algorithms_disposition_disposition_participant +target_link_libraries(daisi_cpps_logical_algorithms_assignment_assignment_participant INTERFACE daisi_cpps_logical_algorithms_algorithm_interface daisi_cpps_common_cpps_communicator ) -add_library(daisi_cpps_logical_algorithms_disposition_iterated_auction_disposition_initiator STATIC) -target_sources(daisi_cpps_logical_algorithms_disposition_iterated_auction_disposition_initiator +add_library(daisi_cpps_logical_algorithms_assignment_iterated_auction_assignment_initiator STATIC) +target_sources(daisi_cpps_logical_algorithms_assignment_iterated_auction_assignment_initiator PRIVATE - iterated_auction_disposition_initiator.h - iterated_auction_disposition_initiator.cpp + iterated_auction_assignment_initiator.h + iterated_auction_assignment_initiator.cpp ) -target_link_libraries(daisi_cpps_logical_algorithms_disposition_iterated_auction_disposition_initiator +target_link_libraries(daisi_cpps_logical_algorithms_assignment_iterated_auction_assignment_initiator PUBLIC - daisi_cpps_logical_algorithms_disposition_disposition_initiator - daisi_cpps_logical_algorithms_disposition_layered_precedence_graph - daisi_cpps_logical_algorithms_disposition_auction_initiator_state + daisi_cpps_logical_algorithms_assignment_assignment_initiator + daisi_cpps_logical_algorithms_assignment_layered_precedence_graph + daisi_cpps_logical_algorithms_assignment_auction_initiator_state daisi_structure_helpers ns3::libcore daisi_cpps_amr_model_amr_fleet daisi_cpps_common_cpps_communicator ) -add_library(daisi_cpps_logical_algorithms_disposition_iterated_auction_disposition_participant STATIC) -target_sources(daisi_cpps_logical_algorithms_disposition_iterated_auction_disposition_participant +add_library(daisi_cpps_logical_algorithms_assignment_iterated_auction_assignment_participant STATIC) +target_sources(daisi_cpps_logical_algorithms_assignment_iterated_auction_assignment_participant PRIVATE - iterated_auction_disposition_participant.h - iterated_auction_disposition_participant.cpp + iterated_auction_assignment_participant.h + iterated_auction_assignment_participant.cpp ) -target_link_libraries(daisi_cpps_logical_algorithms_disposition_iterated_auction_disposition_participant +target_link_libraries(daisi_cpps_logical_algorithms_assignment_iterated_auction_assignment_participant PUBLIC - daisi_cpps_logical_algorithms_disposition_disposition_participant + daisi_cpps_logical_algorithms_assignment_assignment_participant daisi_cpps_logical_order_management_auction_based_order_management - daisi_cpps_logical_algorithms_disposition_auction_participant_state + daisi_cpps_logical_algorithms_assignment_auction_participant_state daisi_cpps_common_cpps_communicator ) -add_library(daisi_cpps_logical_algorithms_disposition_layered_precedence_graph STATIC) -target_sources(daisi_cpps_logical_algorithms_disposition_layered_precedence_graph +add_library(daisi_cpps_logical_algorithms_assignment_layered_precedence_graph STATIC) +target_sources(daisi_cpps_logical_algorithms_assignment_layered_precedence_graph PRIVATE layered_precedence_graph.h layered_precedence_graph.cpp layered_precedence_graph_components.h ) -target_link_libraries(daisi_cpps_logical_algorithms_disposition_layered_precedence_graph +target_link_libraries(daisi_cpps_logical_algorithms_assignment_layered_precedence_graph PUBLIC daisi_datastructure_directed_graph daisi_material_flow_model_material_flow daisi_cpps_common_cpps_logger_ns3 ) -add_library(daisi_cpps_logical_algorithms_disposition_auction_initiator_state STATIC) -target_sources(daisi_cpps_logical_algorithms_disposition_auction_initiator_state +add_library(daisi_cpps_logical_algorithms_assignment_auction_initiator_state STATIC) +target_sources(daisi_cpps_logical_algorithms_assignment_auction_initiator_state PRIVATE auction_initiator_state.h auction_initiator_state.cpp ) -target_link_libraries(daisi_cpps_logical_algorithms_disposition_auction_initiator_state +target_link_libraries(daisi_cpps_logical_algorithms_assignment_auction_initiator_state PUBLIC daisi_material_flow_model_material_flow - daisi_cpps_logical_algorithms_disposition_layered_precedence_graph + daisi_cpps_logical_algorithms_assignment_layered_precedence_graph ) -add_library(daisi_cpps_logical_algorithms_disposition_auction_participant_state STATIC) -target_sources(daisi_cpps_logical_algorithms_disposition_auction_participant_state +add_library(daisi_cpps_logical_algorithms_assignment_auction_participant_state STATIC) +target_sources(daisi_cpps_logical_algorithms_assignment_auction_participant_state PRIVATE auction_participant_state.h auction_participant_state.cpp ) -target_link_libraries(daisi_cpps_logical_algorithms_disposition_auction_participant_state +target_link_libraries(daisi_cpps_logical_algorithms_assignment_auction_participant_state PUBLIC daisi_material_flow_model_material_flow daisi_cpps_logical_order_management_auction_based_order_management ) -add_library(daisi_cpps_logical_algorithms_disposition_centralized_initiator STATIC) -target_sources(daisi_cpps_logical_algorithms_disposition_centralized_initiator +add_library(daisi_cpps_logical_algorithms_assignment_centralized_initiator STATIC) +target_sources(daisi_cpps_logical_algorithms_assignment_centralized_initiator PUBLIC centralized_initiator.h centralized_initiator.cpp ) -target_link_libraries(daisi_cpps_logical_algorithms_disposition_centralized_initiator +target_link_libraries(daisi_cpps_logical_algorithms_assignment_centralized_initiator PUBLIC - daisi_cpps_logical_algorithms_disposition_disposition_initiator + daisi_cpps_logical_algorithms_assignment_assignment_initiator daisi_cpps_common_cpps_communicator ) -add_library(daisi_cpps_logical_algorithms_disposition_centralized_participant STATIC) -target_sources(daisi_cpps_logical_algorithms_disposition_centralized_participant +add_library(daisi_cpps_logical_algorithms_assignment_centralized_participant STATIC) +target_sources(daisi_cpps_logical_algorithms_assignment_centralized_participant PUBLIC centralized_participant.h centralized_participant.cpp ) -target_link_libraries(daisi_cpps_logical_algorithms_disposition_centralized_participant +target_link_libraries(daisi_cpps_logical_algorithms_assignment_centralized_participant PUBLIC - daisi_cpps_logical_algorithms_disposition_disposition_participant + daisi_cpps_logical_algorithms_assignment_assignment_participant daisi_cpps_common_cpps_communicator ) -add_library(daisi_cpps_logical_algorithms_disposition_round_robin_initiator STATIC) -target_sources(daisi_cpps_logical_algorithms_disposition_round_robin_initiator +add_library(daisi_cpps_logical_algorithms_assignment_round_robin_initiator STATIC) +target_sources(daisi_cpps_logical_algorithms_assignment_round_robin_initiator PUBLIC round_robin_initiator.h round_robin_initiator.cpp ) -target_link_libraries(daisi_cpps_logical_algorithms_disposition_round_robin_initiator +target_link_libraries(daisi_cpps_logical_algorithms_assignment_round_robin_initiator PUBLIC - daisi_cpps_logical_algorithms_disposition_centralized_initiator + daisi_cpps_logical_algorithms_assignment_centralized_initiator daisi_cpps_amr_model_amr_fleet ns3::libcore daisi_random_engine diff --git a/daisi/src/cpps/logical/algorithms/disposition/disposition_initiator.h b/daisi/src/cpps/logical/algorithms/disposition/disposition_initiator.h deleted file mode 100644 index da04f411..00000000 --- a/daisi/src/cpps/logical/algorithms/disposition/disposition_initiator.h +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2023 The SOLA authors -// -// This file is part of DAISI. -// -// DAISI is free software: you can redistribute it and/or modify it under the terms of the GNU -// General Public License as published by the Free Software Foundation; version 2. -// -// DAISI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even -// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -// Public License for more details. -// -// You should have received a copy of the GNU General Public License along with DAISI. If not, see -// . -// -// SPDX-License-Identifier: GPL-2.0-only - -#ifndef DAISI_CPPS_LOGICAL_ALGORITHMS_ASSIGNMENT_ASSIGNMENT_INITIATOR_H_ -#define DAISI_CPPS_LOGICAL_ALGORITHMS_ASSIGNMENT_ASSIGNMENT_INITIATOR_H_ - -#include -#include - -#include "../algorithm_interface.h" -#include "cpps/common/cpps_communicator.h" -#include "cpps/common/cpps_logger_ns3.h" -#include "material_flow/model/material_flow.h" - -namespace daisi::cpps::logical { - -/// @brief Algorithm for assigning tasks from a material flow to fitting AMRs. -/// This algorithm is initiating and coordinating the procedure. -/// There always must be a corresponding derived class from AssignmentParticipant. -class AssignmentInitiator : public AlgorithmInterface { -public: - AssignmentInitiator(daisi::cpps::common::CppsCommunicatorPtr communicator, - std::shared_ptr logger) - : AlgorithmInterface(communicator), logger_(std::move(logger)){}; - - ~AssignmentInitiator() override = default; - - /// @brief Adding a material flow whose tasks should be allocated. - /// @param scheduler MFDL Scheduler - virtual void addMaterialFlow(std::shared_ptr scheduler) = 0; - - virtual void logMaterialFlowContent(const std::string &material_flow_uuid) = 0; - -protected: - /// @brief For logging material flow tasks and orders - std::shared_ptr logger_; -}; - -} // namespace daisi::cpps::logical - -#endif diff --git a/daisi/src/cpps/logical/algorithms/disposition/disposition_participant.h b/daisi/src/cpps/logical/algorithms/disposition/disposition_participant.h deleted file mode 100644 index 674cb674..00000000 --- a/daisi/src/cpps/logical/algorithms/disposition/disposition_participant.h +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2023 The SOLA authors -// -// This file is part of DAISI. -// -// DAISI is free software: you can redistribute it and/or modify it under the terms of the GNU -// General Public License as published by the Free Software Foundation; version 2. -// -// DAISI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even -// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -// Public License for more details. -// -// You should have received a copy of the GNU General Public License along with DAISI. If not, see -// . -// -// SPDX-License-Identifier: GPL-2.0-only - -#ifndef DAISI_CPPS_LOGICAL_ALGORITHMS_ASSIGNMENT_ASSIGNMENT_PARTICIPANT_H_ -#define DAISI_CPPS_LOGICAL_ALGORITHMS_ASSIGNMENT_ASSIGNMENT_PARTICIPANT_H_ - -#include -#include - -#include "cpps/common/cpps_communicator.h" -#include "cpps/logical/algorithms/algorithm_interface.h" - -namespace daisi::cpps::logical { - -/// @brief Algorithm for assigning tasks from a material flow to fitting AMRs. -/// This algorithm is participating in the procedure which is beeing coordinated by an initiator. -/// There always must be a corresponding derived class from AssignmentInitiator. -class AssignmentParticipant : public AlgorithmInterface { -public: - explicit AssignmentParticipant(daisi::cpps::common::CppsCommunicatorPtr communicator) - : AlgorithmInterface(communicator){}; - - ~AssignmentParticipant() override = default; -}; - -} // namespace daisi::cpps::logical - -#endif