All Downloads are FREE. Search and download functionalities are using the official Maven repository.

z3-z3-4.13.0.src.test.totalizer.cpp Maven / Gradle / Ivy

The newest version!
#include "opt/totalizer.h"
#include "ast/ast_pp.h"
#include "ast/reg_decl_plugins.h"
#include 

void tst_totalizer() {
    std::cout << "totalizer\n";
    ast_manager m;
    reg_decl_plugins(m);
    expr_ref_vector lits(m);
    for (unsigned i = 0; i < 5; ++i)
        lits.push_back(m.mk_fresh_const("a", m.mk_bool_sort()));
    opt::totalizer tot(lits);

    for (unsigned i = 0; i <= 6; ++i) {
        std::cout << "at least " << i << " ";
        expr* am = tot.at_least(i);
        std::cout << mk_pp(am, m) << "\n";        
    }
    for (auto& clause : tot.clauses()) 
        std::cout << clause << "\n";
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy