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/SolutionCreators/GQAPSolutionCreator.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.
     
    3131  [Item("GQAPSolutionCreator", "Base class for solution creators of the Generalized Quadratic Assignment Problem.")]
    3232  [StorableClass]
    33   public abstract class GQAPSolutionCreator : SingleSuccessorOperator, IDemandsAwareGQAPOperator, ICapacitiesAwareGQAPOperator, IGQAPSolutionCreator {
     33  public abstract class GQAPSolutionCreator : SingleSuccessorOperator, IProblemInstanceAwareGQAPOperator, IGQAPSolutionCreator {
    3434
    3535    #region Parameter Descriptions
     
    3737    #endregion
    3838
    39     public ILookupParameter<IntegerVector> AssignmentParameter {
    40       get { return (ILookupParameter<IntegerVector>)Parameters["Assignment"]; }
     39    public ILookupParameter<IntegerVector> IntegerVectorParameter {
     40      get { return (ILookupParameter<IntegerVector>)Parameters["IntegerVector"]; }
    4141    }
    42     public ILookupParameter<DoubleArray> DemandsParameter {
    43       get { return (ILookupParameter<DoubleArray>)Parameters["Demands"]; }
     42    public ILookupParameter<GQAPInstance> ProblemInstanceParameter {
     43      get { return (ILookupParameter<GQAPInstance>)Parameters["ProblemInstance"]; }
    4444    }
    45     public ILookupParameter<DoubleArray> CapacitiesParameter {
    46       get { return (ILookupParameter<DoubleArray>)Parameters["Capacities"]; }
     45    public IValueLookupParameter<IntValue> LengthParameter {
     46      get { return (IValueLookupParameter<IntValue>)Parameters["Length"]; }
     47    }
     48    public IValueLookupParameter<IntMatrix> BoundsParameter {
     49      get { return (IValueLookupParameter<IntMatrix>)Parameters["Bounds"]; }
    4750    }
    4851
     
    5356    public GQAPSolutionCreator()
    5457      : base() {
    55       Parameters.Add(new LookupParameter<IntegerVector>("Assignment", AssignmentDescription));
    56       Parameters.Add(new LookupParameter<DoubleArray>("Demands", GeneralizedQuadraticAssignmentProblem.DemandsDescription));
    57       Parameters.Add(new LookupParameter<DoubleArray>("Capacities", GeneralizedQuadraticAssignmentProblem.CapacitiesDescription));
     58      Parameters.Add(new LookupParameter<IntegerVector>("IntegerVector", AssignmentDescription));
     59      Parameters.Add(new LookupParameter<GQAPInstance>("ProblemInstance", GQAP.ProblemInstanceDescription));
     60      Parameters.Add(new ValueLookupParameter<IntValue>("Length", "The length of the vector.") { Hidden = true });
     61      Parameters.Add(new ValueLookupParameter<IntMatrix>("Bounds", "") { Hidden = true });
    5862    }
    5963
    6064    public override IOperation Apply() {
    61       AssignmentParameter.ActualValue = CreateSolution(DemandsParameter.ActualValue, CapacitiesParameter.ActualValue);
     65      IntegerVectorParameter.ActualValue = CreateSolution(ProblemInstanceParameter.ActualValue);
    6266      return base.Apply();
    6367    }
    6468
    65     protected abstract IntegerVector CreateSolution(DoubleArray demands, DoubleArray capacities);
     69    protected abstract IntegerVector CreateSolution(GQAPInstance problemInstance);
    6670  }
    6771}
Note: See TracChangeset for help on using the changeset viewer.