3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-23 17:15:31 +00:00

working on stand-alone simplex

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2014-01-26 20:25:36 -08:00
parent c14c65465a
commit 363af825c0
4 changed files with 32 additions and 6 deletions

View file

@ -218,6 +218,7 @@ int main(int argc, char ** argv) {
TST(expr_substitution);
TST(sorting_network);
TST(theory_pb);
TST(simplex);
}
void initialize_mam() {}

View file

@ -2,6 +2,7 @@
#include "sparse_matrix_def.h"
#include "simplex.h"
#include "simplex_def.h"
#include "mpq_inf.h"
typedef simplex::simplex<simplex::mpz_ext> Simplex;
@ -9,9 +10,13 @@ void tst_simplex() {
simplex::sparse_matrix<simplex::mpz_ext> M;
Simplex S;
S.make_feasible();
std::cout << "simplex\n";
lbool is_sat = S.make_feasible();
std::cout << "feasible: " << is_sat << "\n";
unsynch_mpz_manager m;
unsynch_mpq_inf_manager em;
scoped_mpz_vector coeffs(m);
svector<unsigned> vars;
for (unsigned i = 0; i < 5; ++i) {
@ -21,4 +26,15 @@ void tst_simplex() {
}
Simplex::row r = S.add_row(1, coeffs.size(), vars.c_ptr(), coeffs.c_ptr());
is_sat = S.make_feasible();
std::cout << "feasible: " << is_sat << "\n";
S.display(std::cout);
_scoped_numeral<unsynch_mpq_inf_manager> num(em);
num = std::make_pair(mpq(1), mpq(0));
S.set_lower(0, num);
S.set_upper(0, num);
is_sat = S.make_feasible();
std::cout << "feasible: " << is_sat << "\n";
S.display(std::cout);
}