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


C++ NetworkData::init方法代码示例

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


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

示例1: runExperiment22

void runExperiment22(int N, int M, int L, int L_user) {
    int count = 200;
    while (count--) {
        NetworkData data;
        data.init(N,M,L,L_user);
        vector<int> p(0);
        ProblemSolver ps(data);
        cout << ps.findOptimalUniformPrice().first << " ";
        pair<int, vector<int> > r1 = ps.findLocallyOptimalNonuiformPricing(0,0);
        pair<int, vector<int> > r2 = ps.findLocallyOptimalNonuiformPricing(1,0);
        cout << r1.first << " ";
        cout << ps._getRevenueForNonuniformPricing(r2.second) << endl;
    }
}
开发者ID:xiachaolun,项目名称:pricing,代码行数:14,代码来源:experiment.cpp

示例2: runEvaluation

void runEvaluation(int N, int M, int L, int L_user) {
    int n_cases = 1;
    while (true) {
        cout << "case: " << n_cases++ << endl;
        NetworkData data;
        data.init(N,M,L,L_user);
        ProblemSolver ps(data);
        int nonuni_r = ps.findLocallyOptimalNonuiformPricing(1,1).first;
    }
    
    //    while (true) {
    //        NetworkData data;
    //        data.init(N,M,L,L_user);
    //        ProblemSolver ps(data);
    //        int uni_r = ps.findOptimalUniformPrice().first;
    //        int nonuni_r = ps.findLocallyOptimalNonuiformPricing(1, 0).first;
    //        int opt_r = ps.findOptimalPricingByDFS().first;
    //        cout << uni_r << " " << nonuni_r << " " << opt_r << endl;
    //    }
}
开发者ID:xiachaolun,项目名称:pricing,代码行数:20,代码来源:experiment.cpp

示例3: runExperiment2

void runExperiment2(int N, int M, int L, int L_user) {
    int count = 1000;
    while (count--) {
        NetworkData data;
        data.init(N,M,L,L_user);
        vector<int> p(0);
        for (int i = 0; i < L; ++i) {
            p.push_back(rand()%(MAX_VALUATION+1));
        }
        ProblemSolver ps(data);
        cout << ps._getRevenueForNonuniformPricing(p);
        ApproximateAlgorithm aa = ApproximateAlgorithm(data, p);
        cout << " " << aa.computeRevenue() << endl;
//        int random_max = 0;
//        for (int i = 0; i < 20; ++i) {
//            int r = aa._computeRevenueWithRandomSelection();
//            random_max = r > random_max ? r : random_max;
//            cout << " " << random_max;
//        }
//        cout << endl;
    }
}
开发者ID:xiachaolun,项目名称:pricing,代码行数:22,代码来源:experiment.cpp


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