Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/03/19 15:37:38 (5 years ago)
Author:
mkommend
Message:

#2521: Renamed Solution to EncodedSolution.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2521_ProblemRefactoring/HeuristicLab.Optimization/3.3/BasicProblems/Operators/SingleObjectiveMoveGenerator.cs

    r16723 r16751  
    3434  [Item("Single-objective MoveGenerator", "Calls the GetNeighbors method of the problem definition to obtain the moves.")]
    3535  [StorableType("CB37E7D8-EAC3-4061-9D39-20538CD1064D")]
    36   public class SingleObjectiveMoveGenerator<TSolution> : SingleSuccessorOperator, INeighborBasedOperator<TSolution>, IMultiMoveGenerator, IStochasticOperator, ISingleObjectiveMoveOperator
    37   where TSolution : class, ISolution {
     36  public class SingleObjectiveMoveGenerator<TEncodedSolution> : SingleSuccessorOperator, INeighborBasedOperator<TEncodedSolution>, IMultiMoveGenerator, IStochasticOperator, ISingleObjectiveMoveOperator
     37  where TEncodedSolution : class, IEncodedSolution {
    3838    public ILookupParameter<IRandom> RandomParameter {
    3939      get { return (ILookupParameter<IRandom>)Parameters["Random"]; }
     
    4444    }
    4545
    46     public ILookupParameter<IEncoding<TSolution>> EncodingParameter {
    47       get { return (ILookupParameter<IEncoding<TSolution>>)Parameters["Encoding"]; }
     46    public ILookupParameter<IEncoding<TEncodedSolution>> EncodingParameter {
     47      get { return (ILookupParameter<IEncoding<TEncodedSolution>>)Parameters["Encoding"]; }
    4848    }
    4949
    50     public Func<TSolution, IRandom, IEnumerable<TSolution>> GetNeighborsFunc { get; set; }
     50    public Func<TEncodedSolution, IRandom, IEnumerable<TEncodedSolution>> GetNeighborsFunc { get; set; }
    5151
    5252    [StorableConstructor]
    5353    protected SingleObjectiveMoveGenerator(StorableConstructorFlag _) : base(_) { }
    54     protected SingleObjectiveMoveGenerator(SingleObjectiveMoveGenerator<TSolution> original, Cloner cloner)
     54    protected SingleObjectiveMoveGenerator(SingleObjectiveMoveGenerator<TEncodedSolution> original, Cloner cloner)
    5555      : base(original, cloner) { }
    5656    public SingleObjectiveMoveGenerator() {
    5757      Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator to use."));
    5858      Parameters.Add(new ValueLookupParameter<IntValue>("SampleSize", "The number of moves to sample."));
    59       Parameters.Add(new LookupParameter<IEncoding<TSolution>>("Encoding", "An item that holds the problem's encoding."));
     59      Parameters.Add(new LookupParameter<IEncoding<TEncodedSolution>>("Encoding", "An item that holds the problem's encoding."));
    6060    }
    6161
    6262    public override IDeepCloneable Clone(Cloner cloner) {
    63       return new SingleObjectiveMoveGenerator<TSolution>(this, cloner);
     63      return new SingleObjectiveMoveGenerator<TEncodedSolution>(this, cloner);
    6464    }
    6565
     
    6868      var sampleSize = SampleSizeParameter.ActualValue.Value;
    6969      var encoding = EncodingParameter.ActualValue;
    70       var solution = ScopeUtil.GetSolution(ExecutionContext.Scope, encoding);
     70      var solution = ScopeUtil.GetEncodedSolution(ExecutionContext.Scope, encoding);
    7171      var nbhood = GetNeighborsFunc(solution, random).Take(sampleSize).ToList();
    7272
     
    7474      for (int i = 0; i < moveScopes.Length; i++) {
    7575        moveScopes[i] = new Scope(i.ToString(CultureInfo.InvariantCulture.NumberFormat));
    76         ScopeUtil.CopySolutionToScope(moveScopes[i], encoding, nbhood[i]);
     76        ScopeUtil.CopyEncodedSolutionToScope(moveScopes[i], encoding, nbhood[i]);
    7777      }
    7878      ExecutionContext.Scope.SubScopes.AddRange(moveScopes);
Note: See TracChangeset for help on using the changeset viewer.