Ignore:
Timestamp:
11/25/15 16:22:37 (4 years ago)
Author:
abeham
Message:

#2521:

  • Refactored QuadraticAssignmentProblem to use new SingleObjectiveProblem
    • Removed QAPEvaluator
    • Adapted RobustTabooSearch
  • Introduced several interfaces in PermutationEncoding necessary for wiring
  • Changed all Encodings to use IItem instead of IOperator in ConfigureOperators (name still unchanged)
  • Added a protected MaximizationParameter property in SingleObjectiveProblem (necessary for wiring)
  • Changed AlleleFrequnencyAnalyzer to use ISolution interface instead of IItem
  • Added a comment to ISolutionCreator<TSolution> of some changes that would be welcomed
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ProblemRefactoring/HeuristicLab.Problems.QuadraticAssignment/3.3/QuadraticAssignmentProblem.cs

    r13377 r13396  
    3838  [Creatable(CreatableAttribute.Categories.CombinatorialProblems, Priority = 140)]
    3939  [StorableClass]
    40   public sealed class QuadraticAssignmentProblem : SingleObjectiveHeuristicOptimizationProblem<IQAPEvaluator, IPermutationCreator>,
    41     ISingleObjectiveProblem<PermutationEncoding, Permutation>, IStorableContent,
     40  public sealed class QuadraticAssignmentProblem : SingleObjectiveProblem<PermutationEncoding, Permutation>,
    4241    IProblemInstanceConsumer<QAPData>,
    4342    IProblemInstanceConsumer<TSPData> {
    44     public string Filename { get; set; }
    4543
    4644    public static new Image StaticItemImage {
    47       get { return HeuristicLab.Common.Resources.VSImageLibrary.Type; }
    48     }
     45      get { return Common.Resources.VSImageLibrary.Type; }
     46    }
     47
     48    public override bool Maximization { get { return false; } }
    4949
    5050    #region Parameter Properties
     
    115115    }
    116116    public QuadraticAssignmentProblem()
    117       : base(new QAPEvaluator(), new RandomPermutationCreator()) {
     117      : base(new PermutationEncoding("Assignment") { Length = 5 }) {
    118118      Parameters.Add(new OptionalValueParameter<ItemSet<Permutation>>("BestKnownSolutions", "The list of best known solutions which is updated whenever a new better solution is found or may be the optimal solution if it is known beforehand.", null));
    119119      Parameters.Add(new OptionalValueParameter<Permutation>("BestKnownSolution", "The best known solution which is updated whenever a new better solution is found or may be the optimal solution if it is known beforehand.", null));
     
    122122      Parameters.Add(new OptionalValueParameter<DoubleValue>("LowerBound", "The Gilmore-Lawler lower bound to the solution quality."));
    123123      Parameters.Add(new OptionalValueParameter<DoubleValue>("AverageQuality", "The expected quality of a random solution."));
    124 
    125       Maximization.Value = false;
    126       MaximizationParameter.Hidden = true;
    127124
    128125      WeightsParameter.GetsCollected = false;
     
    144141      });
    145142
    146       SolutionCreator.PermutationParameter.ActualName = "Assignment";
    147       ParameterizeSolutionCreator();
    148       ParameterizeEvaluator();
    149 
    150143      InitializeOperators();
    151144      RegisterEventHandlers();
    152145    }
    153146
     147    public override double Evaluate(Permutation assignment, IRandom random) {
     148      return Evaluate(assignment);
     149    }
     150
     151    public double Evaluate(Permutation assignment) {
     152      double quality = 0;
     153      for (int i = 0; i < assignment.Length; i++) {
     154        for (int j = 0; j < assignment.Length; j++) {
     155          quality += Weights[i, j] * Distances[assignment[i], assignment[j]];
     156        }
     157      }
     158      return quality;
     159    }
     160
    154161    public override IDeepCloneable Clone(Cloner cloner) {
    155162      return new QuadraticAssignmentProblem(this, cloner);
     
    158165    [StorableHook(HookType.AfterDeserialization)]
    159166    private void AfterDeserialization() {
    160       // BackwardsCompatibility3.3
    161       #region Backwards compatible code, remove with 3.4
    162       if (!Parameters.ContainsKey("BestKnownSolutions")) {
    163         Parameters.Add(new OptionalValueParameter<ItemSet<Permutation>>("BestKnownSolutions", "The list of best known solutions which is updated whenever a new better solution is found or may be the optimal solution if it is known beforehand.", null));
    164       } else if (Parameters["BestKnownSolutions"].GetType().Equals(typeof(OptionalValueParameter<ItemList<Permutation>>))) {
    165         ItemList<Permutation> list = ((OptionalValueParameter<ItemList<Permutation>>)Parameters["BestKnownSolutions"]).Value;
    166         Parameters.Remove("BestKnownSolutions");
    167         Parameters.Add(new OptionalValueParameter<ItemSet<Permutation>>("BestKnownSolutions", "The list of best known solutions which is updated whenever a new better solution is found or may be the optimal solution if it is known beforehand.", (list != null ? new ItemSet<Permutation>(list) : null)));
    168       }
    169       if (Parameters.ContainsKey("DistanceMatrix")) {
    170         DoubleMatrix d = ((ValueParameter<DoubleMatrix>)Parameters["DistanceMatrix"]).Value;
    171         Parameters.Remove("DistanceMatrix");
    172         Parameters.Add(new ValueParameter<DoubleMatrix>("Distances", "The distance matrix which can either be specified directly without the coordinates, or can be calculated automatically from the coordinates.", d));
    173       }
    174       if (!Parameters.ContainsKey("LowerBound")) {
    175         Parameters.Add(new OptionalValueParameter<DoubleValue>("LowerBound", "The Gilmore-Lawler lower bound to the solution quality."));
    176         LowerBound = new DoubleValue(GilmoreLawlerBoundCalculator.CalculateLowerBound(Weights, Distances));
    177       }
    178       if (!Parameters.ContainsKey("AverageQuality")) {
    179         Parameters.Add(new OptionalValueParameter<DoubleValue>("AverageQuality", "The expected quality of a random solution."));
    180         AverageQuality = new DoubleValue(ComputeAverageQuality());
    181       }
    182       #endregion
    183167      RegisterEventHandlers();
    184168    }
     
    186170    #region Events
    187171    protected override void OnSolutionCreatorChanged() {
    188       SolutionCreator.PermutationParameter.ActualNameChanged += new EventHandler(SolutionCreator_PermutationParameter_ActualNameChanged);
    189       ParameterizeSolutionCreator();
    190       ParameterizeEvaluator();
    191       ParameterizeAnalyzers();
    192       ParameterizeOperators();
     172      Parameterize();
    193173      base.OnSolutionCreatorChanged();
    194174    }
    195175    protected override void OnEvaluatorChanged() {
    196       Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged);
    197       ParameterizeEvaluator();
    198       ParameterizeAnalyzers();
    199       ParameterizeOperators();
     176      Evaluator.QualityParameter.ActualNameChanged += Evaluator_QualityParameter_ActualNameChanged;
     177      Parameterize();
    200178      base.OnEvaluatorChanged();
    201179    }
    202 
    203     private void SolutionCreator_PermutationParameter_ActualNameChanged(object sender, EventArgs e) {
    204       ParameterizeEvaluator();
    205       ParameterizeAnalyzers();
    206       ParameterizeOperators();
    207     }
    208180    private void Evaluator_QualityParameter_ActualNameChanged(object sender, EventArgs e) {
    209       ParameterizeAnalyzers();
    210       ParameterizeOperators();
     181      Parameterize();
    211182    }
    212183    private void WeightsParameter_ValueChanged(object sender, EventArgs e) {
    213       Weights.RowsChanged += new EventHandler(Weights_RowsChanged);
    214       Weights.ColumnsChanged += new EventHandler(Weights_ColumnsChanged);
    215       Weights.ToStringChanged += new EventHandler(Weights_ToStringChanged);
    216       ParameterizeSolutionCreator();
    217       ParameterizeEvaluator();
    218       ParameterizeOperators();
     184      Weights.RowsChanged += Weights_RowsChanged;
     185      Weights.ColumnsChanged += Weights_ColumnsChanged;
     186      Weights.ToStringChanged += Weights_ToStringChanged;
    219187      AdjustDistanceMatrix();
    220188    }
     
    223191        ((IStringConvertibleMatrix)Weights).Columns = Weights.Rows;
    224192      else {
    225         ParameterizeSolutionCreator();
    226         ParameterizeEvaluator();
    227         ParameterizeOperators();
    228193        AdjustDistanceMatrix();
    229194      }
     
    233198        ((IStringConvertibleMatrix)Weights).Rows = Weights.Columns;
    234199      else {
    235         ParameterizeSolutionCreator();
    236         ParameterizeEvaluator();
    237         ParameterizeOperators();
    238200        AdjustDistanceMatrix();
    239201      }
     
    243205    }
    244206    private void DistancesParameter_ValueChanged(object sender, EventArgs e) {
    245       Distances.RowsChanged += new EventHandler(Distances_RowsChanged);
    246       Distances.ColumnsChanged += new EventHandler(Distances_ColumnsChanged);
    247       Distances.ToStringChanged += new EventHandler(Distances_ToStringChanged);
    248       ParameterizeSolutionCreator();
    249       ParameterizeEvaluator();
    250       ParameterizeOperators();
     207      Distances.RowsChanged += Distances_RowsChanged;
     208      Distances.ColumnsChanged += Distances_ColumnsChanged;
     209      Distances.ToStringChanged += Distances_ToStringChanged;
    251210      AdjustWeightsMatrix();
    252211    }
     
    255214        ((IStringConvertibleMatrix)Distances).Columns = Distances.Rows;
    256215      else {
    257         ParameterizeSolutionCreator();
    258         ParameterizeEvaluator();
    259         ParameterizeOperators();
    260216        AdjustWeightsMatrix();
    261217      }
     
    265221        ((IStringConvertibleMatrix)Distances).Rows = Distances.Columns;
    266222      else {
    267         ParameterizeSolutionCreator();
    268         ParameterizeEvaluator();
    269         ParameterizeOperators();
    270223        AdjustWeightsMatrix();
    271224      }
     
    277230
    278231    private void RegisterEventHandlers() {
    279       SolutionCreator.PermutationParameter.ActualNameChanged += new EventHandler(SolutionCreator_PermutationParameter_ActualNameChanged);
    280       Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged);
    281       WeightsParameter.ValueChanged += new EventHandler(WeightsParameter_ValueChanged);
    282       Weights.RowsChanged += new EventHandler(Weights_RowsChanged);
    283       Weights.ColumnsChanged += new EventHandler(Weights_ColumnsChanged);
    284       Weights.ToStringChanged += new EventHandler(Weights_ToStringChanged);
    285       DistancesParameter.ValueChanged += new EventHandler(DistancesParameter_ValueChanged);
    286       Distances.RowsChanged += new EventHandler(Distances_RowsChanged);
    287       Distances.ColumnsChanged += new EventHandler(Distances_ColumnsChanged);
    288       Distances.ToStringChanged += new EventHandler(Distances_ToStringChanged);
     232      WeightsParameter.ValueChanged += WeightsParameter_ValueChanged;
     233      Weights.RowsChanged += Weights_RowsChanged;
     234      Weights.ColumnsChanged += Weights_ColumnsChanged;
     235      Weights.ToStringChanged += Weights_ToStringChanged;
     236      DistancesParameter.ValueChanged += DistancesParameter_ValueChanged;
     237      Distances.RowsChanged += Distances_RowsChanged;
     238      Distances.ColumnsChanged += Distances_ColumnsChanged;
     239      Distances.ToStringChanged += Distances_ToStringChanged;
    289240    }
    290241
     
    297248      });
    298249      Operators.AddRange(defaultOperators);
    299       Operators.AddRange(ApplicationManager.Manager.GetInstances<IPermutationOperator>().Except(defaultOperators, new TypeEqualityComparer<IPermutationOperator>()));
    300       Operators.RemoveAll(x => x is ISingleObjectiveMoveEvaluator);
    301250      Operators.AddRange(ApplicationManager.Manager.GetInstances<IQAPMoveEvaluator>());
     251      Operators.AddRange(ApplicationManager.Manager.GetInstances<IQAPLocalImprovementOperator>());
    302252      Operators.Add(new BestQAPSolutionAnalyzer());
    303253      Operators.Add(new QAPAlleleFrequencyAnalyzer());
    304254      Operators.Add(new QAPPopulationDiversityAnalyzer());
    305255
    306       Operators.Add(new QAPExhaustiveInsertionLocalImprovement());
    307       Operators.Add(new QAPExhaustiveInversionLocalImprovement());
    308       Operators.Add(new QAPStochasticScrambleLocalImprovement());
    309       Operators.Add(new QAPExhaustiveSwap2LocalImprovement());
    310 
    311256      Operators.Add(new QAPSimilarityCalculator());
    312       ParameterizeAnalyzers();
    313       ParameterizeOperators();
    314     }
    315     private void ParameterizeSolutionCreator() {
    316       if (SolutionCreator != null) {
    317         SolutionCreator.PermutationTypeParameter.Value = new PermutationType(PermutationTypes.Absolute);
    318         SolutionCreator.LengthParameter.Value = new IntValue(Weights.Rows);
    319       }
    320     }
    321     private void ParameterizeEvaluator() {
    322       if (Evaluator != null) {
    323         Evaluator.PermutationParameter.ActualName = SolutionCreator.PermutationParameter.ActualName;
    324         Evaluator.DistancesParameter.ActualName = DistancesParameter.Name;
    325         Evaluator.WeightsParameter.ActualName = WeightsParameter.Name;
    326       }
    327     }
    328     private void ParameterizeAnalyzers() {
     257      Parameterize();
     258    }
     259    private void Parameterize() {
     260      var operators = new List<IItem>();
    329261      if (BestQAPSolutionAnalyzer != null) {
     262        operators.Add(BestQAPSolutionAnalyzer);
    330263        BestQAPSolutionAnalyzer.QualityParameter.ActualName = Evaluator.QualityParameter.ActualName;
    331264        BestQAPSolutionAnalyzer.DistancesParameter.ActualName = DistancesParameter.Name;
    332265        BestQAPSolutionAnalyzer.WeightsParameter.ActualName = WeightsParameter.Name;
    333         BestQAPSolutionAnalyzer.PermutationParameter.ActualName = SolutionCreator.PermutationParameter.ActualName;
    334         BestQAPSolutionAnalyzer.ResultsParameter.ActualName = "Results";
    335266        BestQAPSolutionAnalyzer.BestKnownQualityParameter.ActualName = BestKnownQualityParameter.Name;
    336267        BestQAPSolutionAnalyzer.BestKnownSolutionsParameter.ActualName = BestKnownSolutionsParameter.Name;
     
    338269      }
    339270      if (QAPAlleleFrequencyAnalyzer != null) {
     271        operators.Add(QAPAlleleFrequencyAnalyzer);
    340272        QAPAlleleFrequencyAnalyzer.QualityParameter.ActualName = Evaluator.QualityParameter.ActualName;
    341273        QAPAlleleFrequencyAnalyzer.BestKnownSolutionParameter.ActualName = BestKnownSolutionParameter.Name;
    342274        QAPAlleleFrequencyAnalyzer.DistancesParameter.ActualName = DistancesParameter.Name;
    343275        QAPAlleleFrequencyAnalyzer.MaximizationParameter.ActualName = MaximizationParameter.Name;
    344         QAPAlleleFrequencyAnalyzer.ResultsParameter.ActualName = "Results";
    345         QAPAlleleFrequencyAnalyzer.SolutionParameter.ActualName = SolutionCreator.PermutationParameter.ActualName;
    346276        QAPAlleleFrequencyAnalyzer.WeightsParameter.ActualName = WeightsParameter.Name;
    347277      }
    348278      if (QAPPopulationDiversityAnalyzer != null) {
     279        operators.Add(QAPPopulationDiversityAnalyzer);
    349280        QAPPopulationDiversityAnalyzer.MaximizationParameter.ActualName = MaximizationParameter.Name;
    350281        QAPPopulationDiversityAnalyzer.QualityParameter.ActualName = Evaluator.QualityParameter.ActualName;
    351         QAPPopulationDiversityAnalyzer.ResultsParameter.ActualName = "Results";
    352         QAPPopulationDiversityAnalyzer.SolutionParameter.ActualName = SolutionCreator.PermutationParameter.ActualName;
    353       }
    354     }
    355     private void ParameterizeOperators() {
    356       foreach (IPermutationCrossover op in Operators.OfType<IPermutationCrossover>()) {
    357         op.ParentsParameter.ActualName = SolutionCreator.PermutationParameter.ActualName;
    358         op.ChildParameter.ActualName = SolutionCreator.PermutationParameter.ActualName;
    359       }
    360       foreach (IPermutationManipulator op in Operators.OfType<IPermutationManipulator>()) {
    361         op.PermutationParameter.ActualName = SolutionCreator.PermutationParameter.ActualName;
    362       }
    363       foreach (IPermutationMoveOperator op in Operators.OfType<IPermutationMoveOperator>()) {
    364         op.PermutationParameter.ActualName = SolutionCreator.PermutationParameter.ActualName;
    365       }
    366       if (Operators.OfType<IMoveGenerator>().Any()) {
    367         if (Operators.OfType<IMoveGenerator>().OfType<IPermutationInversionMoveOperator>().Any()) {
    368           string inversionMove = Operators.OfType<IMoveGenerator>().OfType<IPermutationInversionMoveOperator>().First().InversionMoveParameter.ActualName;
    369           foreach (IPermutationInversionMoveOperator op in Operators.OfType<IPermutationInversionMoveOperator>())
    370             op.InversionMoveParameter.ActualName = inversionMove;
    371         }
    372         if (Operators.OfType<IMoveGenerator>().OfType<IPermutationTranslocationMoveOperator>().Any()) {
    373           string translocationMove = Operators.OfType<IMoveGenerator>().OfType<IPermutationTranslocationMoveOperator>().First().TranslocationMoveParameter.ActualName;
    374           foreach (IPermutationTranslocationMoveOperator op in Operators.OfType<IPermutationTranslocationMoveOperator>())
    375             op.TranslocationMoveParameter.ActualName = translocationMove;
    376         }
    377         if (Operators.OfType<IMoveGenerator>().OfType<IPermutationSwap2MoveOperator>().Any()) {
    378           string swapMove = Operators.OfType<IMoveGenerator>().OfType<IPermutationSwap2MoveOperator>().First().Swap2MoveParameter.ActualName;
    379           foreach (IPermutationSwap2MoveOperator op in Operators.OfType<IPermutationSwap2MoveOperator>()) {
    380             op.Swap2MoveParameter.ActualName = swapMove;
    381           }
    382         }
    383       }
    384       foreach (var op in Operators.OfType<IPermutationMultiNeighborhoodShakingOperator>())
    385         op.PermutationParameter.ActualName = SolutionCreator.PermutationParameter.ActualName;
    386 
    387       QAPExhaustiveSwap2LocalImprovement localOpt = Operators.OfType<QAPExhaustiveSwap2LocalImprovement>().SingleOrDefault();
    388       if (localOpt != null) {
    389         localOpt.AssignmentParameter.ActualName = SolutionCreator.PermutationParameter.ActualName;
     282      }
     283      foreach (var localOpt in Operators.OfType<IQAPLocalImprovementOperator>()) {
     284        operators.Add(localOpt);
    390285        localOpt.DistancesParameter.ActualName = DistancesParameter.Name;
    391286        localOpt.MaximizationParameter.ActualName = MaximizationParameter.Name;
     
    394289      }
    395290
    396       QAPSimilarityCalculator similarityCalculator = Operators.OfType<QAPSimilarityCalculator>().SingleOrDefault();
     291      foreach (var moveOp in Operators.OfType<IQAPMoveEvaluator>()) {
     292        operators.Add(moveOp);
     293        moveOp.DistancesParameter.ActualName = DistancesParameter.Name;
     294        moveOp.WeightsParameter.ActualName = WeightsParameter.Name;
     295        moveOp.QualityParameter.ActualName = Evaluator.QualityParameter.Name;
     296
     297        var swaMoveOp = moveOp as QAPSwap2MoveEvaluator;
     298        if (swaMoveOp != null) {
     299          var moveQualityName = swaMoveOp.MoveQualityParameter.ActualName;
     300          foreach (var o in Encoding.Operators.OfType<IPermutationSwap2MoveQualityOperator>())
     301            o.MoveQualityParameter.ActualName = moveQualityName;
     302        }
     303        var invMoveOp = moveOp as QAPInversionMoveEvaluator;
     304        if (invMoveOp != null) {
     305          var moveQualityName = invMoveOp.MoveQualityParameter.ActualName;
     306          foreach (var o in Encoding.Operators.OfType<IPermutationInversionMoveQualityOperator>())
     307            o.MoveQualityParameter.ActualName = moveQualityName;
     308        }
     309        var traMoveOp = moveOp as QAPTranslocationMoveEvaluator;
     310        if (traMoveOp != null) {
     311          var moveQualityName = traMoveOp.MoveQualityParameter.ActualName;
     312          foreach (var o in Encoding.Operators.OfType<IPermutationTranslocationMoveQualityOperator>())
     313            o.MoveQualityParameter.ActualName = moveQualityName;
     314        }
     315        var scrMoveOp = moveOp as QAPScrambleMoveEvaluator;
     316        if (scrMoveOp != null) {
     317          var moveQualityName = scrMoveOp.MoveQualityParameter.ActualName;
     318          foreach (var o in Encoding.Operators.OfType<IPermutationScrambleMoveQualityOperator>())
     319            o.MoveQualityParameter.ActualName = moveQualityName;
     320        }
     321      }
     322      var similarityCalculator = Operators.OfType<QAPSimilarityCalculator>().SingleOrDefault();
    397323      if (similarityCalculator != null) {
    398         similarityCalculator.SolutionVariableName = SolutionCreator.PermutationParameter.ActualName;
     324        similarityCalculator.SolutionVariableName = Encoding.Name;
    399325        similarityCalculator.QualityVariableName = Evaluator.QualityParameter.ActualName;
    400326      }
     327
     328      if (operators.Count > 0) Encoding.ConfigureOperators(operators);
    401329    }
    402330
     
    404332      if (Distances.Rows != Weights.Rows || Distances.Columns != Weights.Columns) {
    405333        ((IStringConvertibleMatrix)Distances).Rows = Weights.Rows;
     334        Encoding.Length = Weights.Rows;
    406335      }
    407336    }
     
    410339      if (Weights.Rows != Distances.Rows || Weights.Columns != Distances.Columns) {
    411340        ((IStringConvertibleMatrix)Weights).Rows = Distances.Rows;
     341        Encoding.Length = Distances.Rows;
    412342      }
    413343    }
     
    418348      LowerBound = new DoubleValue(GilmoreLawlerBoundCalculator.CalculateLowerBound(Weights, Distances, out lbSolution));
    419349      // evalute the LAP optimal solution as if it was a QAP solution
    420       var lbSolutionQuality = QAPEvaluator.Apply(lbSolution, Weights, Distances);
     350      var lbSolutionQuality = Evaluate(lbSolution);
    421351      // in case both qualities are the same it means that the LAP optimum is also a QAP optimum
    422352      if (LowerBound.Value.IsAlmost(lbSolutionQuality)) {
    423353        BestKnownSolution = lbSolution;
    424         BestKnownQuality = new DoubleValue(LowerBound.Value);
     354        BestKnownQuality = LowerBound.Value;
    425355      }
    426356      AverageQuality = new DoubleValue(ComputeAverageQuality());
     
    451381      Description = data.Description;
    452382      Load(weights, distances);
    453       if (data.BestKnownQuality.HasValue) BestKnownQuality = new DoubleValue(data.BestKnownQuality.Value);
     383      if (data.BestKnownQuality.HasValue) BestKnownQuality = data.BestKnownQuality.Value;
    454384      EvaluateAndLoadAssignment(data.BestKnownAssignment);
    455385      OnReset();
     
    466396      Description = data.Description;
    467397      Load(weights, distances);
    468       if (data.BestKnownQuality.HasValue) BestKnownQuality = new DoubleValue(data.BestKnownQuality.Value);
     398      if (data.BestKnownQuality.HasValue) BestKnownQuality = data.BestKnownQuality.Value;
    469399      EvaluateAndLoadAssignment(data.BestKnownTour);
    470400      OnReset();
     
    485415      Weights = weights;
    486416      Distances = distances;
    487 
    488       BestKnownQuality = null;
     417      Encoding.Length = weights.Rows;
     418
     419      BestKnownQualityParameter.Value = null;
    489420      BestKnownSolution = null;
    490421      BestKnownSolutions = null;
     
    495426      if (assignment == null || assignment.Length == 0) return;
    496427      var vector = new Permutation(PermutationTypes.Absolute, assignment);
    497       var result = QAPEvaluator.Apply(vector, Weights, Distances);
    498       BestKnownQuality = new DoubleValue(result);
     428      var result = Evaluate(vector);
     429      BestKnownQuality = result;
    499430      BestKnownSolution = vector;
    500       BestKnownSolutions = new ItemSet<Permutation>();
    501       BestKnownSolutions.Add((Permutation)vector.Clone());
     431      BestKnownSolutions = new ItemSet<Permutation> { (Permutation)vector.Clone() };
    502432    }
    503433  }
Note: See TracChangeset for help on using the changeset viewer.