WSF
WsfCommRoutingAlgorithmLibrary.hpp
Go to the documentation of this file.
1// ****************************************************************************
2// CUI
3//
4// The Advanced Framework for Simulation, Integration, and Modeling (AFSIM)
5//
6// Copyright 2018 Infoscitex, a DCS Company. All rights reserved.
7//
8// The use, dissemination or disclosure of data in this file is subject to
9// limitation or restriction. See accompanying README and LICENSE for details.
10// ****************************************************************************
11
12#ifndef WSFCOMMROUTINGALGORITHMLIBRARY_HPP
13#define WSFCOMMROUTINGALGORITHMLIBRARY_HPP
14
15#include "wsf_export.h"
16
17#include "WsfCommGraph.hpp"
18
19namespace wsf
20{
21namespace comm
22{
27
30class WSF_EXPORT LeastHops : public graph::GraphImpl::cost_func
31{
32public:
33 LeastHops() = default;
34 ~LeastHops() override = default;
35
36 double operator()(const graph::Edge& aEdge, const graph::Node& aSourceNode, const graph::Node& aDestinationNode) const override
37 {
38 if (!aEdge.IsEnabled())
39 {
40 return std::numeric_limits<double>::max();
41 }
42 return 1.0;
43 }
44
45 double operator()(const graph::Node& aSourceNode, const graph::Node& aDestinationNode) const override { return 0.0; }
46
47 bool consider_node(const graph::Node& aNode) const override { return aNode.IsEnabled(); }
48};
49
53class WSF_EXPORT EdgeWeight : public graph::GraphImpl::cost_func
54{
55public:
56 EdgeWeight() = default;
57 ~EdgeWeight() override = default;
58
59 double operator()(const graph::Edge& aEdge, const graph::Node& aSourceNode, const graph::Node& aDestinationNode) const override
60 {
61 if (!aEdge.IsEnabled())
62 {
63 return std::numeric_limits<double>::max();
64 }
65
66 return aEdge.GetWeight();
67 }
68
69 double operator()(const graph::Node& aSourceNode, const graph::Node& aDestinationNode) const override { return 0.0; }
70
71 bool consider_node(const graph::Node& aNode) const override { return aNode.IsEnabled(); }
72};
73
80class WSF_EXPORT InverseEdgeWeight : public graph::GraphImpl::cost_func
81{
82public:
83 InverseEdgeWeight() = default;
84 ~InverseEdgeWeight() override = default;
85
86 double operator()(const graph::Edge& aEdge, const graph::Node& aSourceNode, const graph::Node& aDestinationNode) const override
87 {
88 if (!aEdge.IsEnabled())
89 {
90 return std::numeric_limits<double>::max();
91 }
92
93 return (aEdge.GetWeight() * -1.0);
94 }
95
96 double operator()(const graph::Node& aSourceNode, const graph::Node& aDestinationNode) const override { return 0.0; }
97
98 bool consider_node(const graph::Node& aNode) const override { return aNode.IsEnabled(); }
99};
100
101} // namespace comm
102} // namespace wsf
103
104#endif
#define WSF_EXPORT
Definition WsfXIO_Export.hpp:35
bool consider_node(const graph::Node &aNode) const override
Definition WsfCommRoutingAlgorithmLibrary.hpp:71
double operator()(const graph::Edge &aEdge, const graph::Node &aSourceNode, const graph::Node &aDestinationNode) const override
Definition WsfCommRoutingAlgorithmLibrary.hpp:59
~EdgeWeight() override=default
double operator()(const graph::Node &aSourceNode, const graph::Node &aDestinationNode) const override
Definition WsfCommRoutingAlgorithmLibrary.hpp:69
double operator()(const graph::Edge &aEdge, const graph::Node &aSourceNode, const graph::Node &aDestinationNode) const override
Definition WsfCommRoutingAlgorithmLibrary.hpp:86
~InverseEdgeWeight() override=default
bool consider_node(const graph::Node &aNode) const override
Definition WsfCommRoutingAlgorithmLibrary.hpp:98
double operator()(const graph::Node &aSourceNode, const graph::Node &aDestinationNode) const override
Definition WsfCommRoutingAlgorithmLibrary.hpp:96
double operator()(const graph::Node &aSourceNode, const graph::Node &aDestinationNode) const override
Definition WsfCommRoutingAlgorithmLibrary.hpp:45
bool consider_node(const graph::Node &aNode) const override
Definition WsfCommRoutingAlgorithmLibrary.hpp:47
double operator()(const graph::Edge &aEdge, const graph::Node &aSourceNode, const graph::Node &aDestinationNode) const override
Definition WsfCommRoutingAlgorithmLibrary.hpp:36
~LeastHops() override=default
Definition WsfCommGraph.hpp:98
bool IsEnabled() const
Definition WsfCommGraph.hpp:114
double GetWeight() const
Definition WsfCommGraph.hpp:109
Definition WsfCommGraph.hpp:50
bool IsEnabled() const
Definition WsfCommGraph.hpp:67
Definition WsfComm.cpp:34
Function definitions for those who need run-time access to the version.
Definition WsfComm.cpp:32
Copyrights Multiple, All Rights Reserved