当前位置: 首页>>代码示例>>C++>>正文


C++ Trajectory::active方法代码示例

本文整理汇总了C++中Trajectory::active方法的典型用法代码示例。如果您正苦于以下问题:C++ Trajectory::active方法的具体用法?C++ Trajectory::active怎么用?C++ Trajectory::active使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Trajectory的用法示例。


在下文中一共展示了Trajectory::active方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: fatal


//.........这里部分代码省略.........
        apply_mutation(K, temp, K->x);
        copy_KArray(K, K->x, temp);
    }
    */

    // fprintf(stderr, "K --------------------------------------------------\n");
    // fprintf(stderr, "U\ts\th\tS\n%lg\t%lg\t%lg\t%lg\n", K->U, K->fit_s, K->fit_h, K->S[0]);

    while (! is_equilibrium(K) || K->generation <= GENERATION_MINIMUM) {

        if (K->generation > GENERATION_CUTOFF) {
            fprintf(stderr, "exceeded GENERATION_CUTOFF=%d, stopping\n", GENERATION_CUTOFF);
            break;
        }

        if (DEBUG(DEBUG_GENERATIONS) || (K->progress && K->generation % K->progress == 0))
            fprintf(stderr, "generation %d\n", K->generation);
        IF_DEBUG(DEBUG_TRACE1)
            fprintf(stderr, "generation %d\n", K->generation);

        if (K->option_truncate)
            truncate_KArray(K, K->x, LOADCLASS_TRUNCATE);

        compute_mutation(K);
        compute_self_progeny(K);
        compute_apomixis_progeny(K);
        // compute_outcross_progeny(K);  // inefficient Kondrashov method
        compute_gametes(K);
        compute_zygotes(K);
        compute_summed_progeny(K);
        compute_selection(K);
        compute_adults_nextgen(K);

        IF_DEBUG(DEBUG_EQUILIBRIUM) {
            fprintf(stderr, "checking equilibrium at end of generation %d------------\n", 
                   K->generation - 1);
            fprintf(stderr, "dump of K->x[..][0][0]\n");
            dump_KArray(K, K->x, K->MI, 0, 1);
            fprintf(stderr, "calling is_equilibrium(K) just to check...\n");
            (void) is_equilibrium(K);
            fprintf(stderr, "end of equilibrium check ---------------\n");
        }

        normalize_KArray(K, K->x);

        /*
        if (K->generation - 1 == 0) {
            trajectory.start(K, "trajectory.txt", "end_of_gen", 5);
            trajectory.debug(true);
        } else if (trajectory.active()) {
            trajectory.check(K);
        }
        */

        // dump_KArray(K, K->x, 100, 0, 0);

    }

    // fprintf(stderr, "\n");


    if (!K->option_nolethal && K->is_lethal) {
        /*
        ** We need one more run through everything to get the
        ** progeny arrays built correctly.  We don't do mutation
        ** here.
        */
        K->createlethal = 1;
        IF_DEBUG(DEBUG_LETHALS)
            fprintf(stderr, "%s: one more run, to get progeny arrays\n", thisfunction);
        IF_DEBUG(DEBUG_LETHALS)
            fprintf(stderr, "%s: K->createlethal=%d\n", thisfunction, K->createlethal);
        compute_self_progeny(K);
        compute_apomixis_progeny(K);
        compute_gametes(K);
        compute_zygotes(K);
        compute_summed_progeny(K);
        compute_selection(K);
        compute_adults_nextgen(K);
        K->generation--;
        normalize_KArray(K, K->x);
    }

    stats_all(K);
    stats_print(K);

    if (trajectory.active() && trajectory.lastgen() != K->generation) {
        trajectory.write(K);
        trajectory.stop();
    }

    // dump_KArray(K, K->x, 10, 0, 0);

    //K->save_savefile = 1;
    if (K->save) {
        save_savefile(K, K->x);
    }

    return 0;
}
开发者ID:douglasgscofield,项目名称:K,代码行数:101,代码来源:K.cpp


注:本文中的Trajectory::active方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。