Skip to content

Commit

Permalink
add timeout keyword to set-option in the smt2 frontend (#527)
Browse files Browse the repository at this point in the history
* add timeout keyword to set-option in the smt2 frontend

* add timeout example
  • Loading branch information
ahmed-irfan authored Sep 6, 2024
1 parent c0a2609 commit 77cd0a2
Show file tree
Hide file tree
Showing 9 changed files with 2,848 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/frontend/smt2/smt2_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -6283,6 +6283,10 @@ void smt2_set_option(const char *name, aval_t value) {
set_boolean_option(g, name, value, &g->dump_models);
break;

case SMT2_KW_TIMEOUT:
set_uint32_option(g, name, value, &g->timeout);
break;

case SMT2_KW_PRODUCE_UNSAT_ASSUMPTIONS:
// optional: if true, get-unsat-assumptions can be used
if (option_can_be_set(name)) {
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/smt2/smt2_commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ typedef struct smt2_globals_s {
uint32_t nthreads; // default = 0 (single threaded)

// timeout
uint32_t timeout; // default = 0 (no timeout)
uint32_t timeout; // default = 0 (no timeout); global timeout used for every check-sat
timeout_t *to; // initially NULL. Non-NULL once init_timeout is called
bool interrupted; // true if the most recent call to check_sat timed out

Expand Down
3 changes: 2 additions & 1 deletion src/frontend/smt2/smt2_keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,5 @@ struct keyword_s;
:category, SMT2_KW_CATEGORY
:difficulty, SMT2_KW_DIFFICULTY
:notes, SMT2_KW_NOTES
:dump-models, SMT2_KW_DUMP_MODELS
:dump-models, SMT2_KW_DUMP_MODELS
:timeout, SMT2_KW_TIMEOUT
1 change: 1 addition & 0 deletions src/frontend/smt2/smt2_lexer.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ static const char * const smt2_keyword_string[NUM_SMT2_KEYWORDS] = {
":reproducible-resource-limit", // SMT2_KW_REPRODUCIBLE_RESOURCE_LIMIT
":verbosity", // SMT2_KW_VERBOSITY
":dump-models", // SMT2_KW_DUMP_MODELS
":timeout", // SMT2_KW_TIMEOUT

":all-statistics", // SMT2_KW_ALL_STATISTICS
":assertion-stack-levesl", // SMT2_KM_ASSERTIONS_STACK_LEVELS
Expand Down
1 change: 1 addition & 0 deletions src/frontend/smt2/smt2_lexer.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ enum smt2_keyword {
SMT2_KW_REPRODUCIBLE_RESOURCE_LIMIT,
SMT2_KW_VERBOSITY,
SMT2_KW_DUMP_MODELS,
SMT2_KW_TIMEOUT,

// Predefined keywords for (get-info ...)
SMT2_KW_ALL_STATISTICS,
Expand Down
3 changes: 3 additions & 0 deletions tests/regress/set-timeout.smt2
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(set-option :timeout 1)
(set-logic QF_UF)
(exit)
Empty file.
Loading

0 comments on commit 77cd0a2

Please sign in to comment.