Advertisement
morswinb

Hoi4 Dispersed Vs Concentrated

Sep 13th, 2017
439
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 4.77 KB | None | 0 0
  1. clc
  2. clear all
  3. close all
  4.  
  5. % messures of growth of production efficency for production caps of
  6. % 50%,60%,70% and 80%
  7.  
  8. pe50 = [
  9.     1010
  10.     1026
  11.     1050
  12.     1074
  13.     1097
  14.     1120
  15.     1143
  16.     1165
  17.     1186
  18.     1207
  19.     1228
  20.     1248
  21.     1268
  22.     1288
  23.     1307
  24.     1327
  25.     1346
  26.     1364
  27.     1382
  28.     1401
  29.     1418
  30.     1505
  31.     1602
  32.     1708
  33.     1808
  34.     1890
  35.     1929
  36.     1942
  37.     1968
  38.     1993
  39.     2018
  40.     2056
  41.     2092
  42. ];
  43.  
  44. dpe50 = [
  45.     247
  46.     241
  47.     238
  48.     232
  49.     226
  50.     223
  51.     217
  52.     214
  53.     211
  54.     204
  55.     201
  56.     198
  57.     195
  58.     192
  59.     189
  60.     186
  61.     183
  62.     183
  63.     180
  64.     177
  65.     174
  66.     165
  67.     156
  68.     143
  69.     137
  70.     131
  71.     128
  72.     128
  73.     125
  74.     125
  75.     122
  76.     119
  77.     119
  78. ];
  79.  
  80. pe60 = [
  81.     1010
  82.     1072
  83.     1138
  84.     1170
  85.     1201
  86.     1230
  87.     1260
  88.     1288
  89.     1317
  90.     1344
  91.     1371
  92.     1397
  93.     1448
  94.     1497
  95.     1545
  96.     1569
  97.     1614
  98.     1659
  99.     1702
  100.     1744
  101.     1785
  102.     1825
  103.     1865
  104.     1903
  105.     1941
  106.     1978
  107.     2014
  108.     2025
  109.     2085
  110. ];
  111.  
  112. dpe60 = [
  113.     357
  114.     336
  115.     314
  116.     305
  117.     299
  118.     290
  119.     284
  120.     278
  121.     272
  122.     266
  123.     262
  124.     256
  125.     247
  126.     238
  127.     232
  128.     229
  129.     223
  130.     217
  131.     211
  132.     204
  133.     201
  134.     195
  135.     192
  136.     189
  137.     183
  138.     180
  139.     177
  140.     174
  141.     171
  142. ];
  143.  
  144. pe70 = [
  145.   1010
  146.   1050
  147.   1096
  148.   1141
  149.   1184
  150.   1226
  151.   1305
  152.   1379
  153.   1449
  154.   1548
  155.   1580
  156.   1611
  157.   1642
  158.   1672
  159.   1701
  160.   1786
  161.   1814
  162.   1867
  163.   1894
  164.   1920
  165.   1970
  166.   1995
  167.   2020
  168.   2044
  169.   2092
  170. ];
  171.  
  172. dpe70 = [
  173.     488
  174.     467
  175.     446
  176.     427
  177.     412
  178.     400
  179.     375
  180.     354
  181.     336
  182.     314
  183.     308
  184.     302
  185.     296
  186.     293
  187.     287
  188.     272
  189.     269
  190.     262
  191.     256
  192.     253
  193.     247
  194.     244
  195.     241
  196.     235
  197.     232
  198. ];
  199.  
  200.  
  201. pe80 = [
  202.     1001
  203.     1065
  204.     1125
  205.     1182
  206.     1236
  207.     1288
  208.     1338
  209.     1432
  210.     1520
  211.     1563
  212.     1603
  213.     1643
  214.     1682
  215.     1721
  216.     1794
  217.     1830
  218.     1899
  219.     1933
  220.     1999
  221.     2031
  222. ];
  223.  
  224. dpe80 = [
  225.     638
  226.     601
  227.     568
  228.     540
  229.     516
  230.     494
  231.     476
  232.     446
  233.     421
  234.     409
  235.     397
  236.     388
  237.     378
  238.     369
  239.     354
  240.     348
  241.     336
  242.     330
  243.     317
  244.     314
  245. ];
  246.  
  247. % i copied just the digits from in game percentages so fix it here
  248. pe50=pe50./10000;
  249. dpe50=dpe50./100000;
  250.  
  251. pe60=pe60./10000;
  252. dpe60=dpe60./100000;
  253.  
  254. pe70=pe70./10000;
  255. dpe70=dpe70./100000;
  256.  
  257. pe80=pe80./10000;
  258. dpe80=dpe80./100000;
  259.  
  260. % pe cap for each messured growth, note that those are a bit off from
  261. % the the expected round values, but the game reports just like it
  262. peCap = [0.5005 0.6006 0.7007 0.8008];
  263.  
  264. %
  265. % do wierd matlab stuff ...
  266. %
  267.  
  268. % find out that the rate of change is the inverse of the function value
  269. % times production efficency cap squared
  270. dpe = @(pe,cap) 1/1000 * cap.^2./ pe ;
  271.  
  272. %
  273. % check rate of change against game data
  274. %
  275. figure
  276. plot([pe50 ;pe60 ;pe70; pe80],[dpe50 ;dpe60 ;dpe70 ;dpe80] ,'ko')
  277. hold on
  278. plot(pe50,dpe(pe50,peCap(1)),'r')
  279. plot(pe60,dpe(pe60,peCap(2)),'g')
  280. plot(pe70,dpe(pe70,peCap(3)),'b')
  281. plot(pe80,dpe(pe80,peCap(4)),'c')
  282. legend('In Game Data','cap 50%','cap 60%','cap 70%','cap 80%')
  283. xlabel('P_e')
  284. ylabel('dP_e')
  285. hold off
  286.  
  287. %
  288. % reproduce paradox graph result
  289. %
  290.  
  291. % integrate to get production efficency at t days given base efficency p0
  292. pe=@(t,cap,p0) min(cap , sqrt(2) * sqrt(cap^2*t/1000+1/2*p0^2));
  293.  
  294. days=0:500;
  295. cap=0.75;
  296. base=0.10;
  297. % guessed old growth function
  298. oldEfficencyGrowthFunction=@(t) min(0.002407*t+base,cap);
  299. figure
  300. plot(days,oldEfficencyGrowthFunction(days),'-r','LineWidth',2)
  301. hold on
  302. plot(days,pe(days,cap,base),'b','LineWidth',2);
  303. legend('old linear','new log like approximation')
  304. hold off
  305.  
  306. %
  307. % figure out if concentrated is better than dispersed
  308. %
  309.  
  310. % free trade bonus and tech level
  311. tech=3;
  312. trade=0.15;
  313.  
  314. baseConcentrated = 1+trade+tech*0.15;
  315. baseDispersed= 1+trade+tech*0.10;
  316. cap = 0.5005 + tech * 0.1001;
  317.  
  318. p0Concentrated = 0.10;
  319. p0Dispersed = 0.10+tech*0.05;
  320.  
  321. days = 0:1000;
  322. figure
  323. plot(days, pe(days,cap,p0Concentrated) , ...
  324.      days, pe(days,cap,p0Dispersed))
  325.  
  326. xlabel('days')
  327. ylabel('P_e')
  328. legend('concentrated','disparsed')
  329.  
  330. figure
  331. plot(days,Fout(days,cap,baseConcentrated,p0Concentrated), ...
  332.      days,Fout(days,cap,baseDispersed,p0Dispersed));
  333.  
  334. xlabel('days')
  335. ylabel('F_{out}')
  336. legend('concentrated','disparsed')
  337.  
  338. figure
  339. days=10:1000;
  340. largeTimeAsymptote=(baseDispersed-baseConcentrated)/baseConcentrated;
  341. plot(days, ( F_out(days,cap,baseDispersed,p0Dispersed)...
  342.               -F_out(days,cap,baseConcentrated,p0Concentrated))....
  343.               ./F_out(days,cap,baseConcentrated,p0Concentrated),'b',...
  344.               [0 1000], [0 0] ,'k',...
  345.               [0 1000], [largeTimeAsymptote largeTimeAsymptote] ,'--k');
  346. legend('relative output gained from disparsed')
  347. xlabel('days')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement