Ejemplo n.º 1
0
 internal WeightSelector(ConfigExtractor cfg, Random rnd)
 {
     selector = new RouletteSelector(rnd);
     factory  = new OperationFactory(cfg, rnd);
     ConfigureOperations(cfg);
     ConfigureWeights(cfg);
 }
Ejemplo n.º 2
0
        public virtual void TestSelector()
        {
            ConfigExtractor         extractor = GetTestConfig(false);
            RouletteSelector        selector  = new RouletteSelector(rnd);
            IList <OperationWeight> sList     = new List <OperationWeight>();
            Operation op = selector.Select(sList);

            NUnit.Framework.Assert.IsTrue(op == null);
            CreateOp cop = new CreateOp(extractor, rnd);

            sList.AddItem(new OperationWeight(cop, 1.0d));
            AppendOp aop = new AppendOp(extractor, rnd);

            sList.AddItem(new OperationWeight(aop, 0.01d));
            op = selector.Select(sList);
            NUnit.Framework.Assert.IsTrue(op == cop);
        }