Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/10/17 22:11:10 (7 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/Operators/Shakers/NMoveShakingOperator.cs

    r7523 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("NMoveShakingOperator", "Performs a number of shaking operations that increase in strength.")]
    3333  [StorableClass]
    34   public class NMoveShakingOperator : SingleSuccessorOperator, IAssignmentAwareGQAPOperator, ICapacitiesAwareGQAPOperator, IMultiNeighborhoodShakingOperator, IStochasticOperator {
     34  public class NMoveShakingOperator : SingleSuccessorOperator, IProblemInstanceAwareGQAPOperator, IMultiNeighborhoodShakingOperator, IStochasticOperator {
    3535
     36
     37    public ILookupParameter<GQAPInstance> ProblemInstanceParameter {
     38      get { return (ILookupParameter<GQAPInstance>)Parameters["ProblemInstance"]; }
     39    }
    3640    public ILookupParameter<IntegerVector> AssignmentParameter {
    3741      get { return (ILookupParameter<IntegerVector>)Parameters["Assignment"]; }
    38     }
    39     public ILookupParameter<DoubleArray> CapacitiesParameter {
    40       get { return (ILookupParameter<DoubleArray>)Parameters["Capacities"]; }
    4142    }
    4243    public IValueLookupParameter<IntValue> CurrentNeighborhoodIndexParameter {
     
    5455    protected NMoveShakingOperator(NMoveShakingOperator original, Cloner cloner) : base(original, cloner) { }
    5556    public NMoveShakingOperator() {
     57      Parameters.Add(new LookupParameter<GQAPInstance>("ProblemInstance", GQAP.ProblemInstanceDescription));
    5658      Parameters.Add(new LookupParameter<IntegerVector>("Assignment", GQAPSolutionCreator.AssignmentDescription));
    57       Parameters.Add(new LookupParameter<DoubleArray>("Capacities", GeneralizedQuadraticAssignmentProblem.CapacitiesDescription));
    5859      Parameters.Add(new ValueLookupParameter<IntValue>("CurrentNeighborhoodIndex", "The index of the operator that should be applied (k)."));
    5960      Parameters.Add(new LookupParameter<IntValue>("NeighborhoodCount", "The number of operators that are available."));
     
    6869      var random = RandomParameter.ActualValue;
    6970      var assignment = AssignmentParameter.ActualValue;
    70       var capacities = CapacitiesParameter.ActualValue;
     71      var capacities = ProblemInstanceParameter.ActualValue.Capacities;
    7172
    7273      if (NeighborhoodCountParameter.ActualValue == null)
Note: See TracChangeset for help on using the changeset viewer.