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/Operators/Manipulators/SwapLocationManipulator.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.
     
    2424using HeuristicLab.Common;
    2525using HeuristicLab.Core;
    26 using HeuristicLab.Data;
    2726using HeuristicLab.Encodings.IntegerVectorEncoding;
    28 using HeuristicLab.Parameters;
    2927using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    3028
     
    3331  [Item("SwapLocationManipluator", "Swaps two locations by exchanging all equipments between the locations.")]
    3432  [StorableClass]
    35   public class SwapLocationManipluator : GQAPManipulator, ICapacitiesAwareGQAPOperator {
    36 
    37     public ILookupParameter<DoubleArray> CapacitiesParameter {
    38       get { return (ILookupParameter<DoubleArray>)Parameters["Capacities"]; }
    39     }
    40 
     33  public class SwapLocationManipluator : GQAPManipulator {
     34   
    4135    [StorableConstructor]
    4236    protected SwapLocationManipluator(bool deserializing) : base(deserializing) { }
     
    4438    public SwapLocationManipluator()
    4539      : base() {
    46       Parameters.Add(new LookupParameter<DoubleArray>("Capacities", GeneralizedQuadraticAssignmentProblem.CapacitiesDescription));
    4740    }
    4841
     
    7265    }
    7366
    74     protected override void Manipulate(IRandom random, IntegerVector vector) {
    75       Apply(random, vector, CapacitiesParameter.ActualValue.Length);
     67    protected override void Manipulate(IRandom random, IntegerVector vector, GQAPInstance problemInstance) {
     68      Apply(random, vector, problemInstance.Capacities.Length);
    7669    }
    7770  }
Note: See TracChangeset for help on using the changeset viewer.