SOLA
Loading...
Searching...
No Matches
centralized_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_CENTRALIZED_INITIATOR_H_
18#define DAISI_CPPS_LOGICAL_ALGORITHMS_ASSIGNMENT_CENTRALIZED_INITIATOR_H_
19
20#include "assignment_initiator.h"
21#include "cpps/common/cpps_communicator.h"
22
23namespace daisi::cpps::logical {
24
29public:
30 CentralizedInitiator(daisi::cpps::common::CppsCommunicatorPtr communicator,
31 std::shared_ptr<CppsLoggerNs3> logger);
32 ~CentralizedInitiator() override = default;
33
34 // TODO: check if possible to restict implementation by child classes without warnings
35 // REQUIRE_IMPLEMENTATION(AssignmentResponse);
36 // REQUIRE_IMPLEMENTATION(StatusUpdate);
37
41 void addMaterialFlow(std::shared_ptr<material_flow::MFDLScheduler> scheduler) override;
42
43protected:
48 std::string connection_string;
49
52
54 bool isValid() const { return (!connection_string.empty() && ability.isValid()); }
55 };
56
61 virtual void distributeMFTasks(uint32_t index, bool previously_allocated) = 0;
62
65 virtual void storeParticipant(ParticipantInfo &info) = 0;
66
68 std::vector<material_flow::MFDLScheduler> material_flows_;
69
71 std::vector<AssignmentResponse> assignment_acceptions_;
72
74 struct {
78 util::Duration wait_to_receive_status_update = 0.3;
80
81private:
84 void readAmrRequestFuture();
85
87 std::future<minhton::FindResult> amr_find_result_;
88
91 bool preparation_finished_ = false;
92};
93} // namespace daisi::cpps::logical
94
95#endif
Definition amr_static_ability.h:32
Algorithm for assigning tasks from a material flow to fitting AMRs. This algorithm is initiating and ...
Definition assignment_initiator.h:33
Algorithm that centrally assigns tasks of incoming material flows to the corresponding centralized pa...
Definition centralized_initiator.h:28
void addMaterialFlow(std::shared_ptr< material_flow::MFDLScheduler > scheduler) override
Receive a new material flow to assign its tasks to the known participants. Push it into material_flow...
Definition centralized_initiator.cpp:33
virtual void storeParticipant(ParticipantInfo &info)=0
Add a new participant and store it locally.
util::Duration wait_to_receive_status_update
Delay between requesting and receiving a status update.
Definition centralized_initiator.h:78
util::Duration wait_to_receive_assignment_response
Delay between assigning a task and expecting a response.
Definition centralized_initiator.h:76
virtual void distributeMFTasks(uint32_t index, bool previously_allocated)=0
Perform task assignment for all unassigned tasks of a material flow.
struct daisi::cpps::logical::CentralizedInitiator::@0 delays_
Storing all delays in one place. The unit is seconds.
std::vector< AssignmentResponse > assignment_acceptions_
Responses of task assignments that have been accepted.
Definition centralized_initiator.h:71
std::vector< material_flow::MFDLScheduler > material_flows_
All material flows that have been received to assign their tasks.
Definition centralized_initiator.h:68
Modified Round Robin Algorithm that centrally assigns tasks of incoming material flows to the corresp...
Definition algorithm_config.h:22
Helper that stores all relevant information about the task assignment participants....
Definition centralized_initiator.h:46
std::string connection_string
Connection string used to contact the participant.
Definition centralized_initiator.h:48
bool isValid() const
Check wether all entries are initialized correctly.
Definition centralized_initiator.h:54
amr::AmrStaticAbility ability
The participant's ability. Used to check if a task's requirements are met by the AMR.
Definition centralized_initiator.h:51