Skip to content

Feature/listener#51

Merged
heavenfall merged 26 commits intodevelopfrom
feature/listener
Mar 13, 2026
Merged

Feature/listener#51
heavenfall merged 26 commits intodevelopfrom
feature/listener

Conversation

@heavenfall
Copy link
Copy Markdown
Collaborator

  • Created new log featue.
  • Redone listeners, allowing observables on currently unidirectional_search.
  • Framework for observables to make writing to streams easier.
  • Added support for posthoc through observables, included a default grid trace.

@heavenfall heavenfall mentioned this pull request Oct 17, 2025
Copy link
Copy Markdown
Member

@dharabor dharabor Dec 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed, not sure what the purpose of this object is. Suggest we jettison and rely on users creating/managing their own ostream objects.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated the stream_observer to be simple like a wrapper, jettisoned most of the opening stream and removed the shared_stream feature. It is now mainly an interface with a stream pointer and define the concept of if setup to stream used in observer objects.

Added a line_observer object that instead of output to stream, it supports writing line-by-line. The user can choose to open a stream or attach to a log_sink.

Copy link
Copy Markdown
Member

@dharabor dharabor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this Ryan. I think we need a few small refactorings before merging.

print_posthoc_header();

int
search_id() const noexcept
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Posthoc should not know about internals of search. Based on discussion, suggest to replace with an ::open and ::close function.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. The updated posthoc_trace now establishes the print_posthoc_header function, which will trigger with a call to open(). search_id is no longer used, instead it is dependent on the user calling open(stream) to begin listening, and close() to end listening.

{
initialise_node_(n, current->get_id(), gval, pi, par, sol);
if(n->get_f() < sol->sum_of_edge_costs_)
if(n->get_f() <= sol->sum_of_edge_costs_)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we want weakly dominated nodes? Should this be strictly less than?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reverted change

{

void
grid_trace::print_posthoc_header()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This implementation is not in a file which corresponds to its associated header. Let's keep implementations filenames consistent with their corresponding headers.

apps/warthog.cpp Outdated
listener_grid& l = std::get<listener_grid>(algo.get_listeners());
l.stream_open(trace_file);
l.search_id(0);
l.set_grid(expander->get_map());
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does the listener API need to reflect details about the solver implementation? Suggest to refactor for the same reasons as search_id.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interface updated


// io/observer.h
//
// The observer pattern defines methods to tightly-bind user provided observers
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a definition of observers. What are they and why do we need them?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

//
// Logging utility.
//
// The log_sink is a non-owning copyable struct that points to the data and
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please give a general description of the logging facility and its capabilities.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added extra high-level description

@heavenfall heavenfall self-assigned this Mar 5, 2026
Copy link
Copy Markdown
Collaborator Author

@heavenfall heavenfall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Complete

@heavenfall heavenfall merged commit ba9b5f6 into develop Mar 13, 2026
@heavenfall heavenfall deleted the feature/listener branch March 13, 2026 03:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants