本文整理汇总了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;
}
}
示例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;
// }
}
示例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;
}
}