Skip to content

Conversation

@samo538
Copy link

@samo538 samo538 commented Feb 24, 2025

Project practice 2 simulation enhancement

@samo538 samo538 changed the title Added backwards simulation Adding simulation reduction rules Feb 24, 2025
@samo538 samo538 force-pushed the sim_rt branch 2 times, most recently from e94a0da to b4c7441 Compare April 23, 2025 05:38
Copy link
Collaborator

@Adda0 Adda0 left a comment

Choose a reason for hiding this comment

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

Thank you for the PR. Looks good to me overall.

nfa/delta.cc
nfa/operations.cc
nfa/builder.cc
nfa/reductionSimulation.cc
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
nfa/reductionSimulation.cc
nfa/reduction-simulation.cc

Comment on lines +172 to +180
/**
* @brief TODO
*/
Nfa reduce_size_by_simulation(const Nfa& aut, StateRenaming &state_renaming, const std::string& simulation_direction);

/**
* @brief TODO
*/
Simlib::Util::BinaryRelation compute_direct_simulation(const Nfa& aut);
Copy link
Collaborator

@Adda0 Adda0 Jul 2, 2025

Choose a reason for hiding this comment

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

Add documentation. If necessary, ask @ondrik.

using namespace mata::nfa;

namespace {
// Merging based on the first and second rule (From the paper 'On NFA Reduction')
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add link to the paper.


namespace {
// Merging based on the first and second rule (From the paper 'On NFA Reduction')
Nfa merge_in_one_direction(const Nfa& aut, StateRenaming& state_renaming,
Copy link
Collaborator

Choose a reason for hiding this comment

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

This function should be better documented. Especially, the little_brother parameter should be explained.

// Build the resulting automaton based on the simulated_states and state_renaming
for (State p = 0; p < num_of_states; ++p) {
// If the state is simulated, its not added to the resulting automaton
if (std::find(simulated_states.begin(), simulated_states.end(), p) != simulated_states.end()) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there a method simulated_states.find() to use instead of the general std::find()?

nfa/delta.cc
nfa/operations.cc
nfa/builder.cc
nfa/reductionSimulation.cc
Copy link
Collaborator

Choose a reason for hiding this comment

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

The indentation seems wrong.

Copy link
Collaborator

Choose a reason for hiding this comment

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

If you used algorithms from some papers, could you add links to those? Or if there is any write-up about the approach chosen here, it would be also beneficial. If there is not, maybe just a general description in the function definition explaining what the algorithm does would go a long way to improving the readability of the introduced changes.

@Adda0 Adda0 requested a review from jurajsic July 2, 2025 07:07
@Adda0
Copy link
Collaborator

Adda0 commented Jul 2, 2025

@jurajsic Could you also have a look before July 14? We want to merge the PR this month, ideally.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you rename this file to reduce.cc and move here all reduction algorithms? It might nicely clean up the main catch-all files.

@jurajsic
Copy link
Member

jurajsic commented Jul 7, 2025

Are there any benchmarks comparing the currently implemented reduction in devel vs the reduction here?

@Adda0 Adda0 added the Status:stale The PR's progress has stalled. label Nov 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Status:stale The PR's progress has stalled.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants