Free cookie consent management tool by TermsFeed Policy Generator

Changeset 7373 for branches


Ignore:
Timestamp:
01/19/12 17:33:28 (13 years ago)
Author:
abeham
Message:

#1614: Worked on GQAP

Location:
branches/GeneralizedQAP
Files:
4 added
4 edited

Legend:

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

    r7363 r7373  
    6161      get { return (IValueLookupParameter<IOperator>)Parameters["PathRelinking"]; }
    6262    }
    63     public IValueLookupParameter<IOperator> EliteSetReplacerParameter {
    64       get { return (IValueLookupParameter<IOperator>)Parameters["EliteSetReplacer"]; }
     63    public IValueLookupParameter<IOperator> EliteSetMergerParameter {
     64      get { return (IValueLookupParameter<IOperator>)Parameters["EliteSetMerger"]; }
    6565    }
    6666    public IValueLookupParameter<IOperator> AnalyzerParameter {
     
    8282      Parameters.Add(new ValueLookupParameter<IOperator>("LocalImprovement", "The operator which performs the local improvement."));
    8383      Parameters.Add(new ValueLookupParameter<IOperator>("PathRelinking", "The operator which performs the path relinking."));
    84       Parameters.Add(new ValueLookupParameter<IOperator>("EliteSetReplacer", "The operator that replaces elements in the elite set."));
     84      Parameters.Add(new ValueLookupParameter<IOperator>("EliteSetMerger", "The operator that merges elements in the elite set."));
    8585      Parameters.Add(new ValueLookupParameter<IOperator>("Analyzer", "The analyzer that is to be applied."));
    8686
    8787      var variableCreator1 = new VariableCreator();
     88      variableCreator1.Name = "Iterations = 0";
    8889      variableCreator1.CollectedValues.Add(new ValueParameter<IntValue>("Iterations", new IntValue(0)));
    8990
    9091      var variableCreator2 = new VariableCreator();
     92      variableCreator2.Name = "ActualEliteSetSize = 0";
    9193      variableCreator2.CollectedValues.Add(new ValueParameter<IntValue>("ActualEliteSetSize", new IntValue(0)));
    92       variableCreator2.Name = "ActualEliteSetSize = 0";
    9394
    9495      var subScopesCounter1 = new SubScopesCounter();
     
    119120
    120121      var solutionsCreator = new SolutionsCreator();
     122      solutionsCreator.ParallelParameter.Value = new BoolValue(false);
    121123      solutionsCreator.EvaluatorParameter.ActualName = EvaluatorParameter.Name;
    122124      solutionsCreator.SolutionCreatorParameter.ActualName = SolutionCreatorParameter.Name;
     
    149151      childrenCreator.ParentsPerChild = new IntValue(2);
    150152
     153      var ssp3 = new SubScopesProcessor();
     154
    151155      var placeholder2 = new Placeholder();
    152156      placeholder2.Name = "(PathRelinking)";
     
    156160      subScopesRemover.RemoveAllSubScopes = true;
    157161
    158       var ssp3 = new SubScopesProcessor();
     162      var ssp4 = new SubScopesProcessor();
    159163
    160164      var placeholder3 = new Placeholder();
     
    163167
    164168      var placeholder4 = new Placeholder();
    165       placeholder4.Name = "(Replacer)";
    166       placeholder4.OperatorParameter.ActualName = EliteSetReplacerParameter.Name;
     169      placeholder4.Name = "(EliteSetMerger)";
     170      placeholder4.OperatorParameter.ActualName = EliteSetMergerParameter.Name;
    167171
    168172      var counter = new IntCounter();
     
    203207      conditionalBranch2.TrueBranch = ssp2;
    204208      conditionalBranch2.FalseBranch = null;
    205       conditionalBranch2.Successor = ssp3;
     209      conditionalBranch2.Successor = ssp4;
    206210      ssp2.Operators.Add(eo2);
    207211      ssp2.Operators.Add(placeholder1);
    208       ssp2.Successor = null;
     212      ssp2.Successor = childrenCreator;
    209213      eo2.Successor = null;
    210       placeholder1.Successor = childrenCreator;
    211       childrenCreator.Successor = placeholder2;
     214      placeholder1.Successor = null;
     215      childrenCreator.Successor = ssp3;
     216      ssp3.Operators.Add(placeholder2);
     217      ssp3.Successor = null;
    212218      placeholder2.Successor = subScopesRemover;
    213219      subScopesRemover.Successor = null;
    214       ssp3.Operators.Add(placeholder3);
    215       ssp3.Successor = null;
     220      ssp4.Operators.Add(placeholder3);
     221      ssp4.Successor = null;
    216222      placeholder4.Successor = counter;
    217223      counter.Successor = analyzer1;
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/GeneralizedQuadraticAssignmentProblem.cs

    r7319 r7373  
    3636  [Creatable("Problems")]
    3737  [StorableClass]
    38   public sealed class GeneralizedQuadraticAssignmentProblem : SingleObjectiveHeuristicOptimizationProblem<IGQAPEvaluator, IIntegerVectorCreator>, IStorableContent {
     38  public sealed class GeneralizedQuadraticAssignmentProblem : SingleObjectiveHeuristicOptimizationProblem<IGQAPEvaluator, IGQAPSolutionCreator>, IStorableContent {
    3939    public override Image ItemImage {
    4040      get { return HeuristicLab.Common.Resources.VSImageLibrary.Type; }
     
    109109    }
    110110    public GeneralizedQuadraticAssignmentProblem()
    111       : base(new GQAPEvaluator(), new UniformRandomIntegerVectorCreator()) {
     111      : base(new GQAPEvaluator(), new RandomSolutionCreator()) {
    112112      Parameters.Add(new ValueParameter<DoubleMatrix>("Weights", "The weights matrix describes the flows between the equipments.", new DoubleMatrix()));
    113113      Parameters.Add(new ValueParameter<DoubleMatrix>("Distances", "The distances matrix describes the distances between the locations at which the equipment can be installed.", new DoubleMatrix()));
     
    146146      Capacities[0] = 4; Capacities[1] = 1; Capacities[2] = 4;
    147147
    148       SolutionCreator.IntegerVectorParameter.ActualName = "Assignment";
     148      SolutionCreator.AssignmentParameter.ActualName = "Assignment";
    149149      Parameterize();
    150150
     
    184184    [StorableHook(HookType.AfterDeserialization)]
    185185    private void AfterDeserializationHook() {
    186       // BackwardsCompatibility3.3
    187       #region Backwards compatible code, remove with 3.4
    188       if (!Parameters.ContainsKey("EquipmentNames"))
    189         Parameters.Add(new OptionalValueParameter<StringArray>("EquipmentNames", "Optional: A list of names that describes the equipments.", null, false));
    190       if (!Parameters.ContainsKey("LocationNames"))
    191         Parameters.Add(new OptionalValueParameter<StringArray>("LocationNames", "Optional: A list of names that describes the locations.", null, false));
    192       #endregion
    193186      AttachEventHandlers();
    194187    }
     
    196189    private void AttachEventHandlers() {
    197190      Evaluator.QualityParameter.ActualNameChanged += new System.EventHandler(Evaluator_QualityParameter_ActualNameChanged);
    198       SolutionCreator.IntegerVectorParameter.ActualNameChanged += new EventHandler(SolutionCreator_IntegerVectorParameter_ActualNameChanged);
     191      SolutionCreator.AssignmentParameter.ActualNameChanged += new EventHandler(SolutionCreator_IntegerVectorParameter_ActualNameChanged);
    199192    }
    200193
     
    214207      Evaluator.DemandsParameter.ActualName = DemandsParameter.Name;
    215208      Evaluator.CapacitiesParameter.ActualName = CapacitiesParameter.Name;
    216       Evaluator.AssignmentParameter.ActualName = SolutionCreator.IntegerVectorParameter.ActualName;
    217 
    218       SolutionCreator.LengthParameter.Value = new IntValue(Demands.Length);
    219       SolutionCreator.MinimumParameter.Value = new IntValue(0);
    220       SolutionCreator.MaximumParameter.Value = new IntValue(Capacities.Length);
     209      Evaluator.AssignmentParameter.ActualName = SolutionCreator.AssignmentParameter.ActualName;
     210
     211      SolutionCreator.DemandsParameter.ActualName = DemandsParameter.Name;
     212      SolutionCreator.CapacitiesParameter.ActualName = CapacitiesParameter.Name;
    221213
    222214      foreach (var op in Operators.OfType<IIntegerVectorCrossover>()) {
    223         op.ParentsParameter.ActualName = SolutionCreator.IntegerVectorParameter.ActualName;
    224         op.ChildParameter.ActualName = SolutionCreator.IntegerVectorParameter.ActualName;
     215        op.ParentsParameter.ActualName = SolutionCreator.AssignmentParameter.ActualName;
     216        op.ChildParameter.ActualName = SolutionCreator.AssignmentParameter.ActualName;
    225217      }
    226218      foreach (var op in Operators.OfType<IIntegerVectorManipulator>()) {
    227         op.IntegerVectorParameter.ActualName = SolutionCreator.IntegerVectorParameter.ActualName;
     219        op.IntegerVectorParameter.ActualName = SolutionCreator.AssignmentParameter.ActualName;
    228220      }
    229221      foreach (var op in Operators.OfType<IGQAPCrossover>()) {
    230         op.ParentsParameter.ActualName = SolutionCreator.IntegerVectorParameter.ActualName;
    231         op.ChildParameter.ActualName = SolutionCreator.IntegerVectorParameter.ActualName;
     222        op.ParentsParameter.ActualName = SolutionCreator.AssignmentParameter.ActualName;
     223        op.ChildParameter.ActualName = SolutionCreator.AssignmentParameter.ActualName;
    232224      }
    233225      foreach (var op in Operators.OfType<IGQAPManipulator>()) {
    234         op.IntegerVectorParameter.ActualName = SolutionCreator.IntegerVectorParameter.ActualName;
     226        op.IntegerVectorParameter.ActualName = SolutionCreator.AssignmentParameter.ActualName;
    235227      }
    236228      foreach (var op in Operators.OfType<ILocationAwareGQAPOperator>()) {
    237229        op.CapacitiesParameter.ActualName = CapacitiesParameter.Name;
    238230      }
    239       foreach (var op in Operators.OfType<IEquipmentAwareGQAPManipulator>()) {
     231      foreach (var op in Operators.OfType<IEquipmentAwareGQAPOperator>()) {
    240232        op.DemandsParameter.ActualName = DemandsParameter.Name;
    241233      }
     
    245237        BestSolutionAnalyzer.DistancesParameter.ActualName = DistancesParameter.Name;
    246238        BestSolutionAnalyzer.WeightsParameter.ActualName = WeightsParameter.Name;
    247         BestSolutionAnalyzer.AssignmentParameter.ActualName = SolutionCreator.IntegerVectorParameter.ActualName;
     239        BestSolutionAnalyzer.AssignmentParameter.ActualName = SolutionCreator.AssignmentParameter.ActualName;
    248240        BestSolutionAnalyzer.ResultsParameter.ActualName = "Results";
    249241        BestSolutionAnalyzer.BestKnownQualityParameter.ActualName = BestKnownQualityParameter.Name;
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/Interfaces/IEquipmentAwareGQAPOperator.cs

    r7319 r7373  
    2424
    2525namespace HeuristicLab.Problems.GeneralizedQuadraticAssignment {
    26   public interface IEquipmentAwareGQAPManipulator : IGQAPManipulator {
     26  public interface IEquipmentAwareGQAPOperator : IGQAPOperator {
    2727    ILookupParameter<DoubleArray> DemandsParameter { get; }
    2828  }
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/Operators/DemandEquivalentSwapEquipmentManipluator.cs

    r7319 r7373  
    3434  [Item("DemandEquivalentSwapEquipmentManipluator", "Swaps equipment X from location A with as much equipments from location B that the demand of X is less than or equal to the demand of the swapped equipments in B.")]
    3535  [StorableClass]
    36   public class DemandEquivalentSwapEquipmentManipluator : GQAPManipulator, ILocationAwareGQAPOperator, IEquipmentAwareGQAPManipulator {
    37    
     36  public class DemandEquivalentSwapEquipmentManipluator : GQAPManipulator, ILocationAwareGQAPOperator, IEquipmentAwareGQAPOperator {
     37
    3838    public ILookupParameter<DoubleArray> CapacitiesParameter {
    3939      get { return (ILookupParameter<DoubleArray>)Parameters["Capacities"]; }
Note: See TracChangeset for help on using the changeset viewer.