Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/10/17 22:11:10 (6 years ago)
Author:
abeham
Message:

#1614: refactored code

  • change problem to derive from basic problem
  • using a combined instance class instead of individual parameters
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/Moves/StochasticNMoveSingleMoveGenerator.cs

    r7505 r15504  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2017 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    3232  [Item("Stochastic N-Move SingleMoveGenerator", "Randomly samples a single N-Move.")]
    3333  [StorableClass]
    34   public class StochasticNMoveSingleMoveGenerator : GQAPNMoveGenerator, ICapacitiesAwareGQAPOperator, IStochasticOperator, ISingleMoveGenerator {
    35 
    36     public ILookupParameter<DoubleArray> CapacitiesParameter {
    37       get { return (ILookupParameter<DoubleArray>)Parameters["Capacities"]; }
    38     }
     34  public class StochasticNMoveSingleMoveGenerator : GQAPNMoveGenerator, IStochasticOperator, ISingleMoveGenerator {
     35   
    3936    public ILookupParameter<IRandom> RandomParameter {
    4037      get { return (ILookupParameter<IRandom>)Parameters["Random"]; }
     
    4744      : base() {
    4845      Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator that should be used."));
    49       Parameters.Add(new LookupParameter<DoubleArray>("Capacities", GeneralizedQuadraticAssignmentProblem.CapacitiesDescription));
    5046    }
    5147
     
    7369    }
    7470
    75     public override IEnumerable<NMove> GenerateMoves(IntegerVector assignment, int n) {
    76       yield return GenerateUpToN(RandomParameter.ActualValue, assignment, n, CapacitiesParameter.ActualValue);
     71    public override IEnumerable<NMove> GenerateMoves(IntegerVector assignment, int n, GQAPInstance problemInstance) {
     72      yield return GenerateUpToN(RandomParameter.ActualValue, assignment, n, problemInstance.Capacities);
    7773    }
    7874  }
Note: See TracChangeset for help on using the changeset viewer.