mirror of
https://github.com/Z3Prover/z3
synced 2025-08-25 20:46:01 +00:00
added restarts options to duality (plus some other disabled features)
This commit is contained in:
parent
4763532501
commit
301cb51bbb
5 changed files with 446 additions and 20 deletions
|
@ -2816,6 +2816,62 @@ namespace Duality {
|
|||
}
|
||||
}
|
||||
|
||||
void foobar(){
|
||||
}
|
||||
|
||||
void RPFP::GreedyReduceNodes(std::vector<Node *> &nodes){
|
||||
std::vector<expr> lits;
|
||||
for(unsigned i = 0; i < nodes.size(); i++){
|
||||
Term b; std::vector<Term> v;
|
||||
RedVars(nodes[i], b, v);
|
||||
lits.push_back(!b);
|
||||
expr bv = dualModel.eval(b);
|
||||
if(eq(bv,ctx.bool_val(true))){
|
||||
check_result res = slvr_check(lits.size(),&lits[0]);
|
||||
if(res == unsat)
|
||||
lits.pop_back();
|
||||
else
|
||||
foobar();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
check_result RPFP::CheckWithConstrainedNodes(std::vector<Node *> &posnodes,std::vector<Node *> &negnodes){
|
||||
timer_start("Check");
|
||||
std::vector<expr> lits;
|
||||
for(unsigned i = 0; i < posnodes.size(); i++){
|
||||
Term b; std::vector<Term> v;
|
||||
RedVars(posnodes[i], b, v);
|
||||
lits.push_back(b);
|
||||
}
|
||||
for(unsigned i = 0; i < negnodes.size(); i++){
|
||||
Term b; std::vector<Term> v;
|
||||
RedVars(negnodes[i], b, v);
|
||||
lits.push_back(!b);
|
||||
}
|
||||
check_result res = slvr_check(lits.size(),&lits[0]);
|
||||
if(res == unsat && posnodes.size()){
|
||||
lits.resize(posnodes.size());
|
||||
res = slvr_check(lits.size(),&lits[0]);
|
||||
}
|
||||
dualModel = slvr().get_model();
|
||||
#if 0
|
||||
if(!dualModel.null()){
|
||||
std::cout << "posnodes called:\n";
|
||||
for(unsigned i = 0; i < posnodes.size(); i++)
|
||||
if(!Empty(posnodes[i]))
|
||||
std::cout << posnodes[i]->Name.name() << "\n";
|
||||
std::cout << "negnodes called:\n";
|
||||
for(unsigned i = 0; i < negnodes.size(); i++)
|
||||
if(!Empty(negnodes[i]))
|
||||
std::cout << negnodes[i]->Name.name() << "\n";
|
||||
}
|
||||
#endif
|
||||
timer_stop("Check");
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
void RPFP_caching::FilterCore(std::vector<expr> &core, std::vector<expr> &full_core){
|
||||
hash_set<ast> core_set;
|
||||
std::copy(full_core.begin(),full_core.end(),std::inserter(core_set,core_set.begin()));
|
||||
|
@ -3333,6 +3389,17 @@ namespace Duality {
|
|||
return ctx.function(name.c_str(), arity, &domain[0], f.range());
|
||||
}
|
||||
|
||||
Z3User::FuncDecl Z3User::NumberPred(const FuncDecl &f, int n)
|
||||
{
|
||||
std::string name = f.name().str();
|
||||
name = name + "_" + string_of_int(n);
|
||||
int arity = f.arity();
|
||||
std::vector<sort> domain;
|
||||
for(int i = 0; i < arity; i++)
|
||||
domain.push_back(f.domain(i));
|
||||
return ctx.function(name.c_str(), arity, &domain[0], f.range());
|
||||
}
|
||||
|
||||
// Scan the clause body for occurrences of the predicate unknowns
|
||||
|
||||
RPFP::Term RPFP::ScanBody(hash_map<ast,Term> &memo,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue