Command-line resource limits
Resource limits can be set via command-line options when running the standalone solver.CPU time limit
CPU time limit in secondsRange: The solver will stop after 300 seconds (5 minutes) and return
[0, INT32_MAX]0: No limit (default)> 0: Terminate after specified seconds
INDETERMINATE.Memory limit
Memory limit in megabytesRange: The solver will stop if memory usage exceeds 2048 MB (2 GB).
[0, INT32_MAX]0: No limit (default)> 0: Limit memory usage to specified MB
Memory limits are enforced at the system level using
rlimit. If the limit is exceeded, MiniSat catches the allocation failure and returns INDETERMINATE.Programmatic resource limits
When using MiniSat as a library, you have finer control over resource limits through the API.Conflict budget
Limit the number of conflicts before returning:Set conflict budget
x: Maximum number of conflicts- Budget is relative to current conflict count
- Use
budgetOff()to disable
Propagation budget
Limit the number of propagations:Set propagation budget
x: Maximum number of propagations- Budget is relative to current propagation count
- Finer-grained control than conflict budget
Disabling budgets
The
solve() methods (without “Limited” suffix) automatically call budgetOff() before solving. Use solveLimited() to respect budgets.Asynchronous interruption
For long-running solves, you can interrupt from another thread:Trigger asynchronous interruption
- Sets internal flag checked during search
- Solver stops and returns
l_Undef - Thread-safe: can be called from signal handlers
Clear interrupt flag
- Resets interrupt flag
- Call before next
solve()invocation
Combining limits
You can combine multiple limit types:Return values and budgets
Understanding return values when using budgets:- l_True
- l_False
- l_Undef
Satisfiable
- A satisfying assignment was found
- Result is definitive
- Budget was not reached
- Model available in
solver.model
Practical examples
Portfolio solving with timeouts
Incremental solving with time slices
Statistics for monitoring
Track resource usage through statistics:All statistics are cumulative across multiple
solve() calls. They are never reset unless you create a new solver instance.Best practices
- Start with conflict budgets: Easier to estimate than propagations or time
- Use solveLimited(): Regular
solve()ignores budgets - Clear interrupts: Always call
clearInterrupt()after handling an interrupt - Monitor statistics: Use statistics to calibrate budgets
- Handle l_Undef gracefully: Always check for indeterminate results
Related topics
Configuration
Tune solver parameters for better performance
Performance
Optimize solving speed