Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renaming disposition to assignment #120

Merged
merged 2 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cppcheck.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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/*
Expand Down
4 changes: 2 additions & 2 deletions daisi/src/cpps/common/scenariofile/cpps_scenariofile.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ struct AlgorithmScenario {

const std::unordered_map<std::string, logical::AlgorithmType>
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<std::string, logical::AlgorithmType>
assignment_strategy_to_participant_algorithm_type = {
{"iterated_auction", logical::AlgorithmType::kIteratedAuctionDispositionParticipant},
{"iterated_auction", logical::AlgorithmType::kIteratedAuctionAssignmentParticipant},
{"round_robin", logical::AlgorithmType::kRoundRobinParticipant},
};

Expand Down
2 changes: 1 addition & 1 deletion daisi/src/cpps/logical/algorithms/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions daisi/src/cpps/logical/algorithms/algorithm_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
namespace daisi::cpps::logical {

enum class AlgorithmType {
kIteratedAuctionDispositionInitiator,
kIteratedAuctionDispositionParticipant,
kIteratedAuctionAssignmentInitiator,
kIteratedAuctionAssignmentParticipant,
kRoundRobinInitiator,
kRoundRobinParticipant
};
Expand Down
131 changes: 131 additions & 0 deletions daisi/src/cpps/logical/algorithms/assignment/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
add_library(daisi_cpps_logical_algorithms_assignment_assignment_initiator INTERFACE)
target_sources(daisi_cpps_logical_algorithms_assignment_assignment_initiator
INTERFACE
assignment_initiator.h
)
target_link_libraries(daisi_cpps_logical_algorithms_assignment_assignment_initiator
INTERFACE
daisi_cpps_logical_algorithms_algorithm_interface
daisi_material_flow_model_material_flow
daisi_cpps_common_cpps_logger_ns3
daisi_cpps_common_cpps_communicator
)

add_library(daisi_cpps_logical_algorithms_assignment_assignment_participant INTERFACE)
target_sources(daisi_cpps_logical_algorithms_assignment_assignment_participant
INTERFACE
assignment_participant.h
)
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_assignment_iterated_auction_assignment_initiator STATIC)
target_sources(daisi_cpps_logical_algorithms_assignment_iterated_auction_assignment_initiator
PRIVATE
iterated_auction_assignment_initiator.h
iterated_auction_assignment_initiator.cpp
)
target_link_libraries(daisi_cpps_logical_algorithms_assignment_iterated_auction_assignment_initiator
PUBLIC
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_assignment_iterated_auction_assignment_participant STATIC)
target_sources(daisi_cpps_logical_algorithms_assignment_iterated_auction_assignment_participant
PRIVATE
iterated_auction_assignment_participant.h
iterated_auction_assignment_participant.cpp
)
target_link_libraries(daisi_cpps_logical_algorithms_assignment_iterated_auction_assignment_participant
PUBLIC
daisi_cpps_logical_algorithms_assignment_assignment_participant
daisi_cpps_logical_order_management_auction_based_order_management
daisi_cpps_logical_algorithms_assignment_auction_participant_state
daisi_cpps_common_cpps_communicator
)

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_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_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_assignment_auction_initiator_state
PUBLIC
daisi_material_flow_model_material_flow
daisi_cpps_logical_algorithms_assignment_layered_precedence_graph
)

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_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_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_assignment_centralized_initiator
PUBLIC
daisi_cpps_logical_algorithms_assignment_assignment_initiator
daisi_cpps_common_cpps_communicator
)

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_assignment_centralized_participant
PUBLIC
daisi_cpps_logical_algorithms_assignment_assignment_participant
daisi_cpps_common_cpps_communicator
)

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_assignment_round_robin_initiator
PUBLIC
daisi_cpps_logical_algorithms_assignment_centralized_initiator
daisi_cpps_amr_model_amr_fleet
ns3::libcore
daisi_random_engine
daisi_cpps_common_cpps_communicator
)
Original file line number Diff line number Diff line change
Expand Up @@ -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 <memory>
#include <variant>
Expand All @@ -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<CppsLoggerNs3> logger)
AssignmentInitiator(daisi::cpps::common::CppsCommunicatorPtr communicator,
std::shared_ptr<CppsLoggerNs3> 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <memory>
#include <variant>
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <memory>

Expand All @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <memory>
#include <unordered_map>
Expand All @@ -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 {
Expand Down Expand Up @@ -64,7 +64,7 @@ struct AuctionParticipantTaskState {
std::shared_ptr<AuctionBasedOrderManagement::InsertionPoint> 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
namespace daisi::cpps::logical {
CentralizedInitiator::CentralizedInitiator(daisi::cpps::common::CppsCommunicatorPtr communicator,
std::shared_ptr<CppsLoggerNs3> 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<CppsLoggerNs3> logger);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace daisi::cpps::logical {
CentralizedParticipant::CentralizedParticipant(
daisi::cpps::common::CppsCommunicatorPtr communicator,
std::shared_ptr<SimpleOrderManagement> 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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<SimpleOrderManagement> order_management);
Expand Down
Loading