Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/22/17 16:52:36 (8 years ago)
Author:
abeham
Message:

#2457: working on MemPR integration

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/PerformanceComparison/ProblemInstanceIdentifier/InstanceExplorer.cs

    r14696 r14776  
    7474  }
    7575
     76  public class AdaptiveWalkExplorer : InstanceExplorer {
     77    public int Iterations { get; set; }
     78
     79    public override string Name { get { return "Adaptive-Walk Explorer"; } }
     80    public override int Effort { get { return Iterations; } }
     81
     82    public AdaptiveWalkExplorer() {
     83
     84    }
     85
     86    public override InstanceDescriptor Explore(QuadraticAssignmentProblem problem, int? seed = null) {
     87      var walk = new AdaptiveWalk() {
     88        SeedParameter = { Value = { Value = seed ?? 0 } },
     89        SetSeedRandomlyParameter = { Value = { Value = seed.HasValue } },
     90        MaximumIterationsParameter = { Value = { Value = Iterations } },
     91        RepetitionsParameter = { Value = { Value = 1 } }
     92      };
     93      walk.Problem = problem;
     94      walk.Engine = new SequentialEngine();
     95      walk.MutatorParameter.Value = walk.MutatorParameter.ValidValues.First(x => x is Swap2Manipulator);
     96      var calculator = new AdaptiveWalkCalculator(walk) { Problem = problem };
     97      var features = calculator.Calculate().ToDictionary(x => x.Name, x => x.Value);
     98
     99      return new InstanceDescriptor(problem.Name, InstanceDescriptor.GetClass(problem.Name), problem.Weights.Rows,
     100        features.Keys.ToArray(), features.Values.Select(x => ((DoubleValue)x).Value).ToArray());
     101    }
     102  }
     103
    76104  public class MemPRExplorer : InstanceExplorer {
    77105    public int Seconds { get; set; }
Note: See TracChangeset for help on using the changeset viewer.