public void EvaluateAndLoadAssignment(int[] assignment) { if (assignment == null || assignment.Length == 0) { return; } var vector = new Permutation(PermutationTypes.Absolute, assignment); var result = QAPEvaluator.Apply(vector, Weights, Distances); BestKnownQuality = new DoubleValue(result); BestKnownSolution = vector; BestKnownSolutions = new ItemSet <Permutation>(); BestKnownSolutions.Add((Permutation)vector.Clone()); }
private void UpdateParameterValues() { Permutation lbSolution; // calculate the optimum of a LAP relaxation and use it as lower bound of our QAP LowerBound = new DoubleValue(GilmoreLawlerBoundCalculator.CalculateLowerBound(Weights, Distances, out lbSolution)); // evalute the LAP optimal solution as if it was a QAP solution var lbSolutionQuality = QAPEvaluator.Apply(lbSolution, Weights, Distances); // in case both qualities are the same it means that the LAP optimum is also a QAP optimum if (LowerBound.Value.IsAlmost(lbSolutionQuality)) { BestKnownSolution = lbSolution; BestKnownQuality = new DoubleValue(LowerBound.Value); } AverageQuality = new DoubleValue(ComputeAverageQuality()); }
protected QAPEvaluator(QAPEvaluator original, Cloner cloner) : base(original, cloner) { }