SOLA
Loading...
Searching...
No Matches
iterated_auction_assignment_initiator.h
1// Copyright 2023 The SOLA authors
2//
3// This file is part of DAISI.
4//
5// DAISI is free software: you can redistribute it and/or modify it under the terms of the GNU
6// General Public License as published by the Free Software Foundation; version 2.
7//
8// DAISI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
9// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
10// Public License for more details.
11//
12// You should have received a copy of the GNU General Public License along with DAISI. If not, see
13// <https://www.gnu.org/licenses/>.
14//
15// SPDX-License-Identifier: GPL-2.0-only
16
17#ifndef DAISI_CPPS_LOGICAL_ALGORITHMS_ASSIGNMENT_ITERATED_AUCTION_ASSIGNMENT_INITIATOR_H_
18#define DAISI_CPPS_LOGICAL_ALGORITHMS_ASSIGNMENT_ITERATED_AUCTION_ASSIGNMENT_INITIATOR_H_
19
20#include <memory>
21#include <variant>
22
23#include "assignment_initiator.h"
24#include "auction_initiator_state.h"
25#include "cpps/common/cpps_communicator.h"
26#include "layered_precedence_graph.h"
27#include "material_flow/model/material_flow.h"
28#include "utils/structure_helpers.h"
29
30namespace daisi::cpps::logical {
31
42public:
43 IteratedAuctionAssignmentInitiator(daisi::cpps::common::CppsCommunicatorPtr communicator,
44 std::shared_ptr<CppsLoggerNs3> logger);
45
46 ~IteratedAuctionAssignmentInitiator() override = default;
47
49 REGISTER_IMPLEMENTATION(BidSubmission)
50
51
52 REGISTER_IMPLEMENTATION(WinnerResponse)
53
54 void addMaterialFlow(std::shared_ptr<material_flow::MFDLScheduler> scheduler) override;
55
56 void logMaterialFlowContent(const std::string &material_flow_uuid) override;
57
58private:
62 daisi::util::Duration prepareInteraction();
63
66 void startIteration();
67
71 void finishIteration();
72
76 void bidProcessing();
77
81 void winnerResponseProcessing();
82
85 void callForProposal();
86
90 void iterationNotification(const std::vector<daisi::material_flow::Task> &tasks);
91
94 void notifyWinners(const std::vector<AuctionInitiatorState::Winner> &winners);
95
96 void setPreparationFinished();
97
98 void logMaterialFlowOrderStatesOfTask(const material_flow::Task &task,
99 const OrderStates &order_state);
100
103 std::unordered_map<amr::AmrStaticAbility, std::vector<daisi::material_flow::Task>,
105 getTaskAbilityMapping(const std::vector<daisi::material_flow::Task> &tasks) const;
106
109 std::shared_ptr<LayeredPrecedenceGraph> layered_precedence_graph_;
110
112 std::unique_ptr<AuctionInitiatorState> auction_initiator_state_;
113
116 std::unordered_map<amr::AmrStaticAbility, std::string, amr::AmrStaticAbilityHasher>
117 ability_topic_mapping_;
118
120 bool preparation_finished_ = false;
121
123 struct {
125 daisi::util::Duration subscribe_topic = 0.1;
126
128 daisi::util::Duration waiting_to_receive_bids = 0.7;
129
131 daisi::util::Duration waiting_to_receive_winner_responses = 0.3;
132
133 } delays_;
134
135 std::shared_ptr<material_flow::MFDLScheduler> material_flow_;
136};
137
138} // namespace daisi::cpps::logical
139
140#endif
Algorithm for assigning tasks from a material flow to fitting AMRs. This algorithm is initiating and ...
Definition assignment_initiator.h:33
Definition bid_submission.h:30
The initiator class for auction-based assignment, based on the TePSSI algorithm from Nunes,...
Definition iterated_auction_assignment_initiator.h:41
daisi::util::Duration subscribe_topic
Delay between the consecutive subscribing to topics in the prepareInteration method.
Definition iterated_auction_assignment_initiator.h:125
daisi::util::Duration waiting_to_receive_bids
Delay between the scheduling and execution of the bidProcessing method.
Definition iterated_auction_assignment_initiator.h:128
void addMaterialFlow(std::shared_ptr< material_flow::MFDLScheduler > scheduler) override
Storing bid submission information in a helper class to determine winners.
Definition iterated_auction_assignment_initiator.cpp:36
daisi::util::Duration waiting_to_receive_winner_responses
Delay between the scheduling and execution of the winnerResponseProcessing method.
Definition iterated_auction_assignment_initiator.h:131
Definition winner_response.h:28
Definition task.h:34
Modified Round Robin Algorithm that centrally assigns tasks of incoming material flows to the corresp...
Definition algorithm_config.h:22
Definition amr_static_ability.h:57