-
Notifications
You must be signed in to change notification settings - Fork 49
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
Mcsat api var order #478
Merged
Merged
Mcsat api var order #478
Changes from 13 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
c8f3a41
moving var_order vector from mcsat_options to context
ahmed-irfan 3b6c9ba
new api method for setting variable order
ahmed-irfan cf0f64d
mcsat-set-var-order test
ahmed-irfan 783ff3e
Merge branch 'master' into mcsat-api-var-order
ahmed-irfan d83ef5b
minor
ahmed-irfan f41980b
fix registration-queue error in mcsat-model-hint
ahmed-irfan 9c841f8
fix warnings
ahmed-irfan 45a1a10
enable Werror in CI
ahmed-irfan 2da96da
one more warning fix
ahmed-irfan 23d9ac3
Update test_model_hint.c
ahmed-irfan e6d8b94
check good vars
ahmed-irfan 595045d
Merge branch 'master' into mcsat-api-var-order
ahmed-irfan c871036
api text -- to be checked with sphinx, which is not running with brew
ahmed-irfan 0dc69eb
add more info in the doc
ahmed-irfan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
#ifdef NDEBUG | ||
#undef NDEBUG | ||
#endif | ||
|
||
#include <stdlib.h> | ||
|
||
#include "assert.h" | ||
|
||
#include <yices.h> | ||
|
||
int main(void) | ||
{ | ||
if (! yices_has_mcsat()) { | ||
return 1; // skipped | ||
} | ||
yices_init(); | ||
|
||
ctx_config_t* config = yices_new_config(); | ||
yices_default_config_for_logic(config, "QF_NIA"); | ||
context_t* ctx = yices_new_context(config); | ||
|
||
term_t x = yices_new_uninterpreted_term(yices_int_type()); | ||
yices_set_term_name(x, "x"); | ||
|
||
term_t y = yices_new_uninterpreted_term(yices_int_type()); | ||
yices_set_term_name(y, "y"); | ||
|
||
assert(!yices_error_code()); | ||
|
||
// assertion | ||
term_t a = yices_arith_gt_atom(x, yices_mul(y, y)); | ||
yices_assert_formula(ctx, a); | ||
|
||
// variable order | ||
term_t order_vars[2]; | ||
order_vars[0] = y; | ||
order_vars[1] = x; | ||
yices_mcsat_set_var_order(ctx, order_vars, 2); | ||
|
||
// model hint | ||
model_t* mdl = yices_new_model(); | ||
int32_t code; | ||
code = yices_model_set_int32(mdl, y, 4); | ||
if (code < 0) { | ||
yices_print_error(stderr); | ||
exit(1); | ||
} | ||
|
||
term_t vars[2]; | ||
vars[0] = y; | ||
vars[1] = x; | ||
|
||
smt_status_t status; | ||
status = yices_check_context_with_model_and_hint(ctx, NULL, mdl, 1, vars, 0); | ||
assert(!yices_error_code()); | ||
|
||
assert(status == STATUS_SAT); | ||
|
||
model_t* res_mdl = yices_get_model(ctx, 1); | ||
// we should have decided y first and because of the hint its value should be 4 | ||
assert(yices_formula_true_in_model(res_mdl, yices_arith_eq_atom(y, yices_int32(4)))); | ||
// x value should be greater than 16 (because x > y*y and y is assigned 4) | ||
assert(yices_formula_true_in_model(res_mdl, yices_arith_gt_atom(x, yices_int32(16)))); | ||
|
||
yices_free_model(mdl); | ||
yices_free_context(ctx); | ||
yices_exit(); | ||
|
||
return 0; | ||
} |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"...make MCSAT decide the variables..."
Can we specify in the doc whether the ordering is forced during the initial search phase only, or if it is persistent across backtracks (i.e. variable activities will not affect the order)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point. I will add that info