- Timestamp:
- 05/04/15 18:30:26 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PTSP/HeuristicLab.Problems.PTSP/3.3/EstimatedPTSP.cs
r12306 r12380 104 104 Parameters.Add(new ValueParameter<IntValue>("RealizationsSize", "Size of the sample for the estimation-based evaluation")); 105 105 Parameters.Add(new ValueParameter<ItemList<ItemList<IntValue>>>("Realizations", "The concrete...")); 106 Operators.Add(new PTSPEstimatedInversion MovePathEvaluator());106 Operators.Add(new PTSPEstimatedInversionEvaluator()); 107 107 Operators.Add(new PTSPEstimatedInsertionEvaluator()); 108 108 Operators.Add(new PTSPExhaustiveInversionLocalImprovement()); … … 121 121 } 122 122 123 private int Ttest(int ProblemSize) {124 MersenneTwister random = new MersenneTwister();125 Permutation p1 = new Permutation(PermutationTypes.RelativeUndirected, ProblemSize, random);126 Permutation p2 = new Permutation(PermutationTypes.RelativeUndirected, ProblemSize, random);127 ItemList<ItemList<IntValue>> realizations = new ItemList<ItemList<IntValue>>();128 int index = -1;129 while (true) {130 for (int i = index+1; i < index+5; i++) {131 realizations.Add(new ItemList<IntValue>());132 for (int j = 0; j < ProblemSize; j++) {133 if (ProbabilityMatrix[j] > random.NextDouble()) {134 realizations.ElementAt(i).Add(new IntValue(1));135 } else {136 realizations.ElementAt(i).Add(new IntValue(0));137 }138 }139 }140 index += 4;141 double[] eval1 = EvaluateWithParams(DistanceMatrix, ProbabilityMatrix, realizations, p1);142 double[] eval2 = EvaluateWithParams(DistanceMatrix, ProbabilityMatrix, realizations, p2);143 double sx1x2 = Math.Sqrt((eval1[1]+eval2[1])/2);144 int degrees = 2 * realizations.Count - 2;145 double t = (eval1[0]-eval2[0])/(sx1x2*Math.Sqrt(2.0/(double)realizations.Count));146 }147 }148 149 123 public override void Load(PTSPData data) { 150 124 base.Load(data); 151 // For now uses sample size of 20 but should use Student's t-test152 //Ttest(data.Dimension);153 125 RealizationsSize = new IntValue(100); 154 126 MersenneTwister r = new MersenneTwister(); 127 128 // TODO : This should be made in another function and attached to a listener 155 129 int countOnes = 0; 156 130 Realizations = new ItemList<ItemList<IntValue>>(RealizationsSize.Value); … … 173 147 } 174 148 175 foreach (var op in Operators.OfType<PTSP PathMoveEvaluator>()) {149 foreach (var op in Operators.OfType<PTSPMoveEvaluator>()) { 176 150 op.RealizationsParameter.Value = Realizations; 177 151 }
Note: See TracChangeset
for help on using the changeset viewer.