Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/17/11 00:09:59 (12 years ago)
Author:
cneumuel
Message:

#1522

  • simplified check for EventHandler (by simply checking for delegate)
  • special handling types which use a hashtable internally (dictionaries, hashset, hashtable, ...) (as discussed with swagner)
  • added testcase which shows a stack overflow if ThreadLocal is included and compiler is on Debug (it does not happen in Release)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab/3.3/Tests/CollectObjectGraphTest.cs

    r6201 r6205  
    2424using System.Diagnostics;
    2525using System.Linq;
     26using System.Threading;
    2627using HeuristicLab.Algorithms.GeneticAlgorithm;
    2728using HeuristicLab.Common;
     29using HeuristicLab.Optimization;
    2830using HeuristicLab.Persistence.Default.Xml;
     31using HeuristicLab.Problems.TestFunctions;
     32using HeuristicLab.Random;
     33using HeuristicLab.SequentialEngine;
    2934using Microsoft.VisualStudio.TestTools.UnitTesting;
    3035
     
    8287      TestContext.WriteLine("");
    8388    }
     89
     90    [TestMethod]
     91    public void AlgorithmExecutions() {
     92      var random = new MersenneTwister(0);
     93      var algs = new List<IAlgorithm>();
     94
     95      Stopwatch sw = new Stopwatch();
     96      for (int i = 0; i < 100; i++) {
     97        GeneticAlgorithm ga = new GeneticAlgorithm();
     98        ga.PopulationSize.Value = 5;
     99        ga.MaximumGenerations.Value = 5;
     100        ga.Engine = new SequentialEngine();
     101        ga.Problem = new SingleObjectiveTestFunctionProblem();
     102
     103        sw.Start();
     104        algs.Add(ga);
     105
     106        var cancellationTokenSource = new CancellationTokenSource();
     107        ga.StartSync(cancellationTokenSource.Token);
     108        sw.Stop();
     109        TestContext.WriteLine("{0}: {1} ", i, sw.Elapsed);
     110        sw.Reset();
     111      }
     112    }
    84113  }
    85114}
Note: See TracChangeset for help on using the changeset viewer.