Changeset 7413


Ignore:
Timestamp:
01/26/12 00:36:45 (9 years ago)
Author:
abeham
Message:

#1614

  • renamed AssemblyInfo frame files to proper name
  • fixed discovery of move operators
  • fixed a bug in the move evaluator
  • fixed a bug in the DiscreteLocationCrossover
Location:
branches/GeneralizedQAP
Files:
2 added
2 deleted
10 edited

Legend:

Unmodified
Added
Removed
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Algorithms/3.3/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Algorithms.3.3.csproj

    r7363 r7413  
    6363    <Compile Include="Plugin.cs" />
    6464    <Compile Include="Properties\AssemblyInfo.cs" />
    65     <None Include="Properties\AssemblyInfo.frame" />
     65    <None Include="Properties\AssemblyInfo.cs.frame" />
    6666  </ItemGroup>
    6767  <ItemGroup>
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Common/3.3/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Common-3.3.csproj

    r7412 r7413  
    9393    <Compile Include="Plugin.cs" />
    9494    <Compile Include="Properties\AssemblyInfo.cs" />
    95     <None Include="Properties\AssemblyInfo.frame" />
     95    <None Include="Properties\AssemblyInfo.cs.frame" />
    9696  </ItemGroup>
    9797  <ItemGroup>
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/Evaluators/GQAPNMoveEvaluator.cs

    r7412 r7413  
    180180      MoveFlowDistanceQualityParameter.ActualValue = new DoubleValue(flowDistanceQuality + moveFlowDistanceQuality);
    181181      MoveInstallationQualityParameter.ActualValue = new DoubleValue(installationQuality + moveInstallationQuality);
    182       MoveOverbookedCapacityParameter.ActualValue = new DoubleValue(moveOverbookedCapacity);
     182      MoveOverbookedCapacityParameter.ActualValue = new DoubleValue(overbookedCapacity + moveOverbookedCapacity);
    183183
    184184      MoveQualityParameter.ActualValue = new DoubleValue(GQAPEvaluator.GetCombinedQuality(
    185185        flowDistanceQuality + moveFlowDistanceQuality,
    186186        installationQuality + moveInstallationQuality,
    187         moveOverbookedCapacity,
     187        overbookedCapacity + moveOverbookedCapacity,
    188188        transportationCosts,
    189189        overbookedCapacityPenalty));
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/GeneralizedQuadraticAssignmentProblem.cs

    r7412 r7413  
    204204      Operators.AddRange(ApplicationManager.Manager.GetInstances<IGQAPOperator>());
    205205      Operators.RemoveAll(x => x is ISingleObjectiveMoveEvaluator);
     206      Operators.AddRange(ApplicationManager.Manager.GetInstances<IGQAPMoveEvaluator>());
    206207      Operators.Add(new BestGQAPSolutionAnalyzer());
    207208      Parameterize();
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/Moves/GQAPMoveGenerator.cs

    r7407 r7413  
    2222using HeuristicLab.Common;
    2323using HeuristicLab.Core;
     24using HeuristicLab.Encodings.IntegerVectorEncoding;
    2425using HeuristicLab.Operators;
    2526using HeuristicLab.Optimization;
     27using HeuristicLab.Parameters;
    2628using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2729
     
    2931  [Item("GQAPMoveGenerator", "Base class for move generators for the Generalized Quadratic Assignment Problem.")]
    3032  [StorableClass]
    31   public class GQAPMoveGenerator : SingleSuccessorOperator, IMoveGenerator {
     33  public abstract class GQAPMoveGenerator : SingleSuccessorOperator, IMoveGenerator, IGQAPMoveOperator {
     34
     35    public ILookupParameter<IntegerVector> AssignmentParameter {
     36      get { return (ILookupParameter<IntegerVector>)Parameters["Assignment"]; }
     37    }
    3238
    3339    [StorableConstructor]
    3440    protected GQAPMoveGenerator(bool deserializing) : base(deserializing) { }
    35     protected GQAPMoveGenerator(GQAPMoveGenerator original, Cloner cloner)
    36       : base(original, cloner) {
    37       // TODO: All fields, especially storable fields, need to be deep-cloned here
    38       // myField = cloner.Clone(original.myField);
    39     }
     41    protected GQAPMoveGenerator(GQAPMoveGenerator original, Cloner cloner) : base(original, cloner) { }
    4042    public GQAPMoveGenerator()
    4143      : base() {
    42       // TODO: Add construction logic here
    43     }
    44 
    45     public override IDeepCloneable Clone(Cloner cloner) {
    46       return new GQAPMoveGenerator(this, cloner);
     44      Parameters.Add(new LookupParameter<IntegerVector>("Assignment", "The current equipment-location assignment."));
    4745    }
    4846  }
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/Moves/GQAPNMoveGenerator.cs

    r7407 r7413  
    3434  public abstract class GQAPNMoveGenerator : GQAPMoveGenerator, IGQAPNMoveOperator {
    3535
    36     public ILookupParameter<IntegerVector> AssignmentParameter {
    37       get { return (ILookupParameter<IntegerVector>)Parameters["Assignment"]; }
    38     }
    3936    public ILookupParameter<NMove> MoveParameter {
    4037      get { return (ILookupParameter<NMove>)Parameters["Move"]; }
     
    4946    public GQAPNMoveGenerator()
    5047      : base() {
    51       Parameters.Add(new LookupParameter<IntegerVector>("Assignment", "The current equipment-location assignment."));
    5248      Parameters.Add(new LookupParameter<NMove>("Move", "The move to generate."));
    5349      Parameters.Add(new ValueLookupParameter<IntValue>("N", "The maximum number of equipment(s) that should be moved.", new IntValue(2)));
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/Moves/NMoveMaker.cs

    r7412 r7413  
    2525using HeuristicLab.Encodings.IntegerVectorEncoding;
    2626using HeuristicLab.Operators;
     27using HeuristicLab.Optimization;
    2728using HeuristicLab.Parameters;
    2829using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     
    3132  [Item("NMoveMaker", "Performs an n-move.")]
    3233  [StorableClass]
    33   public class NMoveMaker : SingleSuccessorOperator, IGQAPNMoveOperator {
     34  public class NMoveMaker : SingleSuccessorOperator, IGQAPNMoveOperator, IMoveMaker {
    3435
    3536    public ILookupParameter<IntegerVector> AssignmentParameter {
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/Moves/StochasticNMoveMultiMoveGenerator.cs

    r7412 r7413  
    3030
    3131namespace HeuristicLab.Problems.GeneralizedQuadraticAssignment {
    32   [Item("Stochastic 1-move MultiMoveGenerator", "Randomly samples a number of moves according to the 1-move described in Mateus, G., Resende, M., and Silva, R. 2011. GRASP with path-relinking for the generalized quadratic assignment problem. Journal of Heuristics 17, Springer Netherlands, pp. 527-565.")]
     32  [Item("Stochastic n-move MultiMoveGenerator", "Randomly samples a number of n-moves.")]
    3333  [StorableClass]
    3434  public class StochasticNMoveMultiMoveGenerator : GQAPNMoveGenerator, ILocationAwareGQAPOperator, IMultiMoveGenerator, IStochasticOperator {
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/Moves/StochasticNMoveSingleMoveGenerator.cs

    r7412 r7413  
    3030
    3131namespace HeuristicLab.Problems.GeneralizedQuadraticAssignment {
    32   [Item("Stochastic 1-move and 2-move SingleMoveGenerator", "Randomly samples a single 1-move or 2-move as described in Mateus, G., Resende, M., and Silva, R. 2011. GRASP with path-relinking for the generalized quadratic assignment problem. Journal of Heuristics 17, Springer Netherlands, pp. 527-565.")]
     32  [Item("Stochastic n-move SingleMoveGenerator", "Randomly samples a single n-move.")]
    3333  [StorableClass]
    3434  public class StochasticNMoveSingleMoveGenerator : GQAPNMoveGenerator, ILocationAwareGQAPOperator, ISingleMoveGenerator, IStochasticOperator {
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/Operators/DiscreteLocationCrossover.cs

    r7407 r7413  
    6464      foreach (var i in Enumerable.Range(0, locations).Shuffle(random)) {
    6565        int parent = random.Next(parents.Length);
     66        if (!groupedLocations[parent].ContainsKey(i)) {
     67          int tmp = parent;
     68          do {
     69            tmp = (tmp + 1) % parents.Length;
     70          } while (tmp != parent && !groupedLocations[tmp].ContainsKey(i));
     71          if (parent == tmp) continue;
     72          else parent = tmp;
     73        }
    6674        foreach (var item in groupedLocations[parent][i]) {
    6775          if (remainingEquipment.Contains(item.Equipment)) {
Note: See TracChangeset for help on using the changeset viewer.