SOLA
Loading...
Searching...
No Matches
algorithm_interface.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_ALGORITHM_INTERFACE_H_
18#define DAISI_CPPS_LOGICAL_ALGORITHMS_ALGORITHM_INTERFACE_H_
19
20#include <memory>
21#include <variant>
22
23#include "cpps/common/cpps_communicator.h"
24#include "cpps/logical/message/auction_based/bid_submission.h"
25#include "cpps/logical/message/auction_based/call_for_proposal.h"
26#include "cpps/logical/message/auction_based/iteration_notification.h"
27#include "cpps/logical/message/auction_based/winner_notification.h"
28#include "cpps/logical/message/auction_based/winner_response.h"
29#include "cpps/logical/message/central_allocation/assignment_notification.h"
30#include "cpps/logical/message/central_allocation/assignment_response.h"
31#include "cpps/logical/message/central_allocation/status_update.h"
32#include "cpps/logical/message/central_allocation/status_update_request.h"
33#include "cpps/logical/message/material_flow_update.h"
34#include "cpps/logical/message/serializer.h"
35
36#define REGISTER_LOGICAL_MESSAGE(MessageType) \
37 virtual bool process(const MessageType &) { return false; }
38
39#define REQUIRE_IMPLEMENTATION(MessageType) virtual bool process(const MessageType &msg) = 0;
40
41#define REGISTER_IMPLEMENTATION(MessageType) virtual bool process(const MessageType &msg) override;
42
43namespace daisi::cpps::logical {
44
46public:
47 explicit AlgorithmInterface(daisi::cpps::common::CppsCommunicatorPtr communicator)
48 : communicator_(std::move(communicator)){};
49
50 virtual ~AlgorithmInterface() = default;
51
52 REGISTER_LOGICAL_MESSAGE(CallForProposal);
53 REGISTER_LOGICAL_MESSAGE(BidSubmission);
54 REGISTER_LOGICAL_MESSAGE(IterationNotification);
55 REGISTER_LOGICAL_MESSAGE(WinnerNotification);
56 REGISTER_LOGICAL_MESSAGE(WinnerResponse);
57 REGISTER_LOGICAL_MESSAGE(AssignmentNotification);
58 REGISTER_LOGICAL_MESSAGE(AssignmentResponse);
59 REGISTER_LOGICAL_MESSAGE(StatusUpdate);
60 REGISTER_LOGICAL_MESSAGE(StatusUpdateRequest);
61 REGISTER_LOGICAL_MESSAGE(MaterialFlowUpdate); // TODO Ref #79
62
63protected:
64 daisi::cpps::common::CppsCommunicatorPtr communicator_;
65};
66
67} // namespace daisi::cpps::logical
68
69#endif
Definition algorithm_interface.h:45
Notification by a central initiator that a task has been assigned to the receiving participant.
Definition assignment_notification.h:31
Response of a central participant as a reaction of a task assignment. Consists of the task_uuid,...
Definition assignment_response.h:32
Definition bid_submission.h:30
Definition call_for_proposal.h:30
Definition iteration_notification.h:29
might need some revision / additions in the future
Definition status_update_request.h:30
might need some revision / additions in the future
Definition status_update.h:33
Definition winner_notification.h:29
Definition winner_response.h:28
Modified Round Robin Algorithm that centrally assigns tasks of incoming material flows to the corresp...
Definition algorithm_config.h:22
Definition material_flow_update.h:30