Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/31/11 11:52:11 (13 years ago)
Author:
abeham
Message:

#1628

  • Updated branch from trunk
  • Changed ReferenceEqualityComparer<T> to become a non-generic class (generic implementation probably was only made because of lacking support for co- and contravariance in C# 3.5)
  • Added finished experiment from sample algorithms to the tests
  • Wrote a unit test to instantiate every IDeepCloneable type, clone it and compare the objects in the object graph for equal references
  • Wrote a unit test to load the experiment, clone it and compare again the objects in the object graph
  • Preliminary fix for a potential bug in ThreadSafeLog
  • Preliminary fix for a potential bug in OperatorGraphVisualizationInfo
  • Preliminary fix for a potential bug in Calculator (and added license headers)
  • Preliminary fix for a potential bug in ScrambleMove
Location:
branches/GeneralizedQAP
Files:
3 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/GeneralizedQAP

  • branches/GeneralizedQAP/HeuristicLab.Problems.QuadraticAssignment/3.3/HeuristicLab.Problems.QuadraticAssignment-3.3.csproj

    r6628 r6685  
    111111    <Compile Include="Analyzers\QAPAlleleFrequencyAnalyzer.cs" />
    112112    <Compile Include="Analyzers\QAPPopulationDiversityAnalyzer.cs" />
     113    <Compile Include="Evaluators\QAPScrambleMoveEvaluator.cs" />
    113114    <Compile Include="Evaluators\QAPSwap2MoveEvaluator.cs" />
    114115    <Compile Include="Evaluators\QAPEvaluator.cs" />
  • branches/GeneralizedQAP/HeuristicLab.Problems.QuadraticAssignment/3.3/Tests/QAPMoveEvaluatorTest.cs

    r6628 r6685  
    226226    }
    227227
     228    [TestMethod]
     229    public void ScrambleMoveEvaluatorTest() {
     230      for (int i = 0; i < 500; i++) {
     231        ScrambleMove scramble = StochasticScrambleMultiMoveGenerator.GenerateRandomMove(assignment, random);
     232
     233        // SYMMETRIC MATRICES
     234        double before = QAPEvaluator.Apply(assignment, symmetricWeights, symmetricDistances);
     235        Permutation clone = new Cloner().Clone(assignment);
     236        ScrambleManipulator.Apply(assignment, scramble.StartIndex, scramble.ScrambledIndices);
     237        double after = QAPEvaluator.Apply(assignment, symmetricWeights, symmetricDistances);
     238        double move = QAPScrambleMoveEvaluator.Apply(clone, scramble, symmetricWeights, symmetricDistances);
     239        Assert.IsTrue(move.IsAlmost(after - before), "Failed on symmetric matrices");
     240
     241        // ASYMMETRIC MATRICES
     242        before = QAPEvaluator.Apply(assignment, asymmetricWeights, asymmetricDistances);
     243        clone = new Cloner().Clone(assignment);
     244        ScrambleManipulator.Apply(assignment, scramble.StartIndex, scramble.ScrambledIndices);
     245        after = QAPEvaluator.Apply(assignment, asymmetricWeights, asymmetricDistances);
     246        move = QAPScrambleMoveEvaluator.Apply(clone, scramble, asymmetricWeights, asymmetricDistances);
     247        Assert.IsTrue(move.IsAlmost(after - before), "Failed on asymmetric matrices");
     248
     249        // NON-ZERO DIAGONAL ASYMMETRIC MATRICES
     250        before = QAPEvaluator.Apply(assignment, nonZeroDiagonalWeights, nonZeroDiagonalDistances);
     251        clone = new Cloner().Clone(assignment);
     252        ScrambleManipulator.Apply(assignment, scramble.StartIndex, scramble.ScrambledIndices);
     253        after = QAPEvaluator.Apply(assignment, nonZeroDiagonalWeights, nonZeroDiagonalDistances);
     254        move = QAPScrambleMoveEvaluator.Apply(clone, scramble, nonZeroDiagonalWeights, nonZeroDiagonalDistances);
     255        Assert.IsTrue(move.IsAlmost(after - before), "Failed on non-zero diagonal matrices");
     256      }
     257    }
     258
    228259  }
    229260}
Note: See TracChangeset for help on using the changeset viewer.