Ignore:
Timestamp:
01/31/18 14:01:55 (4 years ago)
Author:
abeham
Message:

#1614: Added random search and fixed execution time counting for commercial solvers

Location:
branches/1614_GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Algorithms/3.3/RandomSearch
Files:
1 added
1 copied

Legend:

Unmodified
Added
Removed
  • branches/1614_GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Algorithms/3.3/RandomSearch/RandomSearch.cs

    r15687 r15698  
    3030
    3131namespace HeuristicLab.Problems.GeneralizedQuadraticAssignment.Algorithms.LocalSearch {
    32   [Item("Multi-start Local Search (GQAP)", "Multi-start local search for the GQAP.")]
     32  [Item("Random Search (GQAP)", "Random search for the GQAP.")]
    3333  [Creatable(CreatableAttribute.Categories.SingleSolutionAlgorithms)]
    3434  [StorableClass]
    35   public sealed class MultistartLS : StochasticAlgorithm<LocalSearchContext, IntegerVectorEncoding> {
     35  public sealed class RandomSearch : StochasticAlgorithm<LocalSearchContext, IntegerVectorEncoding> {
    3636
    3737    public override bool SupportsPause {
     
    4949
    5050    [StorableConstructor]
    51     private MultistartLS(bool deserializing) : base(deserializing) { }
    52     private MultistartLS(MultistartLS original, Cloner cloner)
     51    private RandomSearch(bool deserializing) : base(deserializing) { }
     52    private RandomSearch(RandomSearch original, Cloner cloner)
    5353      : base(original, cloner) {
    5454    }
    55     public MultistartLS() {
     55    public RandomSearch() {
    5656
    5757      Problem = new GQAP();
     
    5959   
    6060    public override IDeepCloneable Clone(Cloner cloner) {
    61       return new MultistartLS(this, cloner);
     61      return new RandomSearch(this, cloner);
    6262    }
    6363
     
    7474
    7575      while (!StoppingCriterion()) {
    76         var lsevaluations = 0;
    7776        var assign = new IntegerVector(Problem.ProblemInstance.Demands.Length, Context.Random, 0, Problem.ProblemInstance.Capacities.Length);
    7877        var eval = Problem.ProblemInstance.Evaluate(assign);
     78        var candidate = new GQAPSolution(assign, eval);
    7979        Context.EvaluatedSolutions++;
    80 
    81         var candidate = new GQAPSolution(assign, eval);
    82         OneOptLocalSearch.Apply(Context.Random, candidate, Problem.ProblemInstance, out lsevaluations);
    83         Context.EvaluatedSolutions += lsevaluations;
    8480
    8581        var candidateFit = Problem.ProblemInstance.ToSingleObjective(candidate.Evaluation);
Note: See TracChangeset for help on using the changeset viewer.