Skip to content

Commit

Permalink
Extra clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
NicEastvillage committed Jan 21, 2025
1 parent d4b508e commit a72d3df
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 15 deletions.
11 changes: 5 additions & 6 deletions include/PetriEngine/Reachability/ReachabilitySearch.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ namespace PetriEngine {
size_t _satisfyingMarking = 0;
Structures::State _initial;
AbstractHandler& _callback;
TokenEliminator* token_elim = nullptr; // FIXME: Leaked
size_t _max_tokens = 0;
};

Expand Down Expand Up @@ -184,12 +183,12 @@ namespace PetriEngine {
queue.push(r.second, &dc, queries[ss.heurquery].get());
}

token_elim = new TokenEliminator();
TokenEliminator token_elim;
if (usequeries && tokenElim != TokenEliminationMethod::Disabled) {
token_elim->setDynamic(tokenElim == TokenEliminationMethod::Dynamic);
token_elim->init(&_net);
token_elim.setDynamic(tokenElim == TokenEliminationMethod::Dynamic);
token_elim.init(&_net);
} else {
token_elim->setEnabled(false);
token_elim.setEnabled(false);
}

// Search!
Expand All @@ -199,7 +198,7 @@ namespace PetriEngine {

while(generator.next(working)){
ss.enabledTransitionsCount[generator.fired()]++;
token_elim->eliminate(&working, queries[ss.heurquery].get());
token_elim.eliminate(&working, queries[ss.heurquery].get());
auto res = states.add(working);
// If we have not seen this state before
if (res.first) {
Expand Down
2 changes: 1 addition & 1 deletion src/PetriEngine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ add_library(PetriEngine ${HEADER_FILES}
STSolver.cpp
SuccessorGenerator.cpp
TraceReplay.cpp
TokenEliminator.cpp
TokenEliminator.cpp
options.cpp)

target_link_libraries(PetriEngine PRIVATE Colored ColoredReduction Structures Simplification Stubborn Reachability PQL TAR Synthesis)
8 changes: 0 additions & 8 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,6 @@ int main(int argc, const char** argv) {
std::cout << "Finished parsing model" << std::endl;
}

auto workStart = std::chrono::high_resolution_clock::now();
// When this ptr goes out of scope it will print the time spent
std::shared_ptr<void> defer (nullptr, [&workStart](...){
auto workEnd = std::chrono::high_resolution_clock::now();
auto diff = std::chrono::duration_cast<std::chrono::microseconds>(workEnd - workStart).count() / 1000000.0;
std::cout << std::setprecision(6) << "Spent " << diff << " in total" << std::endl;
});

//----------------------- Parse Query -----------------------//
std::vector<std::string> querynames;
auto ctlStarQueries = readQueries(string_set, options, querynames);
Expand Down

0 comments on commit a72d3df

Please sign in to comment.