92 std::string
str()
const {
return _s.str();}
94 std::ostringstream
_s;
105template<
class RETURNTYPE,
class SUBSET>
111 virtual void on_solution(
const RETURNTYPE value,
const SUBSET &sub,
const std::string &msg) {}
114template<
class RETURNTYPE,
typename DIMTYPE,
class SUBSET,
class CRITERION>
117template<
class RETURNTYPE,
typename DIMTYPE,
class SUBSET,
class CRITERION>
118std::ostream&
operator<<(std::ostream& os,
const Search<RETURNTYPE,DIMTYPE,SUBSET,CRITERION>& sr);
121template<
class RETURNTYPE,
typename DIMTYPE,
class SUBSET,
class CRITERION>
124 friend std::ostream& operator<< <>(std::ostream& os,
const Search<RETURNTYPE,DIMTYPE,SUBSET,CRITERION>& sr);
151 virtual bool search(
const DIMTYPE target_d, RETURNTYPE &result,
const PSubset sub,
const PCriterion crit, std::ostream& os) =0;
166 virtual std::ostream&
print(std::ostream& os)
const {
return os;}
185template<
class RETURNTYPE,
typename DIMTYPE,
class SUBSET,
class CRITERION>
186std::ostream&
operator<<(std::ostream& os,
const Search<RETURNTYPE,DIMTYPE,SUBSET,CRITERION>& sr) {
Observer interface for search progress reporting.
Definition search.hpp:106
virtual void on_progress(const std::string &msg)
one pre-formatted progress message
Definition search.hpp:110
virtual void on_solution(const RETURNTYPE value, const SUBSET &sub, const std::string &msg)
a new (sub-)solution has been reached (msg = its pre-formatted text form); copy sub if kept beyond th...
Definition search.hpp:111
std::shared_ptr< SUBSET > PSubset
shared pointer to a feature subset (not used by the interface itself; kept for observer implementatio...
Definition search.hpp:108
abstract class, defines interface for search method implementations
Definition search.hpp:122
virtual std::ostream & print(std::ostream &os) const
writes a human-readable identification of the search and its configuration; base default writes nothi...
Definition search.hpp:166
virtual bool search(const DIMTYPE target_d, RETURNTYPE &result, const PSubset sub, const PCriterion crit, std::ostream &os)=0
Runs the search; the central entry point of every search method.
bool output_normal() const
true unless output detail is SILENT
Definition search.hpp:159
std::shared_ptr< OBSERVER > PObserver
shared pointer to an OBSERVER, as set via set_observer()
Definition search.hpp:163
PObserver _observer
the attached progress observer, or null (see set_observer(), report(), report_solution())
Definition search.hpp:181
void report(std::ostream &os, const msgbuf &m) const
delivers one pre-formatted progress message: to the observer if attached, otherwise as syncout text t...
Definition search.hpp:170
bool result_tracker_active() const
true if a result tracker was assigned via enable_result_tracking() and not since disabled
Definition search.hpp:155
void set_output_detail(OutputDetail detail)
sets the amount of information that is logged to output stream throughout the course of search
Definition search.hpp:157
std::shared_ptr< SUBSET > PSubset
shared pointer to a feature subset
Definition search.hpp:127
void set_observer(PObserver observer)
redirects search progress reporting away from the default syncout text output to observer
Definition search.hpp:164
void disable_result_tracking()
detaches any result tracker (result_tracker_active() then returns false)
Definition search.hpp:154
OutputDetail get_output_detail() const
the currently configured output detail level
Definition search.hpp:158
std::shared_ptr< Result_Tracker< RETURNTYPE, SUBSET > > PResultTracker
shared pointer to the result tracker enabled via enable_result_tracking()
Definition search.hpp:128
PResultTracker _tracker
the assigned result tracker, or null (see enable_result_tracking()/result_tracker_active())
Definition search.hpp:179
OutputDetail _detail
the output detail level set via set_output_detail(); read by output_normal()/output_detailed()
Definition search.hpp:180
void enable_result_tracking(PResultTracker tracker)
assigns a result tracker to the search process, i.e., enables logging of all evaluated subsets for fu...
Definition search.hpp:153
Search_Observer< RETURNTYPE, SUBSET > OBSERVER
the observer interface type this search reports through (see Search_Observer)
Definition search.hpp:162
void report_solution(std::ostream &os, const RETURNTYPE value, const SUBSET &sub, const msgbuf &m) const
like report(), for sites announcing a new (sub-)solution; fires on_solution instead
Definition search.hpp:175
std::shared_ptr< CRITERION > PCriterion
shared pointer to the criterion the search optimizes
Definition search.hpp:126
bool output_detailed() const
true only at the DETAILED output level
Definition search.hpp:160
Message accumulator for Search::report() - collects one progress message exactly as an std::ostringst...
Definition search.hpp:87
msgbuf & operator<<(std::ostream &(*manip)(std::ostream &))
applies a stream manipulator (std::endl, std::flush) to the accumulator
Definition search.hpp:90
std::ostringstream _s
the underlying accumulator every operator<< overload writes into
Definition search.hpp:94
msgbuf & operator<<(const T &t)
appends t via std::ostringstream's own operator<<, like building any ostream message
Definition search.hpp:89
std::ostream & stream()
for legacy print(std::ostream&)-style helpers appending into the message
Definition search.hpp:91
std::string str() const
the accumulated message text, as passed to Search_Observer::on_progress()/on_solution()
Definition search.hpp:92
static void print(std::ostream &os, std::ostringstream &sos)
Writes sos's buffered content to os, serializing concurrent writers under FST_THREADED via a shared m...
Definition global.hpp:86
FST4 specific error passing class.
The Feature Selection Toolbox 4 library: every library component – data access, criteria and classifi...
Definition data_accessor.hpp:80
OutputDetail
search algorithms' output extent
Definition global.hpp:67
@ NORMAL
informs about new found solutions and time elapsed etc.
Definition global.hpp:69
@ DETAILED
includes much detail including variable contents etc. (may render output unreadably cluttered)
Definition global.hpp:70
std::ostream & operator<<(std::ostream &os, const Data_Intervaller< CONTAINER, IDXTYPE > &ia)
Streams every contained interval as "si:<startidx>, c:<count>" lines to os.
Definition data_intervaller.hpp:152
Defines interface for classes that enable collecting multiple results.