-
Notifications
You must be signed in to change notification settings - Fork 52
Optimization API and Resource Management Improvements Needed #476
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I'd like to assign myself to work on fixing the inconsistent optimization support issue. Based on my analysis.
I can submit an initial PR within 5 days that addresses the core inconsistencies. Please let me know if there are any specific aspects you'd like me to prioritize. |
Thanks for your interest in tackling this issue! We really appreciate your initiative and willingness to dive into the inconsistent optimization support problem. Optimization techniques can indeed be quite complex. Full support exists only in Z3, and a partial implementation in MathSAT5, while other solvers just do not have this feature. It’s worth noting that even MathSAT doesn’t include optimization in its main library - it's actually only available in its fork called OptiMathSAT, which is maybe inactive in development. I would assume that the Looking forward to seeing your contribution—thanks again for stepping up! |
Hi, I'd like to take on this issue. Please assign it to me. I've already started researching the current state of optimization support in the various solvers integrated with JavaSMT, including how UnsupportedOperationException is being handled. I'm also looking into potential improvements and exploring ideas for a solver-independent fallback mechanism when native optimization support is missing. It would be great if you could also add relevant labels such as enhancement or good first issue, if applicable. Thanks for the helpful context and for encouraging community contributions. I am looking forward to working on this. |
Please make sure that you really understand the problem of optimization support before starting your implementation. There are reasons why several solvers do not support this feature, and one reason might be the complexity of this task: Finding an optimum for a specific constraint in SMT is considered a "hard problem". |
Thank you for your feedback, @kfriedberger. I appreciate the caution about the complexity of optimization in SMT. I understand optimization is inherently a "hard problem" in SMT, which explains why many solvers don't support it. My intention isn't to implement optimization algorithms from scratch for each solver, but rather to:
Before proceeding, I'd like to better understand the specific limitations of different solvers. Would it be helpful to start with a survey of the current state and documentation improvements, before proposing any implementation changes? |
Your task list sounds reasonable.
Please document the inconsistencies in the current API and error handling, e.g., is there more than just "unsupported" for now regarding the API of JavaSMT. Please consider to minimize API changes due to the requirement of backwards-compatibility. . Any reasonable pull request is appreciated.
Feel free to provide a fallback if there is a general solution. Please note that JavaSMT as such is only considered a "simple wrapper library" and as such any fallback should also be maintainable with reasonable effort in the future. Even larger SMT solver dismiss features that are not required by a larger group of users or have higher development effort as expected. A prominent example for such a feature is Craig interpolation that was removed from Z3 some years ago. |
This commit addresses issue sosy-lab#476 by: 1. Creating a standardized optimization API with AbstractOptimizationProver 2. Adding a fallback implementation for solvers without native optimization support 3. Implementing version compatibility checks for MathSAT5 4. Adding comprehensive tests for optimization features 5. Improving error handling with SolverOptimizationException 6. Adding documentation for optimization features The changes provide consistent optimization support across all solvers, with a graceful fallback for unsupported solvers. The implementation uses binary search to approximate optimization results for solvers without native support.
Inconsistent Optimization Support Across Solvers
Description
The optimization API in JavaSMT has inconsistent implementation across different solvers, leading to unpredictable behavior when applications switch between solver backends. Currently, only Z3 and MathSAT5 (via OptiMathSAT) properly support optimization capabilities, while other solvers simply throw exceptions without providing alternative functionality.
Observed Issues
Evidence in Implementation Code:
Z3 provides full implementation:
While other solvers throw exceptions:
Test Code Shows Special Handling:
Tests must skip optimization tests for most solvers:
Even between supported solvers, behavior differs:
Impact
The text was updated successfully, but these errors were encountered: