博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
[Notes] Timer Comparision when turn influence computing on/off
阅读量:6432 次
发布时间:2019-06-23

本文共 2580 字,大约阅读时间需要 8 分钟。

Overall algorithm – bunny

关闭influence计算                                                             打开influence计算

 

Timer 插入位置:

FFAnalyzer::SeqPrint()

{

………

for (int l = 0; l < layer_size; l++)

{
    /*
    * Nl: number of dual verts in current layer
    * h : head for printing queue of the layer
    * t : tail for printing queue of the layer
    */
    layer_search.Reset();
    layer_search.Start();

    int Nl = layers_[l].size();

    int h = print_queue_.size();
    int t;
    if (l == 0)
    {
        t = Nl;
    }
    else
    {
        t = h + Nl;
    }

    if (h == t)

    {
        continue;
    }

    /* max_z_ and min_z_ in current layer */
    min_z_ = 1e20;
    max_z_ = -min_z_;
    for (int i = 0; i < Nl; i++)
    {
        WF_edge *e = layers_[l][i];
        point u = e->pvert_->Position();
        point v = e->ppair_->pvert_->Position();
        min_z_ = min(min_z_, (double)min(u.z(), v.z()));
        max_z_ = max(max_z_, (double)max(u.z(), v.z()));
    }

    if (!GenerateSeq(l, h, t))

    {
        fprintf(stderr,
            "All possible start edge at layer %d has been tried but no feasible sequence is obtained.\n",
            l + 1
            );
        bSuccess = false;
        break;
    }

    layer_search.Stop();

   
    string str = std::to_string(l) + ":";
    const char *msg = str.c_str();
    char* cstr = new char[str.length() + 1];
    strcpy(cstr, msg);

    layer_search.Print(cstr);

    printf("layer size: %d\n", Nl);
    printf("layer %d finished\n", l);
    printf("--------------\n");
}

……..

}

 

bool FFAnalyzer::GenerateSeq(int l, int h, int t)

{
    Timer ind_search;

    ind_search.Reset();

    ind_search.Start();

    /* last edge */

    assert(h != 0);                        // there must be pillars
    WF_edge *ei = print_queue_[h - 1];

    if (debug_)

    {
        fprintf(stderr, "-----------------------------------\n");
        fprintf(stderr, "Searching edge #%d in layer %d, head %d, tail %d\n",
            ei->ID() / 2, l + 1, h, t);
    }

    /* exit */

    if (h == t)
    {
        return true;
    }

    /* next choice */

    multimap<double, WF_edge*> choice;
    multimap<double, WF_edge*>::iterator it;

    /* next edge in current layer */

    int Nl = layers_[l].size();

    for (int j = 0; j < Nl; j++)

    {
        WF_edge *ej = layers_[l][j];
        /* cost weight */
        double cost = GenerateCost(ei, ej);
        if (cost != -1)
        {
            choice.insert(pair<double, WF_edge*>(cost, ej));
        }
    }

    ind_search.Stop();

    ind_search.Print("Single strut: ");

    /* ranked by weight */

    for (it = choice.begin(); it != choice.end(); it++)
    {
        WF_edge *ej = it->second;
        print_queue_.push_back(ej);

        /* update printed subgraph */

        UpdateStructure(ej);

        /* update collision */

        vector<vector<lld>> tmp_angle(3);
        UpdateStateMap(ej, tmp_angle);

        if (debug_)

        {
            fprintf(stderr, "Choose edge #%d in with cost %lf\n\n", ej->ID() / 2, it->first);
        }

        if (GenerateSeq(l, h + 1, t))

        {
            return true;
        }

        RecoverStateMap(ej, tmp_angle);

        RecoverStructure(ej);
        print_queue_.pop_back();
    }

    return false;

}

转载于:https://www.cnblogs.com/duckie/p/5794571.html

你可能感兴趣的文章
RH124-06 文件系统权限
查看>>
源码安装 php+nginx 构建BBS平台 (以CentOS6为例)
查看>>
你使用DBA数据库吗?
查看>>
const
查看>>
部署明星关系图谱那些事儿(GitHub Pages)
查看>>
浅谈 NSUserDefaults
查看>>
[BZOJ 3028]食物(生成函数)
查看>>
WKWebView的使用总结(oc与js交互使用心得)
查看>>
收敛交叉映射算法
查看>>
Python 数据清洗--处理Nan
查看>>
Actionscript 3.0 迁移指南
查看>>
leetcode 374. Guess Number Higher or Lower
查看>>
leetcode-682-Baseball Game
查看>>
Sharepoint 2010 Character problem in Category Titles in Blog Site for different languages
查看>>
秘猿科技开源 CITA-Monitor
查看>>
最便宜的云服务器
查看>>
aspxgridview 控件属性及功能
查看>>
最大联通子数组之和(dfs,记忆化搜索,状态压缩)
查看>>
(学习笔记4)数据可视化-matplotlib
查看>>
【设计模式系列】结构型模式之Composite模式
查看>>