Changeset 12269
 Timestamp:
 03/30/15 15:53:20 (4 years ago)
 Location:
 branches/PTSP
 Files:

 17 added
 2 edited
Legend:
 Unmodified
 Added
 Removed

branches/PTSP/HeuristicLab.Problems.PTSP/3.3/AnalyticalPTSP.cs
r12228 r12269 95 95 } 96 96 97 public double EvaluateWithParams(DistanceMatrix distances, DoubleArray probabilities, Permutation individual) { 98 Permutation p = individual; 99 // Compute A and B matrices 100 DoubleMatrix A = new DoubleMatrix(p.Length, p.Length  1); 101 DoubleMatrix B = new DoubleMatrix(p.Length, p.Length  1); 102 // Analytical evaluation 103 double firstSum = 0; 104 for (int i = 0; i < p.Length; i++) { 105 for (int j = i + 1; j < p.Length; j++) { 106 double sum1 = distances[p[i], p[j]] * probabilities[p[i]] * probabilities[p[j]]; 107 for (int k = i + 1; k < j; k++) { 108 sum1 = sum1 * (1  probabilities[p[k]]); 109 } 110 A[i, j  1] = sum1; 111 firstSum += sum1; 112 } 113 } 114 double secondSum = 0; 115 for (int j = 0; j < p.Length; j++) { 116 for (int i = 0; i < j; i++) { 117 double sum2 = distances[p[j], p[i]] * probabilities[p[i]] * probabilities[p[j]]; 118 for (int k = j + 1; k < p.Length; k++) { 119 sum2 = sum2 * (1  probabilities[p[k]]); 120 } 121 for (int k = 0; k < i; k++) { 122 sum2 = sum2 * (1  probabilities[p[k]]); 123 } 124 B[j,i] = sum2; 125 secondSum += sum2; 126 } 127 } 128 foreach (var op in Operators.OfType<PTSPAnalyticalInversionMovePathEvaluator>()) { 129 op.AParameter.Value = A; 130 op.BParameter.Value = B; 131 } 132 return firstSum + secondSum; 133 } 134 97 135 public AnalyticalProbabilisticTravelingSalesmanProblem() { 98 136 Operators.Add(new PTSPAnalyticalInversionMovePathEvaluator()); 
branches/PTSP/HeuristicLab.Problems.PTSP/3.3/EstimatedPTSP.cs
r12261 r12269 128 128 // For now uses sample size of 20 but should use Student's ttest 129 129 //Ttest(data.Dimension); 130 SampleSize = new IntValue( 25);130 SampleSize = new IntValue(100); 131 131 MersenneTwister r = new MersenneTwister(); 132 132 int countOnes = 0;
Note: See TracChangeset
for help on using the changeset viewer.