Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/04/15 18:30:26 (9 years ago)
Author:
apolidur
Message:

#2221: Small refactoring and code cleaning

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/PTSP/HeuristicLab.Problems.PTSP/3.3/EstimatedPTSP.cs

    r12306 r12380  
    104104      Parameters.Add(new ValueParameter<IntValue>("RealizationsSize", "Size of the sample for the estimation-based evaluation"));
    105105      Parameters.Add(new ValueParameter<ItemList<ItemList<IntValue>>>("Realizations", "The concrete..."));
    106       Operators.Add(new PTSPEstimatedInversionMovePathEvaluator());
     106      Operators.Add(new PTSPEstimatedInversionEvaluator());
    107107      Operators.Add(new PTSPEstimatedInsertionEvaluator());
    108108      Operators.Add(new PTSPExhaustiveInversionLocalImprovement());
     
    121121    }
    122122
    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 
    149123    public override void Load(PTSPData data) {
    150124      base.Load(data);
    151       // For now uses sample size of 20 but should use Student's t-test
    152       //Ttest(data.Dimension);
    153125      RealizationsSize = new IntValue(100);
    154126      MersenneTwister r = new MersenneTwister();
     127
     128      // TODO : This should be made in another function and attached to a listener
    155129      int countOnes = 0;
    156130      Realizations = new ItemList<ItemList<IntValue>>(RealizationsSize.Value);
     
    173147      }
    174148
    175       foreach (var op in Operators.OfType<PTSPPathMoveEvaluator>()) {
     149      foreach (var op in Operators.OfType<PTSPMoveEvaluator>()) {
    176150        op.RealizationsParameter.Value = Realizations;
    177151      }
Note: See TracChangeset for help on using the changeset viewer.