|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Collector that stores accepted solutions in an Aleph list. More...
#include <state_search_common.H>
Public Types | |
| using | Solution_Type = Solution |
| Type of collected solutions. | |
| using | Container_Type = DynList< Solution > |
| Internal container type. | |
Public Member Functions | |
| SearchSolutionCollector ()=default | |
| Build a collector with no limit. | |
| SearchSolutionCollector (const size_t max_solutions) | |
Build a collector that stops after max_solutions. | |
| bool | operator() (const Solution &solution) |
| Append one solution and report whether enumeration should continue. | |
| void | clear () noexcept |
| Remove all collected solutions. | |
| size_t | size () const noexcept |
| Number of collected solutions. | |
| bool | is_empty () const noexcept |
Return true if no solution has been collected. | |
| const Container_Type & | solutions () const noexcept |
| Access the collected solutions. | |
| Container_Type & | solutions () noexcept |
| Mutable access to the collected solutions. | |
Private Attributes | |
| Container_Type | solutions_ |
| size_t | count_ = 0 |
| size_t | limit_ = Search_Unlimited |
Collector that stores accepted solutions in an Aleph list.
This is a small adapter for DFS/backtracking enumeration. It appends each accepted solution to an internal DynList and can optionally stop after a user-specified number of collected solutions.
| Solution | Type of solution to collect. |
Definition at line 383 of file state_search_common.H.
| using Aleph::SearchSolutionCollector< Solution >::Container_Type = DynList<Solution> |
Internal container type.
Definition at line 389 of file state_search_common.H.
| using Aleph::SearchSolutionCollector< Solution >::Solution_Type = Solution |
Type of collected solutions.
Definition at line 387 of file state_search_common.H.
|
default |
Build a collector with no limit.
|
inlineexplicit |
Build a collector that stops after max_solutions.
| max_solutions | Maximum number of solutions to store. |
Definition at line 397 of file state_search_common.H.
References ah_invalid_argument_if, and Aleph::SearchSolutionCollector< Solution >::limit_.
|
inlinenoexcept |
Remove all collected solutions.
Definition at line 412 of file state_search_common.H.
References Aleph::SearchSolutionCollector< Solution >::count_, Aleph::DynList< T >::empty(), and Aleph::SearchSolutionCollector< Solution >::solutions_.
|
inlinenoexcept |
Return true if no solution has been collected.
Definition at line 425 of file state_search_common.H.
References Aleph::SearchSolutionCollector< Solution >::count_.
|
inline |
Append one solution and report whether enumeration should continue.
Definition at line 404 of file state_search_common.H.
References Aleph::DynList< T >::append(), Aleph::SearchSolutionCollector< Solution >::count_, Aleph::SearchSolutionCollector< Solution >::limit_, and Aleph::SearchSolutionCollector< Solution >::solutions_.
|
inlinenoexcept |
Number of collected solutions.
Definition at line 419 of file state_search_common.H.
References Aleph::SearchSolutionCollector< Solution >::count_.
|
inlinenoexcept |
Access the collected solutions.
Definition at line 431 of file state_search_common.H.
References Aleph::SearchSolutionCollector< Solution >::solutions_.
|
inlinenoexcept |
Mutable access to the collected solutions.
Definition at line 437 of file state_search_common.H.
References Aleph::SearchSolutionCollector< Solution >::solutions_.
|
private |
|
private |
Definition at line 445 of file state_search_common.H.
Referenced by Aleph::SearchSolutionCollector< Solution >::SearchSolutionCollector(), and Aleph::SearchSolutionCollector< Solution >::operator()().
|
private |