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


C++ Sequence::getCopy方法代码示例

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


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

示例1: tableGen

void tableGen() {

    int instances = 50;
    SEQ_SIZE = 100;
    LOW = 1;
    HIGH = 1000000000000;
    ITER = 50000;
    DEBUGGING = false;
    IN_PRODUCTION = true;

    /*----------------------------------*/

    cout << "rowID\tKK\tBoolRR\tBoolHC\tBoolSA\tPartRR\tPartHC\tPartSA\n";
    for (int i = 1; i <= instances; i++){

        Sequence* s = new Sequence(SEQ_SIZE);

        /*----------------------------------*/

        PREPARTITIONING = false;
        Sequence* s_copy = s->getCopy();
        int64 kk = karmarkarKarp(s_copy);
        delete s_copy;

        int64 boolRR = repeatedRandom(s)->residue();
        int64 boolHC = hillClimbing(s)->residue();
        int64 boolSA = simulatedAnnealing(s);

        /*----------------------------------*/

        PREPARTITIONING = true;
        int64 partRR = repeatedRandom(s)->residue();
        int64 partHC = hillClimbing(s)->residue();
        int64 partSA = simulatedAnnealing(s);

        /*----------------------------------*/

        delete s;

        cout << i << "\t" << kk << "\t" << boolRR << "\t" << boolHC << "\t" << boolSA << "\t"
        << partRR << "\t" << partHC << "\t" << partSA << "\n";
    }
}
开发者ID:josephwandile,项目名称:number-partition,代码行数:43,代码来源:main.cpp

示例2: main

int main(int argc, const char * argv[]) {

    mt19937 gen(r());

    string fname = argv[1];

    if (argc > 2) { // Testing cases present in args
        int64 flag = atoi(argv[2]);
        testSuite(flag);
    }

    if (argc == 2) {

        // Proof that KK works
        Sequence* s = generateInstanceFromFile(fname);
        Sequence* s_copy = s->getCopy();

        cout << "karmarkarKarp: " << karmarkarKarp(s_copy) << endl << endl;

        PREPARTITIONING = false;

        repeatedRandom(s)->residue();
        cout << endl;
        hillClimbing(s)->residue();
        cout << endl;
        simulatedAnnealing(s);
        cout << endl;

        PREPARTITIONING = true;

        repeatedRandom(s)->residue();
        cout << endl;
        hillClimbing(s)->residue();
        cout << endl;
        simulatedAnnealing(s);
        cout << endl;
    }
}
开发者ID:josephwandile,项目名称:number-partition,代码行数:38,代码来源:main.cpp


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