PBeFS
Parallel Best-First Search
Loading...
Searching...
No Matches
Solution.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------*/
2/*---------------------------- File Solution.h -----------------------------*/
3/*--------------------------------------------------------------------------*/
15/*--------------------------------------------------------------------------*/
16/*------------------------------ DEFINITIONS -------------------------------*/
17/*--------------------------------------------------------------------------*/
18
19#ifndef __PBeFS_Solution
20 #define __PBeFS_Solution
21 /* self-identification: #endif at the end of the file */
22
23/*--------------------------------------------------------------------------*/
24/*-------------------------------- INCLUDES --------------------------------*/
25/*--------------------------------------------------------------------------*/
26
27#include <cstddef>
28
29#include <cstdint>
30
31#include <vector>
32
33/*--------------------------------------------------------------------------*/
34/*------------------------------- NAMESPACE --------------------------------*/
35/*--------------------------------------------------------------------------*/
36
38namespace PBeFS_di_unipi_it
39{
40
41/*--------------------------------------------------------------------------*/
42/*--------------------------------- TYPES ----------------------------------*/
43/*--------------------------------------------------------------------------*/
44
51
52/*--------------------------------------------------------------------------*/
53/*--------------------------- CLASS SearchStats ----------------------------*/
54/*--------------------------------------------------------------------------*/
56
63
65
66 std::uint64_t expanded = 0;
67 std::uint64_t reexpanded = 0;
68 std::uint64_t generated = 0;
69 std::uint64_t duplicates = 0;
71 std::uint64_t sent = 0;
72 std::uint64_t messages = 0;
73 std::uint64_t stored = 0;
74 double seconds = 0;
75 std::vector< std::uint64_t > expanded_by;
76 std::vector< std::uint64_t > stored_by;
77
78/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
81
82 [[nodiscard]] double load_balance( void ) const;
83
84/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
87
88 [[nodiscard]] double communication_overhead( void ) const;
89
90 }; // end( struct( SearchStats ) )
91
92/*--------------------------------------------------------------------------*/
93/*----------------------------- CLASS Solution -----------------------------*/
94/*--------------------------------------------------------------------------*/
96
98
99template< class State , class Cost >
100struct Solution {
101
103 Cost cost{};
104 std::vector< State > path;
106
108 [[nodiscard]] bool solved( void ) const noexcept {
109 return( status == Status::solved );
110 }
111
112 }; // end( struct( Solution ) )
113
114/*--------------------------------------------------------------------------*/
115/*-------------------------- CLASS SearchOptions ---------------------------*/
116/*--------------------------------------------------------------------------*/
118
120
123 std::size_t node_limit = 0;
124
128 std::size_t expected_nodes = 0;
129
130 }; // end( struct( SearchOptions ) )
131
132/*--------------------------------------------------------------------------*/
133
134} // end( namespace PBeFS_di_unipi_it )
135
136/*--------------------------------------------------------------------------*/
137
138#endif /* __PBeFS_Solution */
139
140/*--------------------------------------------------------------------------*/
141/*-------------------------- End File Solution.h ---------------------------*/
142/*--------------------------------------------------------------------------*/
namespace for the Parallel Best-First Search library
Definition AStar.h:83
Status
how a search ended
Definition Solution.h:46
@ unsolvable
OPEN emptied without reaching a goal.
Definition Solution.h:48
@ solved
an optimal path has been found
Definition Solution.h:47
@ node_limit
the limit on the stored nodes was reached first
Definition Solution.h:49
the options shared by all the searches
Definition Solution.h:119
std::size_t node_limit
stop with Status::node_limit after storing this many nodes (0 = no limit); in a parallel search the l...
Definition Solution.h:123
std::size_t expected_nodes
the number of nodes the search is expected to store (0 = unknown): the closed list is sized for them ...
Definition Solution.h:128
the counters of a search
Definition Solution.h:64
double load_balance(void) const
the load balance , the largest over the mean of the expansions per worker (1 is a perfect balance)
std::uint64_t messages
batches of nodes sent
Definition Solution.h:72
std::vector< std::uint64_t > expanded_by
expansions of each worker
Definition Solution.h:75
double communication_overhead(void) const
the communication overhead , the nodes sent to another worker over the nodes generated
std::uint64_t sent
nodes sent to another worker
Definition Solution.h:71
std::uint64_t generated
successors generated
Definition Solution.h:68
std::uint64_t reexpanded
expansions of a node already expanded
Definition Solution.h:67
std::uint64_t stored
distinct nodes stored at the end
Definition Solution.h:73
double seconds
wall-clock time of the search
Definition Solution.h:74
std::uint64_t duplicates
generated states already known with a not larger
Definition Solution.h:69
std::vector< std::uint64_t > stored_by
nodes stored by each worker
Definition Solution.h:76
std::uint64_t expanded
expansions, re-expansions included
Definition Solution.h:66
a path from the initial state to a goal, and its cost
Definition Solution.h:100
std::vector< State > path
the states along the path
Definition Solution.h:104
bool solved(void) const noexcept
true if a path has been found
Definition Solution.h:108
Cost cost
the cost of the path
Definition Solution.h:103
SearchStats stats
the counters of the search
Definition Solution.h:105
Status status
how the search ended
Definition Solution.h:102