Refactor/monotonicity module - #976
Open
sjunges wants to merge 10 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Refactors the monotonicity/reachability-order implementation to address memory-management issues from raw new allocations and ExpressionManager usage, while preparing the module for a future API pass (per #199).
Changes:
- Reworks
Ordernode ownership to usestd::unique_ptrstorage and adds a deep-copying copy constructor/assignment, plus regression tests for deep copy + inconsistent merges. - Introduces a lightweight
storm::analysis::Assumptionvalue type and migrates assumption creation/checking away from expression-based objects to reduce allocations and avoid lifetime/cycle issues. - Consolidates
OrderExtenderper-order bookkeeping into a dedicatedContextkeyed byweak_ptr, and updates monotonicity-building logic to be iterative (worklist) rather than recursive.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/test/storm-pars/modelchecker/region/monotonicity/OrderTest.cpp | Adds regression tests for deep-copy behavior and inconsistent merges. |
| src/test/storm-pars/modelchecker/region/monotonicity/AssumptionMakerTest.cpp | Updates tests to the new Assumption value type and asserts deterministic candidate ordering. |
| src/test/storm-pars/modelchecker/region/monotonicity/AssumptionCheckerTest.cpp | Migrates tests away from expression-based assumptions to Assumption. |
| src/storm-pars/modelchecker/region/monotonicity/OrderExtender.h | Switches assumptions to std::optional<Assumption>, introduces per-order Context, and moves to unique_ptr ownership for AssumptionMaker. |
| src/storm-pars/modelchecker/region/monotonicity/OrderExtender.cpp | Implements Context handling, improves invalid-order bailouts, and refactors initial order construction. |
| src/storm-pars/modelchecker/region/monotonicity/OrderBasedMonotonicityBackend.cpp | Fixes bounds initialization to set min/max correctly. |
| src/storm-pars/modelchecker/region/monotonicity/Order.h | Adds deep-copy/assignment support and node allocation helper with owned storage. |
| src/storm-pars/modelchecker/region/monotonicity/Order.cpp | Implements deep copy, unique_ptr node ownership, and more robust invalid-merge handling/assertions. |
| src/storm-pars/modelchecker/region/monotonicity/MonotonicityHelper.h | Updates result/assumption types and switches extender ownership to unique_ptr. |
| src/storm-pars/modelchecker/region/monotonicity/MonotonicityHelper.cpp | Refactors assumption-branch exploration to an iterative worklist using Assumption. |
| src/storm-pars/modelchecker/region/monotonicity/AssumptionMaker.h | Changes assumption API to return ordered candidate vectors of (Assumption, status). |
| src/storm-pars/modelchecker/region/monotonicity/AssumptionMaker.cpp | Implements vector-based assumption candidates and removes ExpressionManager allocation/variable setup. |
| src/storm-pars/modelchecker/region/monotonicity/AssumptionChecker.h | Migrates checker APIs to take Assumption by value/reference. |
| src/storm-pars/modelchecker/region/monotonicity/AssumptionChecker.cpp | Implements sample/SMT checking using Assumption instead of expression objects. |
| src/storm-pars/modelchecker/region/monotonicity/Assumption.h | Adds the new Assumption data structure. |
| src/storm-pars/modelchecker/region/monotonicity/Assumption.cpp | Adds logging/printing for Assumption. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…or<< Both silently treated any non-Greater relation as Equal, per Copilot review comments.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolved some bugs and memory management issues. Represent assumptions with a dedicated datastructure. Minimally invasive changes; the original benchmark tables can be more or less verbatim be reproduced.
My goal was fixing part of #199 and preparing this code for an API pass. Performance tweaks and some other style issues are tabled.