forked from AndrewMele/Reliability
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
2258 lines (2101 loc) · 140 KB
/
Program.cs
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
using System;
using System.Collections;
using System.Diagnostics;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using MathNet.Numerics;
using MathNet.Numerics.Distributions;
using MathNet.Numerics.LinearAlgebra;
using MathNet.Numerics.LinearAlgebra.Double;
namespace SoftwareReliability
{
class Program
{
//Global Variables
static int number;
static double[] component_reliabilities;
static Matrix<double> correlations_matrix;
static List<double> sigma = new List<double>();
static List<int[]> CS = new List<int[]>();
static List<int[]> PS = new List<int[]>();
static List<double[]> Bm = new List<double[]>();
//static double[] component_reliabilities = {0.95, 0.8, 0.93}; //2 out of 3
//static double[] component_reliabilities = { 0.99, 0.995, 0.98, 0.995}; //RAMS2014
//component_reliabilities = { 0.8, 0.75, 0.7, 0.72, 0.73 }; //Hoda's
//static double[] component_reliabilities = { 0.99, 0.995, 0.98, 0.995, 0.8, 0.75, 0.7, 0.72, 0.73, 0.84 }; //10 State
static List<PTrace> ConditionalPErrors = new List<PTrace>();
static List<PTrace> TotalPErrors = new List<PTrace>();
static void Main(string[] args)
{
//Setup stopwatch
DateTime startTime, endTime;
double elpasedMilliseconds;
startTime = DateTime.Now;
//Build environment
Build("8p");
int i = 1;
double S;
if (i == 0)
{
FindReliability();
}
else
{
S = Simulation(1000000);
Console.WriteLine("Simulation Estimate with 1,000,000 runs: " + S.ToString("#0.0000000000"));
}
//Hold Results on screen
endTime = DateTime.Now;
elpasedMilliseconds = ((TimeSpan)(endTime - startTime)).TotalMilliseconds;
Console.WriteLine("Task took " + elpasedMilliseconds.ToString("#0.00") + " ms.");
//ExportBuild("22bn");
}
//Exports current enviornment to a text file which includes: component reliabilities and correlations
static void ExportBuild(string file_name)
{
string path = @"Z:\" + file_name + ".txt";
string components = "{";
string correlations_string = "{";
double [] correlations = correlations_matrix.ToColumnMajorArray();
//Start File
File.AppendAllLines(path, new [] {file_name + "Build", "Component Reliabilities:"});
//Loop through component reliabilities
for (int i = 0; i < component_reliabilities.Count(); i++)
{
if (i == component_reliabilities.Count() - 1)
components += component_reliabilities[i].ToString("#0.00000") + " }";
else
components += component_reliabilities[i].ToString("#0.00000") + ", ";
}
//Append components
File.AppendAllLines(path, new [] {components, "Correlations:"});
//Loop through correlations
for (int i = 0; i < correlations.Count(); i++)
{
if (i == correlations.Count() - 1)
correlations_string += correlations[i].ToString("#0.00000") + " }";
else if (i % number == 0)
correlations_string += correlations[i].ToString("#0.00000") + ",\n";
else
correlations_string += correlations[i].ToString("#0.00000") + ", ";
}
//Append correlations
File.AppendAllLines(path, new [] {correlations_string});
}
//Function which uses a Random Number Generator and a data set to sample from the data set and generate a double within the bounds of the sample
static double PseudoSample(double[] data)
{
Random r = new Random(); //Random Number Generator to choose random correlations from the data set
int a; //Temp variable to hold random number between 1-162 (used in correlation generation)
double b1,b2,result; //Temp variables to hold bounds for random number generation when generating correlations
a = r.Next(1,data.Count()); //Generate random number between 1-162
if (a != data.Count() - 1) //If index does not overflow set b1 and b2 using increment
{
b1 = data[a];
b2 = data[a+1];
}
else //Else set b1 and b2 using decrement
{
b1 = data[a-1];
b2 = data[a];
}
result = r.NextDouble() * (b2-b1) + b1; //Generate random double between b1 and b2
return result;
}
//First Coverage Test Function which tests a 2o3 enviornment with random reliabilities and correlations within the theoretical bounds
static void CoverageTest1(string system, int runs)
{
Random r = new Random(); //Random Number Generator to generate reliabilities
int success = 0; //Initialize success counter to zero
Build(system); //Import cuts and paths of system as well as set number of components
for (int i = 0; i < runs; i++) //Loop for the appropriate number of test runs
{
Console.WriteLine(i);
Bm.Clear(); //Clear B matrix and reinitialize the vector with 2 placeholders
Bm.Add(new double[] {0});
Bm.Add(new double[] {0});
GenerateComponents(0.001, 0.999); //Generate n random reliabilities
GenerateCorrelations(); //Generate correlations within the theoretical bounds
GenerateSigma(); //Generate Sigma values for use in B matrix
//Clear out list of previous conditional and total probability errors
ConditionalPErrors.Clear();
TotalPErrors.Clear();
//Enumerate Tree
FindReliability();
//Check to see if there were any errors when enumerating the tree, if there were no errors increment success
if (ConditionalPErrors.Count == 0 && TotalPErrors.Count == 0)
success++;
}
double success_rate = (double)success / (double)runs;
Console.WriteLine("Coverage Test 1:\n" + success + " successful enumerations after " + runs + " test runs");
Console.WriteLine("Success Rate: " + success_rate);
}
//Second Coverage test which tests a 2o3 enviornment sampling reliabilties from a beta distribution and sampling correlations from previous data set
static void CoverageTest2(string system, int runs, bool correction = true)
{
bool fail = false; //Fail flag for non-correction method
int r,c_index,sum = 0; //Row index and correlations index used in transposing correaltions into the c array
double[] correlations; //Generated correlation values
double[] c; //Temp variable used in correlation matrix construction
int success = 0; //Initialize success counter to zero
Build(system); //Import cuts and paths of system as well as set number of components
//Create Beta Distribution with alpha = 1000 and beta = 2, add 10,000 samples to double array and compute average
Beta beta = new Beta(1000,2);
double[] samples = new double[number*runs];
beta.Samples(samples);
double average = samples.Average();
//Make sure average of beta distribution is within the bounds
if (average < 0.997 || average > 0.999)
{
Console.WriteLine("Beta Distribution Error: Average sample = " + average.ToString("#.######"));
return;
}
//Correlation data set
double[] data_set = new double[] {-0.000832051, -0.00077379, -0.000700997, -0.000556345, -0.000551149, -0.000546957, -0.00046025, -0.000377824, -0.000334054, -0.00032533, -0.00030337, -0.000289878, -0.000269457, -0.000250505, -0.000222839, -0.000216432, -0.000192773, -0.000172419, -0.000171405, -0.000150472, -0.00014154, -0.000139644, -0.000136932, -0.00013589, -0.000119422, -0.000118307, -0.000117407, -0.0000959645, -0.0000903688, -0.0000808274, -0.000078077, -0.0000753715, -0.0000717061, -0.0000698334, -0.0000678329, -0.000066352, -0.0000651196, -0.0000573269, -0.0000523427, -0.0000432869, -0.0000420424, -0.0000359503, -0.0000332959, -0.0000292295, -0.0000229813, -0.0000228065, -0.0000168529, -0.0000151666, -0.0000145606, -0.0000139291, -0.0000135653, -0.0000126496, -0.0000111359, -0.00000282844, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0000193941, 0.000506082, 0.00114057, 0.00117882, 0.00171039, 0.00185772, 0.00209051, 0.00232217, 0.00238901, 0.0031334, 0.00338147, 0.00348186, 0.00396074, 0.00484534, 0.00636997, 0.00709894, 0.00750422, 0.011968, 0.0140486, 0.0187122, 0.0384815, 0.0503591, 0.0794512, 0.0862146, 0.0981174, 0.120224, 0.136748, 0.167731, 0.198908, 0.205563, 0.220539, 0.227669, 0.407697, 0.441613, 0.530991, 0.58726};
for (int i = 0; i < runs; i++) //Loop for the appropriate number of test runs
{
Console.WriteLine(i);
//Reinitalize fail flag for non-correction method
fail = false;
//Clear B matrix and reinitialize the vector with 2 placeholders
Bm.Clear();
Bm.Add(new double[] {0});
Bm.Add(new double[] {0});
//Clear component reliabilities and correaltions then add n samples as component reliabilities
component_reliabilities = new double[number];
for (int j = 0; j < number; j++)
component_reliabilities[j] = samples[number*i+j];
//Generate correlation bounds
List<CorrelationPairs> bounds = CorrelationBounds();
correlations = new double[bounds.Count()];
//Continue generating correlations using data set as reference until all correlations are within theoretical bounds
if (correction)
{
for (int j = 0; j < bounds.Count(); j++)
{
//Generate correaltion value using data set, then repeat if outside theoretical bounds
correlations[j] = PseudoSample(data_set);
if (correlations[j] > bounds[j].max || correlations[j] < bounds[j].min)
j--;
}
}
//Otherwise generate correlations and fail iteration if a correlation is outside theoretical bounds
else
{
for (int j = 0; j < bounds.Count(); j++)
{
correlations[j] = PseudoSample(data_set);
if (correlations[j] > bounds[j].max || correlations[j] < bounds[j].min)
{
fail = true;
break;
}
}
if (fail)
continue;
}
//Enter correlations into a double array then generate matrix
c = new double[number*number];
r = 0;
c_index = 0;
for (int j = 0; j < number*number;)
{
//Initialize summation
sum = r-1;
//Enter previous correlations at r > k
for (int k = 0; k < r; k++)
{
if(k == 0)
c[j++] = correlations[r-1];
else
{
c[j++] = correlations[(sum)+(number-k-1)];
sum += (number - k - 1);
}
}
//Enter correlation of 1 at r = k
c[j++] = 1;
//Enter new correlations at r < k
while (j % number != 0)
c[j++] = correlations[c_index++];
//Increment row index
r++;
}
correlations_matrix = Matrix<double>.Build.Dense(number,number,c);
GenerateSigma(); //Generate Sigma values for use in B matrix
//Clear out list of previous conditional and total probability errors
ConditionalPErrors.Clear();
TotalPErrors.Clear();
//Enumerate Tree
FindReliability();
//Check to see if there were any errors when enumerating the tree, if there were no errors increment success
if (ConditionalPErrors.Count == 0 && TotalPErrors.Count == 0)
success++;
}
double success_rate = (double)success / (double)runs;
if (correction)
Console.WriteLine("Coverage Test 2 with Correction:\n" + success + " successful enumerations after " + runs + " test runs");
else
Console.WriteLine("Coverage Test 2 without Correction:\n" + success + " successful enumerations after " + runs + " test runs");
Console.WriteLine("Success Rate: " + success_rate);
}
static List<int[]> WolframPerms(List<int[]> perms)
{
List<int> temp = new List<int>();
List<int[]> newList = new List<int[]>();
foreach(int[] i in perms)
{
temp.Clear();
for(int j = 0; j < i.Length; j++)
{
if(i[j] == 1)
temp.Add(j+1);
}
newList.Add(temp.ToArray());
}
return newList;
}
//Function which builds the appropriate component network based on input string (does not generate b vectors only intializes)
static void Build(string s)
{
double[] correlations;
Bm.Clear();
Bm.Add(new double[] {0});
Bm.Add(new double[] {0});
CS.Clear();
PS.Clear();
switch (s)
{
case "2s": //2 component series
number = 2;
component_reliabilities = new double[] {0.8, 0.75};
/* correlations = new double[] { 1.00, -0.28,
-0.28, 1.00}; */
correlations = new double[] { 1.0000000, 0.1377770,
0.1377770, 1.0000000};
correlations_matrix = Matrix<double>.Build.Dense(2,2,correlations);
GenerateSigma();
CS.Add(new int[] {1});
CS.Add(new int[] {2});
PS.Add(new int[] {1,2});
break;
case "2p": //2 component parallel
number = 2;
component_reliabilities = new double[] {0.8, 0.75};
/* correlations = new double[] { 1.00, -0.28,
-0.28, 1.00}; */
correlations = new double[] { 1.0000000, 0.1377770,
0.1377770, 1.0000000};
correlations_matrix = Matrix<double>.Build.Dense(2,2,correlations);
GenerateSigma();
CS.Add(new int[] {1,2});
PS.Add(new int[] {1});
PS.Add(new int[] {2});
break;
case "3s": //3 component series
number = 3;
component_reliabilities = new double[] {0.8, 0.75, 0.7};
/* correlations = new double[] { 1.00, -0.28, 0.1,
-0.28, 1.00, 0.2,
0.1, 0.2, 1.00}; */
correlations = new double[] { 1.0000000, 0.1377770, 0.0326228,
0.1377770, 1.0000000, 0.1108590,
0.0326228, 0.1108590, 1.0000000};
correlations_matrix = Matrix<double>.Build.Dense(3,3,correlations);
GenerateSigma();
CS.Add(new int[] {1});
CS.Add(new int[] {2});
CS.Add(new int[] {3});
PS.Add(new int[] {1,2,3});
break;
case "3p": //3 component parallel
number = 3;
component_reliabilities = new double[] {0.8, 0.75, 0.7};
/* correlations = new double[] { 1.00, -0.28, 0.1,
-0.28, 1.00, 0.2,
0.1, 0.2, 1.00}; */
correlations = new double[] { 1.0000000, 0.1377770, 0.0326228,
0.1377770, 1.0000000, 0.1108590,
0.0326228, 0.1108590, 1.0000000};
correlations_matrix = Matrix<double>.Build.Dense(3,3,correlations);
GenerateSigma();
CS.Add(new int[] {1,2,3});
PS.Add(new int[] {1});
PS.Add(new int[] {2});
PS.Add(new int[] {3});
break;
case "4s": //4 component series
number = 4;
component_reliabilities = new double[] {0.8, 0.75, 0.7, 0.72};
/*correlations = new double[] { 1.00, -0.28, 0.1,-0.15,
-0.28, 1.00, 0.2, 0.30,
0.1, 0.2, 1.00, 0.32,
-0.15, 0.30, 0.32, 1.00};*/
correlations = new double[] { 1.0000000, 0.1377770, 0.0326228, 0.0719920,
0.1377770, 1.0000000, 0.1108590, 0.0981194,
0.0326228, 0.1108590, 1.0000000, 0.0873844,
0.0719920, 0.0981194, 0.0873844, 1.0000000};
correlations_matrix = Matrix<double>.Build.Dense(4,4,correlations);
GenerateSigma();
CS.Add(new int[] {1});
CS.Add(new int[] {2});
CS.Add(new int[] {3});
CS.Add(new int[] {4});
PS.Add(new int[] {1,2,3,4});
break;
case "4p": //4 component parallel
number = 4;
component_reliabilities = new double[] {0.8, 0.75, 0.7, 0.72};
/*correlations = new double[] { 1.00, -0.28, 0.1,-0.15,
-0.28, 1.00, 0.2, 0.30,
0.1, 0.2, 1.00, 0.32,
-0.15, 0.30, 0.32, 1.00};*/
correlations = new double[] { 1.0000000, 0.1377770, 0.0326228, 0.0719920,
0.1377770, 1.0000000, 0.1108590, 0.0981194,
0.0326228, 0.1108590, 1.0000000, 0.0873844,
0.0719920, 0.0981194, 0.0873844, 1.0000000};
correlations_matrix = Matrix<double>.Build.Dense(4,4,correlations);
GenerateSigma();
CS.Add(new int[] {1,2,3,4});
PS.Add(new int[] {1});
PS.Add(new int[] {2});
PS.Add(new int[] {3});
PS.Add(new int[] {4});
break;
case "5s": //5 component series
number = 5;
component_reliabilities = new double[] {0.8, 0.75, 0.7, 0.72, 0.73};
/*correlations = new double[] { 1.00, -0.28, 0.1,-0.15, 0.15,
-0.28, 1.00, 0.2, 0.30,-0.15,
0.1, 0.2, 1.00, 0.32, 0.50,
-0.15, 0.30, 0.32, 1.00,-0.22,
0.15, -0.15, 0.50,-0.22, 1.00};*/
correlations = new double[] { 1.0000000, 0.1377770, 0.0326228, 0.0719920, -0.0486818,
0.1377770, 1.0000000, 0.1108590, 0.0981194, 0.1800180,
0.0326228, 0.1108590, 1.0000000, 0.0873844, 0.1303380,
0.0719920, 0.0981194, 0.0873844, 1.0000000, 0.0248845,
-0.0486818, 0.1800180, 0.1303380, 0.0248845, 1.0000000};
correlations_matrix = Matrix<double>.Build.Dense(5,5,correlations);
GenerateSigma();
CS.Add(new int[] {1});
CS.Add(new int[] {2});
CS.Add(new int[] {3});
CS.Add(new int[] {4});
CS.Add(new int[] {5});
PS.Add(new int[] {1,2,3,4,5});
break;
case "5p": //5 component parallel
number = 5;
component_reliabilities = new double[] {0.8, 0.75, 0.7, 0.72, 0.73};
/*correlations = new double[] { 1.00, -0.28, 0.1,-0.15, 0.15,
-0.28, 1.00, 0.2, 0.30,-0.15,
0.1, 0.2, 1.00, 0.32, 0.50,
-0.15, 0.30, 0.32, 1.00,-0.22,
0.15, -0.15, 0.50,-0.22, 1.00};*/
correlations = new double[] { 1.0000000, 0.1377770, 0.0326228, 0.0719920, -0.0486818,
0.1377770, 1.0000000, 0.1108590, 0.0981194, 0.1800180,
0.0326228, 0.1108590, 1.0000000, 0.0873844, 0.1303380,
0.0719920, 0.0981194, 0.0873844, 1.0000000, 0.0248845,
-0.0486818, 0.1800180, 0.1303380, 0.0248845, 1.0000000};
correlations_matrix = Matrix<double>.Build.Dense(5,5,correlations);
GenerateSigma();
CS.Add(new int[] {1,2,3,4,5});
PS.Add(new int[] {1});
PS.Add(new int[] {2});
PS.Add(new int[] {3});
PS.Add(new int[] {4});
PS.Add(new int[] {5});
break;
case "6s": //6 component series
number = 6;
component_reliabilities = new double[] {0.8, 0.75, 0.7, 0.72, 0.73, 0.77};
/*correlations = new double[] { 1.00, -0.28, 0.1,-0.15, 0.15, 0.05,
-0.28, 1.00, 0.2, 0.30,-0.15,-0.20,
0.1, 0.2, 1.00, 0.32, 0.50,-0.30,
-0.15, 0.30, 0.32, 1.00,-0.22, 0.20,
0.15, -0.15, 0.50,-0.22, 1.00, 0.25,
0.05, -0.20, -0.30, 0.20, 0.25, 1.00};*/
correlations = new double[] { 1.0000000, 0.1377770, 0.0326228, 0.071992000, -0.04868180, 0.09131980,
0.1377770, 1.0000000, 0.1108590, 0.098119400, 0.18001800, 0.01634070,
0.0326228, 0.1108590, 1.0000000, 0.087384400, 0.13033800, 0.11618600,
0.0719920, 0.0981194, 0.0873844, 1.000000000, 0.02488450,-0.03212350,
-0.0486818, 0.1800180, 0.1303380, 0.024884500, 1.00000000,-0.00696747,
0.0913198, 0.0163407, 0.1161860,-0.032123500, -0.00696747, 1.00000000};
correlations_matrix = Matrix<double>.Build.Dense(6,6,correlations);
GenerateSigma();
PS.Add(new int[] {1,2,3,4,5,6});
CS.Add(new int[] {1});
CS.Add(new int[] {2});
CS.Add(new int[] {3});
CS.Add(new int[] {4});
CS.Add(new int[] {5});
CS.Add(new int[] {6});
break;
case "6p": //6 component parallel
number = 6;
component_reliabilities = new double[] {0.8, 0.75, 0.7, 0.72, 0.73, 0.77};
/*correlations = new double[] { 1.00, -0.28, 0.1,-0.15, 0.15, 0.05,
-0.28, 1.00, 0.2, 0.30,-0.15,-0.20,
0.1, 0.2, 1.00, 0.32, 0.50,-0.30,
-0.15, 0.30, 0.32, 1.00,-0.22, 0.20,
0.15, -0.15, 0.50,-0.22, 1.00, 0.25,
0.05, -0.20, -0.30, 0.20, 0.25, 1.00};*/
correlations = new double[] { 1.0000000, 0.1377770, 0.0326228, 0.071992000, -0.04868180, 0.09131980,
0.1377770, 1.0000000, 0.1108590, 0.098119400, 0.18001800, 0.01634070,
0.0326228, 0.1108590, 1.0000000, 0.087384400, 0.13033800, 0.11618600,
0.0719920, 0.0981194, 0.0873844, 1.000000000, 0.02488450,-0.03212350,
-0.0486818, 0.1800180, 0.1303380, 0.024884500, 1.00000000,-0.00696747,
0.0913198, 0.0163407, 0.1161860,-0.032123500, -0.00696747, 1.00000000};
correlations_matrix = Matrix<double>.Build.Dense(6,6,correlations);
GenerateSigma();
CS.Add(new int[] {1,2,3,4,5,6});
PS.Add(new int[] {1});
PS.Add(new int[] {2});
PS.Add(new int[] {3});
PS.Add(new int[] {4});
PS.Add(new int[] {5});
PS.Add(new int[] {6});
break;
case "7s": //7 component series
number = 7;
component_reliabilities = new double[] {0.8, 0.75, 0.7, 0.72, 0.73, 0.77, 0.67};
/*correlations = new double[] { 1.00, -0.28, 0.1,-0.15, 0.15, 0.05,-0.23,
-0.28, 1.00, 0.2, 0.30,-0.15,-0.20, 0.16,
0.1, 0.2, 1.00, 0.32, 0.50,-0.30, 0.17,
-0.15, 0.30, 0.32, 1.00,-0.22, 0.20,-0.30,
0.15, -0.15, 0.50,-0.22, 1.00, 0.25,-0.16,
0.05, -0.20, -0.30, 0.20, 0.25, 1.00, 0.27,
-0.23, 0.16, 0.17,-0.30,-0.16, 0.27, 1.00};*/
correlations = new double[] { 1.0000000, 0.1377770, 0.0326228, 0.071992000, -0.04868180, 0.09131980, -0.066384200,
0.1377770, 1.0000000, 0.1108590, 0.098119400, 0.18001800, 0.01634070, -0.059739400,
0.0326228, 0.1108590, 1.0000000, 0.087384400, 0.13033800, 0.11618600, -0.056192500,
0.0719920, 0.0981194, 0.0873844, 1.000000000, 0.02488450,-0.03212350, -0.000253982,
-0.0486818, 0.1800180, 0.1303380, 0.024884500, 1.00000000,-0.00696747, 0.127017000,
0.0913198, 0.0163407, 0.1161860,-0.032123500, -0.00696747, 1.00000000, 0.014421100,
-0.0663842,-0.0597394,-0.0561925,-0.000253982, 0.12701700, 0.01442110, 1.000000000};
correlations_matrix = Matrix<double>.Build.Dense(7,7,correlations);
GenerateSigma();
PS.Add(new int[] {1,2,3,4,5,6,7});
CS.Add(new int[] {1});
CS.Add(new int[] {2});
CS.Add(new int[] {3});
CS.Add(new int[] {4});
CS.Add(new int[] {5});
CS.Add(new int[] {6});
CS.Add(new int[] {7});
break;
case "7p": //7 component parallel
number = 7;
component_reliabilities = new double[] {0.8, 0.75, 0.7, 0.72, 0.73, 0.77, 0.67};
/*correlations = new double[] { 1.00, -0.28, 0.1,-0.15, 0.15, 0.05,-0.23,
-0.28, 1.00, 0.2, 0.30,-0.15,-0.20, 0.16,
0.1, 0.2, 1.00, 0.32, 0.50,-0.30, 0.17,
-0.15, 0.30, 0.32, 1.00,-0.22, 0.20,-0.30,
0.15, -0.15, 0.50,-0.22, 1.00, 0.25,-0.16,
0.05, -0.20, -0.30, 0.20, 0.25, 1.00, 0.27,
-0.23, 0.16, 0.17,-0.30,-0.16, 0.27, 1.00};*/
correlations = new double[] { 1.0000000, 0.1377770, 0.0326228, 0.071992000, -0.04868180, 0.09131980, -0.066384200,
0.1377770, 1.0000000, 0.1108590, 0.098119400, 0.18001800, 0.01634070, -0.059739400,
0.0326228, 0.1108590, 1.0000000, 0.087384400, 0.13033800, 0.11618600, -0.056192500,
0.0719920, 0.0981194, 0.0873844, 1.000000000, 0.02488450,-0.03212350, -0.000253982,
-0.0486818, 0.1800180, 0.1303380, 0.024884500, 1.00000000,-0.00696747, 0.127017000,
0.0913198, 0.0163407, 0.1161860,-0.032123500, -0.00696747, 1.00000000, 0.014421100,
-0.0663842,-0.0597394,-0.0561925,-0.000253982, 0.12701700, 0.01442110, 1.000000000};
correlations_matrix = Matrix<double>.Build.Dense(7,7,correlations);
GenerateSigma();
CS.Add(new int[] {1,2,3,4,5,6,7});
PS.Add(new int[] {1});
PS.Add(new int[] {2});
PS.Add(new int[] {3});
PS.Add(new int[] {4});
PS.Add(new int[] {5});
PS.Add(new int[] {6});
PS.Add(new int[] {7});
break;
case "8s": //8 component series
number = 8;
component_reliabilities = new double[] {0.8, 0.75, 0.7, 0.72, 0.73, 0.77, 0.67,0.5};
/* correlations = new double[] { 1.00, -0.28, 0.1,-0.15, 0.15, 0.05,-0.23, 0.22,
-0.28, 1.00, 0.2, 0.30,-0.15,-0.20, 0.16,-0.16,
0.1, 0.2, 1.00, 0.32, 0.50,-0.30, 0.17, 0.07,
-0.15, 0.30, 0.32, 1.00,-0.22, 0.20,-0.30, 0.25,
0.15, -0.15, 0.50,-0.22, 1.00, 0.25,-0.16, 0.10,
0.05, -0.20, -0.30, 0.20, 0.25, 1.00, 0.27,-0.07,
-0.23, 0.16, 0.17,-0.30,-0.16, 0.27, 1.00, 0.35,
0.22, -0.16, 0.07, 0.25, 0.10,-0.07, 0.35, 1.00}; */
correlations = new double[] { 1.0000000, 0.1377770, 0.0326228, 0.071992000, -0.04868180, 0.09131980, -0.066384200, 0.0178629,
0.1377770, 1.0000000, 0.1108590, 0.098119400, 0.18001800, 0.01634070, -0.059739400,-0.0346766,
0.0326228, 0.1108590, 1.0000000, 0.087384400, 0.13033800, 0.11618600, -0.056192500,-0.0402154,
0.0719920, 0.0981194, 0.0873844, 1.000000000, 0.02488450,-0.03212350, -0.000253982, 0.0286271,
-0.0486818, 0.1800180, 0.1303380, 0.024884500, 1.00000000,-0.00696747, 0.127017000,-0.0166433,
0.0913198, 0.0163407, 0.1161860,-0.032123500, -0.00696747, 1.00000000, 0.014421100,-0.0140690,
-0.0663842,-0.0597394,-0.0561925,-0.000253982, 0.12701700, 0.01442110, 1.000000000,-0.0305813,
0.0178629,-0.0346766,-0.0402154, 0.028627100, -0.01664330, -0.0140690, -0.030581300, 1.0000000};
correlations_matrix = Matrix<double>.Build.Dense(8,8,correlations);
GenerateSigma();
PS.Add(new int[] {1,2,3,4,5,6,7,8});
CS.Add(new int[] {1});
CS.Add(new int[] {2});
CS.Add(new int[] {3});
CS.Add(new int[] {4});
CS.Add(new int[] {5});
CS.Add(new int[] {6});
CS.Add(new int[] {7});
CS.Add(new int[] {8});
break;
case "8p": //8 component parallel
number = 8;
component_reliabilities = new double[] {0.8, 0.75, 0.7, 0.72, 0.73, 0.77, 0.67,0.5};
/* correlations = new double[] { 1.00, -0.28, 0.1,-0.15, 0.15, 0.05,-0.23, 0.22,
-0.28, 1.00, 0.2, 0.30,-0.15,-0.20, 0.16,-0.16,
0.1, 0.2, 1.00, 0.32, 0.50,-0.30, 0.17, 0.07,
-0.15, 0.30, 0.32, 1.00,-0.22, 0.20,-0.30, 0.25,
0.15, -0.15, 0.50,-0.22, 1.00, 0.25,-0.16, 0.10,
0.05, -0.20, -0.30, 0.20, 0.25, 1.00, 0.27,-0.07,
-0.23, 0.16, 0.17,-0.30,-0.16, 0.27, 1.00, 0.35,
0.22, -0.16, 0.07, 0.25, 0.10,-0.07, 0.35, 1.00};*/
correlations = new double[] { 1.0000000, 0.1377770, 0.0326228, 0.071992000, -0.04868180, 0.09131980, -0.066384200, 0.0178629,
0.1377770, 1.0000000, 0.1108590, 0.098119400, 0.18001800, 0.01634070, -0.059739400,-0.0346766,
0.0326228, 0.1108590, 1.0000000, 0.087384400, 0.13033800, 0.11618600, -0.056192500,-0.0402154,
0.0719920, 0.0981194, 0.0873844, 1.000000000, 0.02488450,-0.03212350, -0.000253982, 0.0286271,
-0.0486818, 0.1800180, 0.1303380, 0.024884500, 1.00000000,-0.00696747, 0.127017000,-0.0166433,
0.0913198, 0.0163407, 0.1161860,-0.032123500, -0.00696747, 1.00000000, 0.014421100,-0.0140690,
-0.0663842,-0.0597394,-0.0561925,-0.000253982, 0.12701700, 0.01442110, 1.000000000,-0.0305813,
0.0178629,-0.0346766,-0.0402154, 0.028627100, -0.01664330, -0.0140690, -0.030581300, 1.0000000};
correlations_matrix = Matrix<double>.Build.Dense(8,8,correlations);
GenerateSigma();
CS.Add(new int[] {1,2,3,4,5,6,7,8});
PS.Add(new int[] {1});
PS.Add(new int[] {2});
PS.Add(new int[] {3});
PS.Add(new int[] {4});
PS.Add(new int[] {5});
PS.Add(new int[] {6});
PS.Add(new int[] {7});
PS.Add(new int[] {8});
break;
case "5bn": //5 component bridge network
number = 5;
component_reliabilities = new double[] {0.8, 0.75, 0.7, 0.72, 0.73};
/*correlations = new double[] { 1.00, -0.28, 0.1,-0.15, 0.15,
-0.28, 1.00, 0.2, 0.30,-0.15,
0.1, 0.2, 1.00, 0.32, 0.50,
-0.15, 0.30, 0.32, 1.00,-0.22,
0.15, -0.15, 0.50,-0.22, 1.00};*/
correlations = new double[] { 1.0000000, 0.1377770, 0.0326228, 0.0719920, -0.0486818,
0.1377770, 1.0000000, 0.1108590, 0.0981194, 0.1800180,
0.0326228, 0.1108590, 1.0000000, 0.0873844, 0.1303380,
0.0719920, 0.0981194, 0.0873844, 1.0000000, 0.0248845,
-0.0486818, 0.1800180, 0.1303380, 0.0248845, 1.0000000};
correlations_matrix = Matrix<double>.Build.Dense(5,5,correlations);
GenerateSigma();
CS.Add(new int[] {1,2});
CS.Add(new int[] {4,5});
CS.Add(new int[] {1,3,5});
CS.Add(new int[] {2,3,4});
PS.Add(new int[] {1,4});
PS.Add(new int[] {2,3,4});
PS.Add(new int[] {2,5});
PS.Add(new int[] {1,3,5});
break;
case "10bn": //10 component bridge network
number = 10;
component_reliabilities = new double[] {0.97499, 0.99267, 0.97783, 0.95330, 0.95391, 0.95755, 0.97215, 0.98216, 0.99780, 0.99689};
correlations = new double[] {1.00000, 0.03505, 0.06065, 0.04038, 0.06685, 0.03315, 0.06523, 0.04131, -0.00012, 0.01537,
0.03505, 1.00000, 0.04604, 0.00359, 0.03011, 0.02811, 0.04971, 0.01770, 0.05030,
0.01026, 0.06065, 0.04604, 1.00000, 0.01324, 0.04172, 0.05361, -0.00036, 0.04143,
0.03017, 0.02362, 0.04038, 0.00359, 0.01324, 1.00000, 0.02539, 0.05066, 0.01900,
0.05321, 0.00434, 0.01259, 0.06685, 0.03011, 0.04172, 0.02539, 1.00000, 0.09488,
0.01285, 0.05671, 0.00744, -0.00002, 0.03315, 0.02811, 0.05361, 0.05066, 0.09488,
1.00000, 0.00497, 0.00014, 0.01566, 0.01765, 0.06523, 0.04971, -0.00036, 0.01900,
0.01285, 0.00497, 1.00000, 0.02312, 0.01378, 0.01076, 0.04131, 0.01770, 0.04143,
0.05321, 0.05671, 0.00014, 0.02312, 1.00000, 0.02180, 0.02158, -0.00012, 0.05030,
0.03017, 0.00434, 0.00744, 0.01566, 0.01378, 0.02180, 1.00000, 0.08048, 0.01537,
0.01026, 0.02362, 0.01259, -0.00002, 0.01765, 0.01076, 0.02158, 0.08048, 1.00000};
correlations_matrix = Matrix<double>.Build.Dense(10,10,correlations);
GenerateSigma();
CS.Add(new int[] {1,3}); CS.Add(new int[] {1,4}); CS.Add(new int[] {2,3}); CS.Add(new int[] {2,4});
CS.Add(new int[] {7,9}); CS.Add(new int[] {7,10}); CS.Add(new int[] {8,9}); CS.Add(new int[] {8,10});
CS.Add(new int[] {1,5,9}); CS.Add(new int[] {1,6,9}); CS.Add(new int[] {1,5,10}); CS.Add(new int[] {1,6,10});
CS.Add(new int[] {2,5,9}); CS.Add(new int[] {2,6,9}); CS.Add(new int[] {2,5,10}); CS.Add(new int[] {2,6,10});
CS.Add(new int[] {3,6,7}); CS.Add(new int[] {3,5,7}); CS.Add(new int[] {3,6,8}); CS.Add(new int[] {3,5,8});
CS.Add(new int[] {4,6,7}); CS.Add(new int[] {4,5,7}); CS.Add(new int[] {4,6,8}); CS.Add(new int[] {4,5,8});
PS.Add(new int[] {1,2,7,8});
PS.Add(new int[] {3,4,9,10});
PS.Add(new int[] {1,2,5,6,9,10});
PS.Add(new int[] {3,4,6,5,7,8});
break;
case "20bn": //20 component bridge network
number = 20;
component_reliabilities = new double[] {0.96166, 0.98371, 0.96786, 0.97608, 0.95177, 0.96956, 0.99830, 0.97229,
0.96720, 0.98829, 0.97603, 0.96054, 0.98679, 0.99279, 0.97152, 0.95646, 0.96767, 0.98632, 0.97210, 0.99855};
correlations = new double[] {1.00000, 0.01477, 0.04543, -0.00060, 0.01613, 0.04260, 0.00018, 0.01548, 0.02258, 0.00666, 0.00835, 0.01386, 0.00335, 0.01451, 0.04165, 0.04061, 0.01109, 0.02162, 0.01295, 0.00284, 0.01477,
1.00000, 0.03031, 0.00887, 0.01092, -0.00113, 0.01444, 0.01415, 0.00724, 0.02365, 0.00455, 0.02643, 0.04128, 0.01151, 0.02741, 0.00375, 0.00777, 0.02480, 0.03120, 0.00376, 0.04543,
0.03031, 1.00000, 0.02775, 0.01510, 0.02799, 0.00847, 0.03712, 0.01322, 0.00403, 0.01615, 0.03089, 0.02642, 0.01666, 0.01649, 0.02856, 0.02703, 0.02585, 0.04178, 0.00318, -0.00060,
0.00887, 0.02775, 1.00000, 0.00549, 0.00168, 0.01311, 0.00445, -0.00119, 0.02509, 0.02376, 0.00881, 0.02446, 0.00919, 0.04029, 0.02029, 0.04226, 0.01627, 0.01878, 0.00029, 0.01613,
0.01092, 0.01510, 0.00549, 1.00000, -0.00179, 0.00036, 0.03469, 0.02953, 0.00148, 0.01384, 0.00341, 0.02131, 0.00912, 0.02561, 0.01730, 0.03398, 0.01956, 0.00426, 0.00279, 0.04260,
-0.00113, 0.02799, 0.00168, -0.00179, 1.00000, 0.00626, 0.03953, 0.03992, 0.00054, 0.02060, 0.03603, 0.00387, 0.01541, 0.03211, 0.00250, 0.02332, 0.00368, 0.04473, 0.00274, 0.00018,
0.01444, 0.00847, 0.01311, 0.00036, 0.00626, 1.00000, 0.00999, 0.00787, 0.00728, 0.00370, 0.00302, 0.01201, 0.01131, 0.01053, 0.00124, 0.00219, 0.01346, 0.01151, 0.00722, 0.01548,
0.01415, 0.03712, 0.00445, 0.03469, 0.03953, 0.00999, 1.00000, 0.02754, 0.00958, 0.01456, 0.02618, 0.01659, 0.01263, 0.04884, 0.01196, 0.03365, 0.00445, 0.01899, 0.01059, 0.02258,
0.00724, 0.01322, -0.00119, 0.02953, 0.03992, 0.00787, 0.02754, 1.00000, 0.00560, 0.03636, 0.01867, 0.00718, 0.01439, 0.02768, 0.01107, 0.00769, 0.01741, 0.03096, 0.01009, 0.00666,
0.02365, 0.00403, 0.02509, 0.00148, 0.00054, 0.00728, 0.00958, 0.00560, 1.00000, -0.00071, 0.01417, 0.02012, 0.01846, 0.02824, 0.01682, 0.01957, 0.02819, 0.00820, 0.00927, 0.00835,
0.00455, 0.01615, 0.02376, 0.01384, 0.02060, 0.00370, 0.01456, 0.03636, -0.00071, 1.00000, 0.02551, 0.01919, 0.00867, 0.01478, 0.01590, 0.04284, 0.02309, 0.04371, 0.01147, 0.01386,
0.02643, 0.03089, 0.00881, 0.00341, 0.03603, 0.00302, 0.02618, 0.01867, 0.01417, 0.02551, 1.00000, 0.00137, 0.01141, 0.04193, 0.01561, 0.00326, 0.02356, -0.00011, 0.00571, 0.00335,
0.04128, 0.02642, 0.02446, 0.02131, 0.00387, 0.01201, 0.01659, 0.00718, 0.02012, 0.01919, 0.00137, 1.00000, 0.01938, 0.02028, 0.01245, 0.02394, 0.02911, 0.03169, 0.00545, 0.01451,
0.01151, 0.01666, 0.00919, 0.00912, 0.01541, 0.01131, 0.01263, 0.01439, 0.01846, 0.00867, 0.01141, 0.01938, 1.00000, 0.00769, 0.00112, 0.00074, 0.00083, 0.00185, 0.01466, 0.04165,
0.02741, 0.01649, 0.04029, 0.02561, 0.03211, 0.01053, 0.04884, 0.02768, 0.02824, 0.01478, 0.04193, 0.02028, 0.00769, 1.00000, 0.00107, 0.02440, 0.00333, 0.01920, 0.00588, 0.04061,
0.00375, 0.02856, 0.02029, 0.01730, 0.00250, 0.00124, 0.01196, 0.01107, 0.01682, 0.01590, 0.01561, 0.01245, 0.00112, 0.00107, 1.00000, 0.01275, 0.00160, 0.03603, 0.00124, 0.01109,
0.00777, 0.02703, 0.04226, 0.03398, 0.02332, 0.00219, 0.03365, 0.00769, 0.01957, 0.04284, 0.00326, 0.02394, 0.00074, 0.02440, 0.01275, 1.00000, 0.01921, 0.03032, 0.00219, 0.02162,
0.02480, 0.02585, 0.01627, 0.01956, 0.00368, 0.01346, 0.00445, 0.01741, 0.02819, 0.02309, 0.02356, 0.02911, 0.00083, 0.00333, 0.00160, 0.01921, 1.00000, 0.02096, 0.00958, 0.01295,
0.03120, 0.04178, 0.01878, 0.00426, 0.04473, 0.01151, 0.01899, 0.03096, 0.00820, 0.04371, -0.00011, 0.03169, 0.00185, 0.01920, 0.03603, 0.03032, 0.02096, 1.00000, 0.00449, 0.00284,
0.00376, 0.00318, 0.00029, 0.00279, 0.00274, 0.00722, 0.01059, 0.01009, 0.00927, 0.01147, 0.00571, 0.00545, 0.01466, 0.00588, 0.00124, 0.00219, 0.00958, 0.00449, 1.00000};
correlations_matrix = Matrix<double>.Build.Dense(20,20,correlations);
GenerateSigma();
CS.Add(new int[] {1,5}); CS.Add(new int[] {1,6}); CS.Add(new int[] {1,7}); CS.Add(new int[] {1,8});
CS.Add(new int[] {2,5}); CS.Add(new int[] {2,6}); CS.Add(new int[] {2,7}); CS.Add(new int[] {2,8});
CS.Add(new int[] {3,5}); CS.Add(new int[] {3,6}); CS.Add(new int[] {3,7}); CS.Add(new int[] {3,8});
CS.Add(new int[] {4,5}); CS.Add(new int[] {4,6}); CS.Add(new int[] {4,7}); CS.Add(new int[] {4,8});
CS.Add(new int[] {16,17}); CS.Add(new int[] {16,18}); CS.Add(new int[] {16,19}); CS.Add(new int[] {16,20});
CS.Add(new int[] {15,17}); CS.Add(new int[] {15,18}); CS.Add(new int[] {15,19}); CS.Add(new int[] {15,20});
CS.Add(new int[] {14,17}); CS.Add(new int[] {14,18}); CS.Add(new int[] {14,19}); CS.Add(new int[] {14,20});
CS.Add(new int[] {13,17}); CS.Add(new int[] {13,18}); CS.Add(new int[] {13,19}); CS.Add(new int[] {13,20});
CS.Add(new int[] {1,9,17}); CS.Add(new int[] {1,9,18}); CS.Add(new int[] {1,9,19}); CS.Add(new int[] {1,9,20});
CS.Add(new int[] {1,10,17}); CS.Add(new int[] {1,10,18}); CS.Add(new int[] {1,10,19}); CS.Add(new int[] {1,10,20});
CS.Add(new int[] {1,11,17}); CS.Add(new int[] {1,11,18}); CS.Add(new int[] {1,11,19}); CS.Add(new int[] {1,11,20});
CS.Add(new int[] {1,12,17}); CS.Add(new int[] {1,12,18}); CS.Add(new int[] {1,12,19}); CS.Add(new int[] {1,12,20});
CS.Add(new int[] {5,9,13}); CS.Add(new int[] {5,9,14}); CS.Add(new int[] {5,9,15}); CS.Add(new int[] {5,9,16});
CS.Add(new int[] {5,10,13}); CS.Add(new int[] {5,10,14}); CS.Add(new int[] {5,10,15}); CS.Add(new int[] {5,10,16});
CS.Add(new int[] {5,11,13}); CS.Add(new int[] {5,11,14}); CS.Add(new int[] {5,11,15}); CS.Add(new int[] {5,11,16});
CS.Add(new int[] {5,12,13}); CS.Add(new int[] {5,12,14}); CS.Add(new int[] {5,12,15}); CS.Add(new int[] {5,12,16});
CS.Add(new int[] {2,9,17}); CS.Add(new int[] {2,9,18}); CS.Add(new int[] {2,9,19}); CS.Add(new int[] {2,9,20});
CS.Add(new int[] {2,10,17}); CS.Add(new int[] {2,10,18}); CS.Add(new int[] {2,10,19}); CS.Add(new int[] {2,10,20});
CS.Add(new int[] {2,11,17}); CS.Add(new int[] {2,11,18}); CS.Add(new int[] {2,11,19}); CS.Add(new int[] {2,11,20});
CS.Add(new int[] {2,12,17}); CS.Add(new int[] {2,12,18}); CS.Add(new int[] {2,12,19}); CS.Add(new int[] {2,12,20});
CS.Add(new int[] {6,9,13}); CS.Add(new int[] {6,9,14}); CS.Add(new int[] {6,9,15}); CS.Add(new int[] {6,9,16});
CS.Add(new int[] {6,10,13}); CS.Add(new int[] {6,10,14}); CS.Add(new int[] {6,10,15}); CS.Add(new int[] {6,10,16});
CS.Add(new int[] {6,11,13}); CS.Add(new int[] {6,11,14}); CS.Add(new int[] {6,11,15}); CS.Add(new int[] {6,11,16});
CS.Add(new int[] {6,12,13}); CS.Add(new int[] {6,12,14}); CS.Add(new int[] {6,12,15}); CS.Add(new int[] {6,12,16});
CS.Add(new int[] {3,9,17}); CS.Add(new int[] {3,9,18}); CS.Add(new int[] {3,9,19}); CS.Add(new int[] {3,9,20});
CS.Add(new int[] {3,10,17}); CS.Add(new int[] {3,10,18}); CS.Add(new int[] {3,10,19}); CS.Add(new int[] {3,10,20});
CS.Add(new int[] {3,11,17}); CS.Add(new int[] {3,11,18}); CS.Add(new int[] {3,11,19}); CS.Add(new int[] {3,11,20});
CS.Add(new int[] {3,12,17}); CS.Add(new int[] {3,12,18}); CS.Add(new int[] {3,12,19}); CS.Add(new int[] {3,12,20});
CS.Add(new int[] {4,9,17}); CS.Add(new int[] {4,9,18}); CS.Add(new int[] {4,9,19}); CS.Add(new int[] {4,9,20});
CS.Add(new int[] {4,10,17}); CS.Add(new int[] {4,10,18}); CS.Add(new int[] {4,10,19}); CS.Add(new int[] {4,10,20});
CS.Add(new int[] {4,11,17}); CS.Add(new int[] {4,11,18}); CS.Add(new int[] {4,11,19}); CS.Add(new int[] {4,11,20});
CS.Add(new int[] {4,12,17}); CS.Add(new int[] {4,12,18}); CS.Add(new int[] {4,12,19}); CS.Add(new int[] {4,12,20});
CS.Add(new int[] {7,9,13}); CS.Add(new int[] {7,9,14}); CS.Add(new int[] {7,9,15}); CS.Add(new int[] {7,9,16});
CS.Add(new int[] {7,10,13}); CS.Add(new int[] {7,10,14}); CS.Add(new int[] {7,10,15}); CS.Add(new int[] {7,10,16});
CS.Add(new int[] {7,11,13}); CS.Add(new int[] {7,11,14}); CS.Add(new int[] {7,11,15}); CS.Add(new int[] {7,11,16});
CS.Add(new int[] {7,12,13}); CS.Add(new int[] {7,12,14}); CS.Add(new int[] {7,12,15}); CS.Add(new int[] {7,12,16});
CS.Add(new int[] {8,9,13}); CS.Add(new int[] {8,9,14}); CS.Add(new int[] {8,9,15}); CS.Add(new int[] {8,9,16});
CS.Add(new int[] {8,10,13}); CS.Add(new int[] {8,10,14}); CS.Add(new int[] {8,10,15}); CS.Add(new int[] {8,10,16});
CS.Add(new int[] {8,11,13}); CS.Add(new int[] {8,11,14}); CS.Add(new int[] {8,11,15}); CS.Add(new int[] {8,11,16});
CS.Add(new int[] {8,12,13}); CS.Add(new int[] {8,12,14}); CS.Add(new int[] {8,12,15}); CS.Add(new int[] {8,12,16});
PS.Add(new int[] {1,2,3,4,13,14,15,16});
PS.Add(new int[] {5,6,7,8,17,18,19,20});
PS.Add(new int[] {1,2,3,4,9,10,11,12,17,18,19,20});
PS.Add(new int[] {5,6,7,8,12,11,10,9,13,14,15,16});
break;
case "22bn":
number = 22;
component_reliabilities = new double[] {0.98671, 0.88780, 0.86846, 0.99231, 0.97476, 0.89183, 0.97980, 0.96316, 0.92800, 0.96436, 0.94459, 0.87680, 0.91635, 0.91582, 0.87922, 0.94138, 0.98290, 0.88984, 0.89236, 0.92153, 0.91587, 0.96817};
correlations = new double [] {1.00000, -0.00025, 0.00105, 0.00169, 0.00447, 0.00174, 0.00568, 0.00415, 0.00210, 0.00452, 0.00172, 0.00302, 0.00064, 0.00354, -0.00029, 0.00453, 0.00511, 0.00077, 0.00143, 0.00368, 0.00116, 0.00107, -0.00025,
1.00000, 0.00016, 0.00023, 0.00430, 0.00403, 0.00366, 0.00448, 0.00133, 0.00087, 0.00397, 0.00501, -0.00100, 0.00457, 0.00329, 0.00558, 0.00030, 0.00131, 0.00605, 0.00323, 0.00614, 0.00176, 0.00105,
0.00016, 1.00000, 0.00214, -0.00048, 0.00015, 0.00355, 0.00218, -0.00042, 0.00140, 0.00408, 0.00210, 0.00452, -0.00019, 0.00801, 0.00544, 0.00001, 0.00798, 0.00113, 0.00126, 0.00019, 0.00282, 0.00169,
0.00023, 0.00214, 1.00000, 0.00476, 0.00096, 0.00165, 0.00043, 0.00250, 0.00444, 0.00228, 0.00103, 0.00044, 0.00225, 0.00064, 0.00223, 0.00007, 0.00020, 0.00237, 0.00052, 0.00010, 0.00009, 0.00447,
0.00430, -0.00048, 0.00476, 1.00000, 0.00455, 0.00864, 0.00684, 0.00240, 0.00457, 0.00618, 0.00425, 0.00228, 0.00035, 0.00296, 0.00156, 0.00752, 0.00427, 0.00438, 0.00258, 0.00418, 0.00774, 0.00174,
0.00403, 0.00015, 0.00096, 0.00455, 1.00000, 0.00399, 0.00354, 0.00713, 0.00143, 0.00693, 0.00782, 0.00452, 0.00047, 0.00841, 0.00686, 0.00371, -0.00030, 0.00642, 0.00768, 0.00770, 0.00394, 0.00568,
0.00366, 0.00355, 0.00165, 0.00864, 0.00399, 1.00000, 0.00118, 0.00122, 0.00115, 0.00480, 0.00128, 0.00416, 0.00138, 0.00007, 0.00166, 0.00756, 0.00375, 0.00052, 0.00119, 0.00397, 0.00307, 0.00415,
0.00448, 0.00218, 0.00043, 0.00684, 0.00354, 0.00118, 1.00000, 0.00055, 0.00189, 0.00212, 0.00505, 0.00342, 0.00090, 0.00354, 0.00775, 0.00050, 0.00096, 0.00122, 0.00419, 0.00625, -0.00026, 0.00210,
0.00133, -0.00042, 0.00250, 0.00240, 0.00713, 0.00122, 0.00055, 1.00000, 0.00239, 0.00366, 0.00569, 0.00308, 0.00053, 0.00538, 0.00569, 0.00130, 0.00779, 0.00316, 0.00007, 0.00236, 0.00487, 0.00452,
0.00087, 0.00140, 0.00444, 0.00457, 0.00143, 0.00115, 0.00189, 0.00239, 1.00000, -0.00040, 0.00028, 0.00590, 0.00185, 0.00433, -0.00002, 0.00370, 0.00447, 0.00467, 0.00215, 0.00602, 0.00288, 0.00172,
0.00397, 0.00408, 0.00228, 0.00618, 0.00693, 0.00480, 0.00212, 0.00366, -0.00040, 1.00000, 0.00330, 0.00347, 0.00189, -0.00033, 0.00512, 0.00035, 0.00093, 0.00213, 0.00044, 0.00745, 0.00244, 0.00302,
0.00501, 0.00210, 0.00103, 0.00425, 0.00782, 0.00128, 0.00505, 0.00569, 0.00028, 0.00330, 1.00000, 0.00009, 0.00653, 0.00046, -0.00017, 0.00250, 0.00745, 0.00120, 0.00639, 0.00704, 0.00069, 0.00064,
-0.00100, 0.00452, 0.00044, 0.00228, 0.00452, 0.00416, 0.00342, 0.00308, 0.00590, 0.00347, 0.00009, 1.00000, 0.00393, 0.00539, 0.00663, 0.00043, 0.00774, 0.00330, 0.00542, 0.00361, 0.00058, 0.00354,
0.00457, -0.00019, 0.00225, 0.00035, 0.00047, 0.00138, 0.00090, 0.00053, 0.00185, 0.00189, 0.00653, 0.00393, 1.00000, 0.00383, -0.00001, 0.00360, -0.00048, 0.00449, 0.00195, 0.00301, 0.00108, -0.00029,
0.00329, 0.00801, 0.00064, 0.00296, 0.00841, 0.00007, 0.00354, 0.00538, 0.00433, -0.00033, 0.00046, 0.00539, 0.00383, 1.00000, 0.00237, 0.00090, 0.00792, 0.00872, 0.00465, -0.00047, 0.00382, 0.00453,
0.00558, 0.00544, 0.00223, 0.00156, 0.00686, 0.00166, 0.00775, 0.00569, -0.00002, 0.00512, -0.00017, 0.00663, -0.00001, 0.00237, 1.00000, 0.00416, 0.00327, 0.00470, 0.00814, 0.00652, -0.00031, 0.00511,
0.00030, 0.00001, 0.00007, 0.00752, 0.00371, 0.00756, 0.00050, 0.00130, 0.00370, 0.00035, 0.00250, 0.00043, 0.00360, 0.00090, 0.00416, 1.00000, 0.00217, 0.00182, -0.00006, -0.00001, 0.00070, 0.00077,
0.00131, 0.00798, 0.00020, 0.00427, -0.00030, 0.00375, 0.00096, 0.00779, 0.00447, 0.00093, 0.00745, 0.00774, -0.00048, 0.00792, 0.00327, 0.00217, 1.00000, 0.00741, 0.00346, 0.00766, 0.00308, 0.00143,
0.00605, 0.00113, 0.00237, 0.00438, 0.00642, 0.00052, 0.00122, 0.00316, 0.00467, 0.00213, 0.00120, 0.00330, 0.00449, 0.00872, 0.00470, 0.00182, 0.00741, 1.00000, 0.00529, 0.00513, 0.00501, 0.00368,
0.00323, 0.00126, 0.00052, 0.00258, 0.00768, 0.00119, 0.00419, 0.00007, 0.00215, 0.00044, 0.00639, 0.00542, 0.00195, 0.00465, 0.00814, -0.00006, 0.00346, 0.00529, 1.00000, 0.00916, 0.00220, 0.00116,
0.00614, 0.00019, 0.00010, 0.00418, 0.00770, 0.00397, 0.00625, 0.00236, 0.00602, 0.00745, 0.00704, 0.00361, 0.00301, -0.00047, 0.00652, -0.00001, 0.00766, 0.00513, 0.00916, 1.00000, 0.00129, 0.00107,
0.00176, 0.00282, 0.00009, 0.00774, 0.00394, 0.00307, -0.00026, 0.00487, 0.00288, 0.00244, 0.00069, 0.00058, 0.00108, 0.00382, -0.00031, 0.00070, 0.00308, 0.00501, 0.00220, 0.00129, 1.00000};
correlations_matrix = Matrix<double>.Build.Dense(22,22,correlations);
GenerateSigma();
CS.Add(new int[] {1, 16});
CS.Add(new int[] {1, 17}); CS.Add(new int[] {2, 16}); CS.Add(new int[] {2, 17}); CS.Add(new int[] {7, 22}); CS.Add(new int[] {7, 21});
CS.Add(new int[] {7, 20}); CS.Add(new int[] {6, 22}); CS.Add(new int[] {6, 21}); CS.Add(new int[] {6, 20});
CS.Add(new int[] {5, 22});
CS.Add(new int[] {5, 21});
CS.Add(new int[] {5, 20});
CS.Add(new int[] {1, 9, 18});
CS.Add(new int[] {1, 8, 18});
CS.Add(new int[] {2, 9, 18});
CS.Add(new int[] {2, 8, 18});
CS.Add(new int[] {1, 9, 19});
CS.Add(new int[] {1, 8, 19});
CS.Add(new int[] {2, 9, 19});
CS.Add(new int[] {2, 8, 19});
CS.Add(new int[] {1, 8, 13,15,20});
CS.Add(new int[] {1, 8, 12,15,20});
CS.Add(new int[] {1, 8, 11,15,20});
CS.Add(new int[] {1, 8, 10,15,20});
CS.Add(new int[] {1, 8, 13,14,20});
CS.Add(new int[] {1, 8, 12,14,20});
CS.Add(new int[] {1, 8, 11,14,20});
CS.Add(new int[] {1, 8, 10,14,20});
CS.Add(new int[] {1, 8, 13,15,21});
CS.Add(new int[] {1, 8, 12,15,21});
CS.Add(new int[] {1, 8, 11,15,21});
CS.Add(new int[] {1, 8, 10,15,21});
CS.Add(new int[] {1, 8, 13,14,21});
CS.Add(new int[] {1, 8, 12,14,21});
CS.Add(new int[] {1, 8, 11,14,21});
CS.Add(new int[] {1, 8, 10,14,21});
CS.Add(new int[] {1, 8, 13,15,22});
CS.Add(new int[] {1, 8, 12,15,22});
CS.Add(new int[] {1, 8, 11,15,22});
CS.Add(new int[] {1, 8, 10,15,22});
CS.Add(new int[] {1, 8, 13,14,22});
CS.Add(new int[] {1, 8, 12,14,22});
CS.Add(new int[] {1, 8, 11,14,22});
CS.Add(new int[] {1, 8, 10,14,22});
CS.Add(new int[] {2, 8, 13,15,20});
CS.Add(new int[] {2, 8, 12,15,20});
CS.Add(new int[] {2, 8, 11,15,20});
CS.Add(new int[] {2, 8, 10,15,20});
CS.Add(new int[] {2, 8, 13,14,20});
CS.Add(new int[] {2, 8, 12,14,20});
CS.Add(new int[] {2, 8, 11,14,20});
CS.Add(new int[] {2, 8, 10,14,20});
CS.Add(new int[] {2, 8, 13,15,21});
CS.Add(new int[] {2, 8, 12,15,21});
CS.Add(new int[] {2, 8, 11,15,21});
CS.Add(new int[] {2, 8, 10,15,21});
CS.Add(new int[] {2, 8, 13,14,21});
CS.Add(new int[] {2, 8, 12,14,21});
CS.Add(new int[] {2, 8, 11,14,21});
CS.Add(new int[] {2, 8, 10,14,21});
CS.Add(new int[] {2, 8, 13,15,22});
CS.Add(new int[] {2, 8, 12,15,22});
CS.Add(new int[] {2, 8, 11,15,22});
CS.Add(new int[] {2, 8, 10,15,22});
CS.Add(new int[] {2, 8, 13,14,22});
CS.Add(new int[] {2, 8, 12,14,22});
CS.Add(new int[] {2, 8, 11,14,22});
CS.Add(new int[] {2, 8, 10,14,22});
CS.Add(new int[] {2, 9, 13,15,20});
CS.Add(new int[] {2, 9, 12,15,20});
CS.Add(new int[] {2, 9, 11,15,20});
CS.Add(new int[] {2, 9, 10,15,20});
CS.Add(new int[] {2, 9, 13,14,20});
CS.Add(new int[] {2, 9, 12,14,20});
CS.Add(new int[] {2, 9, 11,14,20});
CS.Add(new int[] {2, 9, 10,14,20});
CS.Add(new int[] {2, 9, 13,15,21});
CS.Add(new int[] {2, 9, 12,15,21});
CS.Add(new int[] {2, 9, 11,15,21});
CS.Add(new int[] {2, 9, 10,15,21});
CS.Add(new int[] {2, 9, 13,14,21});
CS.Add(new int[] {2, 9, 12,14,21});
CS.Add(new int[] {2, 9, 11,14,21});
CS.Add(new int[] {2, 9, 10,14,21});
CS.Add(new int[] {2, 9, 13,15,22});
CS.Add(new int[] {2, 9, 12,15,22});
CS.Add(new int[] {2, 9, 11,15,22});
CS.Add(new int[] {2, 9, 10,15,22});
CS.Add(new int[] {2, 9, 13,14,22});
CS.Add(new int[] {2,9, 12,14,22});
CS.Add(new int[] {2, 9, 11,14,22});
CS.Add(new int[] {2, 9, 10,14,22});
CS.Add(new int[] {1, 9, 13,15,20});
CS.Add(new int[] {1, 9, 12,15,20});
CS.Add(new int[] {1, 9, 11,15,20});
CS.Add(new int[] {1, 9, 10,15,20});
CS.Add(new int[] {1, 9, 13,14,20});
CS.Add(new int[] {1, 9, 12,14,20});
CS.Add(new int[] {1, 9, 11,14,20});
CS.Add(new int[] {1, 9, 10,14,20});
CS.Add(new int[] {1, 9, 13,15,21});
CS.Add(new int[] {1, 9, 12,15,21});
CS.Add(new int[] {1, 9, 11,15,21});
CS.Add(new int[] {1, 9, 10,15,21});
CS.Add(new int[] {1, 9, 13,14,21});
CS.Add(new int[] {1, 9, 12,14,21});
CS.Add(new int[] {1, 9, 11,14,21});
CS.Add(new int[] {1, 9, 10,14,21});
CS.Add(new int[] {1, 9, 13,15,22});
CS.Add(new int[] {1, 9, 12,15,22});
CS.Add(new int[] {1, 9, 11,15,22});
CS.Add(new int[] {1, 9, 10,15,22});
CS.Add(new int[] {1, 9, 13,14,22});
CS.Add(new int[] {1,9, 12,14,22});
CS.Add(new int[] {1, 9, 11,14,22});
CS.Add(new int[] {1, 9, 10,14,22});
CS.Add(new int[] {3,14, 22});
CS.Add(new int[] {3,14, 21});
CS.Add(new int[] {3,14, 20});
CS.Add(new int[] {4,14, 22});
CS.Add(new int[] {4,14, 21});
CS.Add(new int[] {4,14, 20});
CS.Add(new int[] {3,15, 22});
CS.Add(new int[] {3,15, 21});
CS.Add(new int[] {3,15, 20});
CS.Add(new int[] {4,15, 22});
CS.Add(new int[] {4,15, 21});
CS.Add(new int[] {4,15, 20});
CS.Add(new int[] {7,15, 13,19});
CS.Add(new int[] {6,15, 13,19});
CS.Add(new int[] {5,15, 13,19});
CS.Add(new int[] {7,14, 13,19});
CS.Add(new int[] {6,14, 13,19});
CS.Add(new int[] {5,14, 13,19});
CS.Add(new int[] {7,15, 12,19});
CS.Add(new int[] {6,15, 12,19});
CS.Add(new int[] {5,15, 12,19});
CS.Add(new int[] {7,15, 11,19});
CS.Add(new int[] {6,15, 11,19});
CS.Add(new int[] {5,15, 11,19});
CS.Add(new int[] {7,15, 10,19});
CS.Add(new int[] {6,15, 10,19});
CS.Add(new int[] {5,15, 10,19});
CS.Add(new int[] {7,14, 12,19});
CS.Add(new int[] {6,14, 12,19});
CS.Add(new int[] {5,14, 12,19});
CS.Add(new int[] {7,14, 11,19});
CS.Add(new int[] {6,14, 11,19});
CS.Add(new int[] {5,14, 11,19});
CS.Add(new int[] {7,14, 10,19});
CS.Add(new int[] {6,14, 10,19});
CS.Add(new int[] {5,14, 10,19});
CS.Add(new int[] {7,15, 13,18});
CS.Add(new int[] {6,15, 13,18});
CS.Add(new int[] {5,15, 13,18});
CS.Add(new int[] {7,14, 13,18});
CS.Add(new int[] {6,14, 13,18});
CS.Add(new int[] {5,14, 13,18});
CS.Add(new int[] {7,15, 12,18});
CS.Add(new int[] {6,15, 12,18});
CS.Add(new int[] {5,15, 12,18});
CS.Add(new int[] {7,15, 11,18});
CS.Add(new int[] {6,15, 11,18});
CS.Add(new int[] {5,15, 11,18});
CS.Add(new int[] {7,15, 10,18});
CS.Add(new int[] {6,15, 10,18});
CS.Add(new int[] {5,15, 10,18});
CS.Add(new int[] {7,14, 12,19});
CS.Add(new int[] {6,14, 12,19});
CS.Add(new int[] {5,14, 12,19});
CS.Add(new int[] {7,14, 11,18});
CS.Add(new int[] {6,14, 11,18});
CS.Add(new int[] {5,14, 11,18});
CS.Add(new int[] {7,14, 10,18});
CS.Add(new int[] {6,14, 10,18});
CS.Add(new int[] {5,14, 10,18});
CS.Add(new int[] {3, 8,10, 16});
CS.Add(new int[] {3, 8,11, 16});
CS.Add(new int[] {3, 8,12, 16});
CS.Add(new int[] {3, 8,13, 16});
CS.Add(new int[] {3, 9,10, 16});
CS.Add(new int[] {3, 9,11, 16});
CS.Add(new int[] {3, 9,12, 16});
CS.Add(new int[] {3, 9,13, 16});
CS.Add(new int[] {4, 8,10, 16});
CS.Add(new int[] {4, 8,11, 16});
CS.Add(new int[] {4, 8,12, 16});
CS.Add(new int[] {4, 8,13, 16});
CS.Add(new int[] {4, 9,10, 16});
CS.Add(new int[] {4, 9,11, 16});
CS.Add(new int[] {4, 9,12, 16});
CS.Add(new int[] {4, 9,13, 16});
CS.Add(new int[] {3, 8,10, 17});
CS.Add(new int[] {3, 8,11, 17});
CS.Add(new int[] {3, 8,12, 17});
CS.Add(new int[] {3, 8,13, 17});
CS.Add(new int[] {3, 9,10, 17});
CS.Add(new int[] {3, 9,11, 17});
CS.Add(new int[] {3, 9,12, 17});