Example #1
0
satcheck_smvsatt::satcheck_smvsatt()
{
  satsolver=
    sat_instance_new_type(SATSOLVERCORE1, no_variables(), true);

  // now we can do l_const
  init_const();
}
Example #2
0
int
neighborj_score_string ( const char *constTree,
                         struct genome_struct *genome_list, int num_genes,
                         int num_genomes,
                         distmem_t * distmem, int CIRCULAR,
                         struct tNode *tpool, int *edgepool,
                         struct genome_struct *labels,
                         int initmethod, int COND,
                         struct qNode *qpool,
                         struct adj_struct *adj_list,
                         struct adj_struct *adj_pool,
                         int *stack, int *degree, int *otherEnd,
                         intpair_t * neighbors,
                         smalledge_t * smalledges,
                         edge_t * edges,
                         int *outcycle, int *pred1, int *pred2, int *picked,
                         int *decode, int inittspsolver,
                         triple_t * triple, int *incycle, int tspsolver,
                         int distmethod,
                         int thresh, int **weights, int **status,
                         int *best_so_far, env_t * const_env,
                         int *genes,
                         int *condense_succ, int *condense_decode,
                         int orig_num_genes, int correction,
                         char *treeString )
{
    int score;
    ConstraintTree_T const_tree;
    struct tNode *tree;
    int index;
    int i;

#ifdef DEBUG
    fprintf ( outfile, "Neighbor-Joining Tree: %s\n\n", constTree );
    fflush ( outfile );
#endif

    init_const ( const_env, constTree, const_tree, tpool );
    tree = first_const ( const_tree, tpool, 0, const_env );

#ifdef DEBUG
    print_tree_tag ( tree );
#endif

    tree->leaf = TRUE;
    index = 0;
    SetTreeEdgePtrs ( tree, edgepool, &index );
    for ( i = 0; i < 2 * num_genomes + 6; i++ )
    {
        tpool[i].genome = NULL;
    }
    add_genomes_to_tree ( tree, labels, genome_list, num_genes );
    switch ( initmethod )
    {
        case RAND:
            initialize_tree_random ( tree, labels, num_genes, num_genomes );
            break;
        case SMALLNN:
            initialize_tree_SNN ( COND, tree, tpool, labels, qpool, adj_list,
                                  adj_pool, weights, stack, degree, otherEnd,
                                  neighbors, edges, incycle, outcycle, pred1,
                                  pred2, picked, decode, num_genes,
                                  num_genomes, inittspsolver, thresh,
                                  CIRCULAR );
            /* reuses pred1, pred2, picked */
            break;
        case SBNN:
            initialize_tree_SBNN ( COND, tree, tpool, labels, qpool, adj_list,
                                   adj_pool, weights, stack, degree, otherEnd,
                                   neighbors, edges, incycle, outcycle, pred1,
                                   pred2, picked, decode, num_genes,
                                   num_genomes, inittspsolver, thresh,
                                   CIRCULAR );
            /* reuses pred1, pred2, picked */
            break;
        case BIGNN:
            initialize_tree_BNN ( COND, tree, tpool, labels, triple, adj_list,
                                  adj_pool, weights, stack, degree, otherEnd,
                                  neighbors, edges, incycle, outcycle, pred1,
                                  pred2, picked, decode, num_genes,
                                  num_genomes, inittspsolver, thresh,
                                  CIRCULAR );
            /* reuses pred1, pred2, picked */
            break;
        case FASTPROP:
            initialize_tree_propagate ( COND, tree, tpool, labels, qpool,
                                        adj_list, adj_pool, weights, stack,
                                        degree, otherEnd, neighbors, edges,
                                        incycle, outcycle, num_genes,
                                        num_genomes, pred1, pred2, picked,
                                        decode, FAST, tspsolver, thresh,
                                        CIRCULAR );
            break;
        case MEDIANPROP:
            initialize_tree_propagate ( COND, tree, tpool, labels, qpool,
                                        adj_list, adj_pool, weights, stack,
                                        degree, otherEnd, neighbors, edges,
                                        incycle, outcycle, num_genes,
                                        num_genomes, pred1, pred2, picked,
                                        decode, MEDIAN, inittspsolver, thresh,
                                        CIRCULAR );
            break;
        case TRIV:
            initialize_tree_trivial ( tree, labels, num_genes, num_genomes );
            break;
        case ADJPARS:
            initialize_tree_adjpars ( tree, tpool, labels,
                                      stack, degree, otherEnd, neighbors,
                                      smalledges, incycle, outcycle,
                                      num_genes, num_genomes, weights, status,
                                      inittspsolver, thresh, CIRCULAR );
            break;
        default:
            fprintf ( stderr, "ERROR: no initialization given\n" );
    }
    score =
        score_tree ( tree, num_genes, CIRCULAR, distmethod, distmem,
                     correction );
#ifdef DEBUG
    fprintf ( outfile, "initial score=%5d\n", score );
    fflush ( outfile );
#endif
    score =
        iterate_over_tree ( COND, tree, num_genes, num_genomes, tspsolver,
                            thresh, score, adj_list, adj_pool, neighbors,
                            stack, incycle, outcycle, weights, degree,
                            otherEnd, edges, tpool, labels, pred1, pred2,
                            picked, decode, genes, CIRCULAR, distmethod,
                            distmem, correction );

    if ( score < *best_so_far )
    {
        *best_so_far = score;

#ifdef MPBPA
        if ( MYPROC == 0 )
        {
#endif
            fprintf ( outfile, "Neighbor-Joining Tree: %s\n\n", constTree );
            fflush ( outfile );

            switch ( distmethod )
            {
                case DIST_BP:
                    fprintf ( outfile, "NJ breakpoint score = %12d\n",
                              score );
                    fprintf ( outfile, "NJ inversion score  = %12d\n",
                              score_tree ( tree, num_genes, CIRCULAR,
                                           DIST_INV, distmem, correction ) );
                    fflush ( outfile );
                    break;
                case DIST_INV:
                    fprintf ( outfile, "NJ inversion score  = %12d\n",
                              score );
                    fprintf ( outfile, "NJ breakpoint score = %12d\n",
                              score_tree ( tree, num_genes, CIRCULAR, DIST_BP,
                                           distmem, correction ) );
                    fflush ( outfile );
                    break;
            }

#ifdef DEBUG
            print_tree_tag ( tree );
#endif

            print_tree_uncondensed ( tree, num_genes,
                                     condense_succ, condense_decode,
                                     orig_num_genes );
            if ( treeString != NULL )
                print_tree_nexus_noscore ( treeString, tree );

            fprintf ( outfile, "\n" );
            /* testing */

#ifdef MPBPA
        }
#endif

    }

    return ( score );
}