test/syrup_equivalence.cpp
/// Verifies that our using the Glucose::Multisolvers solver backend gives
/// equivalent results.
Verifies that our using the Glucose::Multisolvers solver backend gives
equivalent results.
Verifies that our using the Glucose :: Multisolvers solver backend gives equivalent results .
void check_std_equivalence(int nr_in, bool full_coverage)
{
    bsat_wrapper solver1;
    ssv_encoder encoder1(solver1);
    glucose_wrapper solver2;
    ssv_encoder encoder2(solver2);
    spec spec;
    spec.verbosity = 0;
    chain c1, c1_cegar, c2, c2_cegar;
    auto max_tests = (1 << (1 << nr_in));
    if (!full_coverage) {
        max_tests = std::min(max_tests, MAX_TESTS);
    }
    dynamic_truth_table tt(nr_in);
    for (auto i = 1; i < max_tests; i++) {
        kitty::create_from_words(tt, &i, &i+1);
        spec[0] = tt;
        auto res1 = synthesize(spec, c1, solver1, encoder1);
        assert(res1 == success);
        auto sim_tts1 = c1.simulate();
        auto c1_nr_steps = c1.get_nr_steps();
        auto res1_cegar = synthesize(spec, c1_cegar, solver1, encoder1, SYNTH_STD_CEGAR);
        assert(res1_cegar == success);
        auto sim_tts1_cegar = c1_cegar.simulate();
        auto c1_cegar_nr_steps = c1_cegar.get_nr_steps();
        auto res2 = synthesize(spec, c2, solver2, encoder2);
        assert(res2 == success);
        auto sim_tts2 = c2.simulate();
        auto c2_nr_steps = c2.get_nr_steps();
        assert(c1_nr_steps == c2_nr_steps);
        assert(c1_nr_steps == c1_cegar_nr_steps);
        assert(sim_tts1[0] == sim_tts2[0]);
        assert(c1.satisfies_spec(spec));
        assert(c2.satisfies_spec(spec));
        printf("(%d/%d)\r", i+1, max_tests);
        fflush(stdout);
    }
    printf("\n");
}
void check_std_equivalence ( int nr_in , bool full_coverage ) { bsat_wrapper solver1 ; ssv_encoder encoder1 ( solver1 ) ; glucose_wrapper solver2 ; ssv_encoder encoder2 ( solver2 ) ; spec spec ; spec . verbosity = 0 ; chain c1 , c1_cegar , c2 , c2_cegar ; auto max_tests = ( 1 << ( 1 << nr_in ) ) ; if ( ! full_coverage ) { max_tests = std :: min ( max_tests , MAX_TESTS ) ; } dynamic_truth_table tt ( nr_in ) ; for ( auto i = 1 ; i < max_tests ; i ++ ) { kitty :: create_from_words ( tt , & i , & i + 1 ) ; spec [ 0 ] = tt ; auto res1 = synthesize ( spec , c1 , solver1 , encoder1 ) ; assert ( res1 == success ) ; auto sim_tts1 = c1 . simulate ( ) ; auto c1_nr_steps = c1 . get_nr_steps ( ) ; auto res1_cegar = synthesize ( spec , c1_cegar , solver1 , encoder1 , SYNTH_STD_CEGAR ) ; assert ( res1_cegar == success ) ; auto sim_tts1_cegar = c1_cegar . simulate ( ) ; auto c1_cegar_nr_steps = c1_cegar . get_nr_steps ( ) ; auto res2 = synthesize ( spec , c2 , solver2 , encoder2 ) ; assert ( res2 == success ) ; auto sim_tts2 = c2 . simulate ( ) ; auto c2_nr_steps = c2 . get_nr_steps ( ) ; assert ( c1_nr_steps == c2_nr_steps ) ; assert ( c1_nr_steps == c1_cegar_nr_steps ) ; assert ( sim_tts1 [ 0 ] == sim_tts2 [ 0 ] ) ; assert ( c1 . satisfies_spec ( spec ) ) ; assert ( c2 . satisfies_spec ( spec ) ) ; printf ( " \r " , i + 1 , max_tests ) ; fflush ( stdout ) ; } printf ( " \n " ) ; }
Verifies that our using the Glucose::Multisolvers solver backend gives
equivalent results.
Verifies that our using the Glucose :: Multisolvers solver backend gives equivalent results .
// Don't run too many tests. /*
         * TODO: enable Glucose::MultiSolvers synthesis using CEGAR
        auto res2_cegar = synth2->cegar_synthesize(spec, c2_cegar);
        assert(res2_cegar == success);
        auto sim_tts2_cegar = c2_cegar.simulate();
        auto c2_cegar_nr_steps = c2_cegar.get_nr_steps();
        */ //assert(c1_cegar_nr_steps == c2_cegar_nr_steps); //assert(sim_tts1[0] == sim_tts1_cegar[0]); //assert(sim_tts1_cegar[0] == sim_tts2_cegar[0]);