[go: up one dir, main page]

Menu

[e222c1]: / utils / pq_param.cpp  Maximize  Restore  History

Download this file

59 lines (52 with data), 1.3 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include <iostream>
#include <math.h>
#include "../common/utils.h"
typedef stxxl::int64 int64;
int64 D(int64 m, int64 k, int64 MaxS, int64 E, int64 B)
{
return (m*m/4 - (MaxS*E/(k-m))/B);
}
using std::cout;
using std::endl;
int main(int argc,char * argv[])
{
int64 IntM = 128*1024*1024;
int64 E = 4;
int64 B = 8*1024*1024;
int64 Bstep = 128*1024;
int64 MaxS = (int64(128)*int64(1024*1024*1024))/E;
for(; B > 4096; B = B/2 )
{
int64 m = 1;
int64 k = IntM/B;
for(; m < k; ++m)
{
int64 c = (k-m);
//if( D(m,k,MaxS,E,B)>= 0 && c > 10)
if((k-m)*m*m*B/(E*4) >= MaxS)
{
cout << (k-m)*(m)*(m*B/(E*4)) << endl;
cout << MaxS << endl;
cout << "D: " << D(m,k,MaxS,E,B) << endl;
cout << "B: " << B << endl;
cout << "c: " << c << endl;
cout << "k: " << k << endl;
int64 Ae = m/2;
int64 Ae1 = Ae + sqrt(D(m,k,MaxS,E,B));
int64 Ae2 = Ae - sqrt(D(m,k,MaxS,E,B));
int64 x = c*B/E;
int64 N = x/4096;
cout << "Ae : " << Ae << endl;
cout << "Ae1: " << Ae1 << endl;
cout << "Ae2: " << Ae2 << endl;
cout << "minAe :" << (MaxS/(x*Ae)) << endl;
cout << "x : " << x << endl;
cout << "N : " << N << endl;
int64 Cons = x*E + B*(m/2) + MaxS*B/(x*(m/2));
cout << "COns : "<< Cons << endl;
return 0;
}
}
}
cout << "No valid parameter found" << endl;
}