• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IEvaluator类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IEvaluator的典型用法代码示例。如果您正苦于以下问题:C# IEvaluator类的具体用法?C# IEvaluator怎么用?C# IEvaluator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IEvaluator类属于命名空间,在下文中一共展示了IEvaluator类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ConfigurationDetails

 public ConfigurationDetails(IPredicate predicate, ISerializationProvider serializationProvider, ISourceDataProvider sourceDataProvider, IEvaluator evaluator)
 {
     _predicate = predicate;
     _serializationProvider = serializationProvider;
     _sourceDataProvider = sourceDataProvider;
     _evaluator = evaluator;
 }
开发者ID:kalpesh0082,项目名称:Unicorn,代码行数:7,代码来源:ConfigurationDetails.cs


示例2: GeneticEngine

        /// <summary>
        /// Initialise a new instance of the GeneticEngine class with the supplied plug-ins and populate the initial generation.
        /// </summary>
        /// <param name="populator">The populator plug-in. Generates the initial population.</param>
        /// <param name="evaluator">The evaluator plug-in. Provides the fitness function.</param>
        /// <param name="geneticOperator">The genetic operator plug-in. Processes one generation to produce the individuals for the next.</param>
        /// <param name="terminator">The terminator plug-in. Provides the termination condition.</param>
        /// <param name="outputter">The outputter plug-in or null for no output. Outputs each generation.</param>
        /// <param name="generationFactory">The generation factory plug-in or null to use the default. Creates the generation container.</param>
        public GeneticEngine(IPopulator populator, IEvaluator evaluator, IGeneticOperator geneticOperator, ITerminator terminator, IOutputter outputter = null, IGenerationFactory generationFactory = null)
        {
            if (populator == null)
            {
                throw new GeneticEngineException("populator must not be null");
            }

            if (evaluator == null)
            {
                throw new GeneticEngineException("pvaluator must not be null");
            }

            if (geneticOperator == null)
            {
                throw new GeneticEngineException("geneticOperator must not be null");
            }

            if (terminator == null)
            {
                throw new GeneticEngineException("terminator must not be null");
            }

            this.populator = populator;
            this.evaluator = evaluator;
            this.geneticOperator = geneticOperator;
            this.terminator = terminator;
            this.outputter = outputter;
            this.generationFactory = generationFactory == null ? new AATreeGenerationFactory() : generationFactory;

            Setup();
        }
开发者ID:thepowersgang,项目名称:cits3200,代码行数:40,代码来源:GeneticEngine.cs


示例3: Verify

        public override void Verify(CommandCall commandCall, IEvaluator evaluator, IResultRecorder resultRecorder)
        {
            CommandCallList childCommands = commandCall.Children;
            childCommands.SetUp(evaluator, resultRecorder);
            childCommands.Execute(evaluator, resultRecorder);
            childCommands.Verify(evaluator, resultRecorder);

            String expression = commandCall.Expression;
            Object result = evaluator.Evaluate(expression);

            if (result != null && result is Boolean)
            {
                if ((Boolean) result)
                {
                    ProcessTrueResult(commandCall, resultRecorder);
                }
                else
                {
                    ProcessFalseResult(commandCall, resultRecorder);
                }
            }
            else
            {
                throw new InvalidExpressionException("Expression '" + expression + "' did not produce a boolean result (needed for assertTrue).");
            }
        }
开发者ID:concordion,项目名称:concordion-net,代码行数:26,代码来源:BooleanCommand.cs


示例4: TaskState

        public TaskState( NBTag tag )
        {
            if( FormatVersion != tag["FormatVersion"].GetInt() ) throw new FormatException( "Incompatible format." );
            Shapes = tag["Shapes"].GetInt();
            Vertices = tag["Vertices"].GetInt();
            ImprovementCounter = tag["ImprovementCounter"].GetInt();
            MutationCounter = tag["MutationCounter"].GetInt();
            TaskStart = DateTime.UtcNow.Subtract( TimeSpan.FromTicks( tag["ElapsedTime"].GetLong() ) );

            ProjectOptions = new ProjectOptions( tag["ProjectOptions"] );

            BestMatch = new DNA( tag["BestMatch"] );
            CurrentMatch = BestMatch;

            Initializer = (IInitializer)ModuleManager.ReadModule( tag["Initializer"] );
            Mutator = (IMutator)ModuleManager.ReadModule( tag["Mutator"] );
            Evaluator = (IEvaluator)ModuleManager.ReadModule( tag["Evaluator"] );

            byte[] imageBytes = tag["ImageData"].GetBytes();
            using( MemoryStream ms = new MemoryStream( imageBytes ) ) {
                OriginalImage = new Bitmap( ms );
            }

            var statsTag = (NBTList)tag["MutationStats"];
            foreach( NBTag stat in statsTag ) {
                MutationType mutationType = (MutationType)Enum.Parse( typeof( MutationType ), stat["Type"].GetString() );
                MutationCounts[mutationType] = stat["Count"].GetInt();
                MutationImprovements[mutationType] = stat["Sum"].GetDouble();
            }
        }
开发者ID:fragmer,项目名称:SuperImageEvolver,代码行数:30,代码来源:TaskState.cs


示例5: ConfigurationDetails

 public ConfigurationDetails(IPredicate predicate, ITargetDataStore serializationStore, ISourceDataStore sourceDataStore, IEvaluator evaluator)
 {
     _predicate = predicate;
     _serializationStore = serializationStore;
     _sourceDataStore = sourceDataStore;
     _evaluator = evaluator;
 }
开发者ID:PetersonDave,项目名称:Unicorn,代码行数:7,代码来源:ConfigurationDetails.cs


示例6: ForNode

 public ForNode(IEvaluator from, string key, string value, INode body, INode empty)
 {
     this.body = body;
     this.empty = empty;
     this.from = from;
     this.key = key;
     this.value = value;
 }
开发者ID:r3c,项目名称:cottle,代码行数:8,代码来源:ForNode.cs


示例7: SimplePlayer

        public SimplePlayer(IMoveFinder moveFinder, IEvaluator evaluator)
        {
            if (moveFinder == null) { throw new ArgumentNullException(nameof(moveFinder)); }

            MoveFinder = moveFinder;
            Evaluator = evaluator;
            _numMovesTried = 0;
        }
开发者ID:sayedihashimi,项目名称:sudoku,代码行数:8,代码来源:SimplePlayer.cs


示例8: ConfigurationDetails

		public ConfigurationDetails(IPredicate predicate, ITargetDataStore serializationStore, ISourceDataStore sourceDataStore, IEvaluator evaluator, ConfigurationDependencyResolver dependencyResolver)
		{
			_predicate = predicate;
			_serializationStore = serializationStore;
			_sourceDataStore = sourceDataStore;
			_evaluator = evaluator;
			_dependencyResolver = dependencyResolver;
		}
开发者ID:hbopuri,项目名称:Unicorn,代码行数:8,代码来源:ConfigurationDetails.cs


示例9: Trainer

 public Trainer(int nb_inputs, int[] nb_neurons_layer, int population_size, IEvaluator evaluator)
 {
     this.population = new List<DNA>();
     for(int i = 0; i < population_size; i++)
     {
         this.population.Add (new DNA(nb_inputs, nb_neurons_layer));
     }
     this.evaluator = evaluator;
 }
开发者ID:Underflow,项目名称:genetik-perceptron,代码行数:9,代码来源:Trainer.cs


示例10: Evaluate

        private static double[] Evaluate(IEvaluator evaluator, Function[] functions)
        {
            List<double> values = new List<double>();
            foreach (Function function in functions)
            {
                values.Add(evaluator.Evaluate(function));
            }

            return values.ToArray();
        }
开发者ID:mortenbakkedal,项目名称:SharpMath,代码行数:10,代码来源:Evaluator.cs


示例11: LtcService

 public LtcService(IEventLogger eventLogger, IUserUnloger userUnloger, IOsUsersReader osUsersReader, IEvaluator evaluator)
 {
     InitializeComponent();
     Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory);
     _notAdminUserLoggedIn = false;
     _eventLogger = eventLogger;
     _userUnloger = userUnloger;
     _osUsersReader = osUsersReader;
     _evaluator = evaluator;
 }
开发者ID:sarochm,项目名称:ltc,代码行数:10,代码来源:LtcService.cs


示例12: increaseLevel

 private void increaseLevel(IEvaluator evaluator)
 {
     if (evaluator.GetVariable(LEVEL_VARIABLE) == null)
     {
         evaluator.SetVariable(LEVEL_VARIABLE, 1);
     }
     else
     {
         evaluator.SetVariable(LEVEL_VARIABLE, 1 + (int)evaluator.GetVariable(LEVEL_VARIABLE));
     }
 }
开发者ID:concordion,项目名称:concordion-net,代码行数:11,代码来源:ListExecuteStrategy.cs


示例13: Verify

 public override void Verify(CommandCall commandCall, IEvaluator evaluator, IResultRecorder resultRecorder)
 {
     try
     {
         m_command.Verify(commandCall, evaluator, resultRecorder);
     }
     catch (Exception e)
     {
         resultRecorder.Record(Result.Exception);
         AnnounceThrowableCaught(commandCall.Element, e, commandCall.Expression);
     }
 }
开发者ID:john-ross,项目名称:concordion-net,代码行数:12,代码来源:ExceptionCatchingDecorator.cs


示例14: Process

        public void Process(IUrlParser parser, IEvaluator evaluator)
        {
            if (parser == null) throw new ArgumentNullException("parser");
            if (evaluator == null) throw new ArgumentNullException("evaluator");

            var words = parser.Parse(_url);
            var buzzwords = words.Where(evaluator.IsBuzzword);
            foreach (var buzzword in buzzwords)
            {
                ApplyEvent(new BuzzwordFoundEvent(buzzword));
            }
        }
开发者ID:michael-ell,项目名称:Buzz,代码行数:12,代码来源:Feed.cs


示例15: Execute

 public override void Execute(CommandCall commandCall, IEvaluator evaluator, IResultRecorder resultRecorder)
 {
     try
     {
         m_command.Execute(commandCall, evaluator, resultRecorder);
     }
     catch (Exception e)
     {
         resultRecorder.Record(Result.Exception);
         OnExceptionCaught(commandCall.Element, e, commandCall.Expression);
     }
 }
开发者ID:ManiAzizzadeh,项目名称:Concordion.NET,代码行数:12,代码来源:ExceptionCatchingDecorator.cs


示例16: Execute

 public override void Execute(CommandCall commandCall, IEvaluator evaluator, IResultRecorder resultRecorder)
 {
     try
     {
         m_command.Execute(commandCall, evaluator, resultRecorder);
     }
     catch (Exception e)
     {
         resultRecorder.Error(e);
         AnnounceThrowableCaught(commandCall.Element, e, commandCall.Expression);
     }
 }
开发者ID:concordion,项目名称:concordion-net,代码行数:12,代码来源:ExceptionCatchingDecorator.cs


示例17: Execute

        public override void Execute(CommandCall commandCall, IEvaluator evaluator, IResultRecorder resultRecorder)
        {
            Check.IsFalse(commandCall.HasChildCommands, "Nesting commands inside a 'run' is not supported");

            var element = commandCall.Element;

            var href = element.GetAttributeValue("href");
            Check.NotNull(href, "The 'href' attribute must be set for an element containing concordion:run");

            var runnerType = commandCall.Expression;
            var expression = element.GetAttributeValue("params", "concordion");

            if (expression != null)
            {
                evaluator.Evaluate(expression);
            }

            try
            {
                IRunner concordionRunner;
                Runners.TryGetValue(runnerType, out concordionRunner);

                // TODO - re-check this.
                Check.NotNull(concordionRunner, "The runner '" + runnerType + "' cannot be found. "
                        + "Choices: (1) Use 'concordion' as your runner (2) Ensure that the 'concordion.runner." + runnerType
                        + "' System property is set to a name of an IRunner implementation "
                        + "(3) Specify an assembly fully qualified class name of an IRunner implementation");

                var result = concordionRunner.Execute(evaluator.Fixture, commandCall.Resource, href).Result;

                if (result == Result.Success)
                {
                    resultRecorder.Success();
                    AnnounceSuccess(element);
                }
                else if (result == Result.Ignored)
                {
                    resultRecorder.Ignore();
                    AnnounceIgnored(element);
                }
                else
                {
                    resultRecorder.Failure(string.Format("test {0} failed", href), commandCall.Element.ToXml());
                    AnnounceFailure(element);
                }
            }
            catch (Exception e)
            {
                resultRecorder.Error(e);
                AnnounceError(e, element, expression);
            }
        }
开发者ID:concordion,项目名称:concordion-net,代码行数:52,代码来源:RunCommand.cs


示例18: Execute

 public void Execute(CommandCall commandCall, IEvaluator evaluator, IResultRecorder resultRecorder)
 {
     IExecuteStrategy strategy;
     if (commandCall.Element.IsNamed("table"))
     {
         strategy = new TableExecuteStrategy();
     }
     else
     {
         strategy = new DefaultExecuteStrategy();
     }
     strategy.Execute(commandCall, evaluator, resultRecorder);
 }
开发者ID:ManiAzizzadeh,项目名称:Concordion.NET,代码行数:13,代码来源:ExecuteCommand.cs


示例19: Verify

        public void Verify(CommandCall commandCall, IEvaluator evaluator, IResultRecorder resultRecorder)
        {
            var pattern = new Regex("(#.+?) *: *(.+)");
            var matcher = pattern.Match(commandCall.Expression);
            if (!matcher.Success)
            {
                throw new InvalidOperationException("The expression for a \"verifyRows\" should be of the form: #var : collectionExpr");
            }

            var loopVariableName = matcher.Groups[1].Value;
            var iterableExpression = matcher.Groups[2].Value;

            var obj = evaluator.Evaluate(iterableExpression);

            Check.NotNull(obj, "Expression returned null (should be an IEnumerable).");
            Check.IsTrue(obj is IEnumerable, obj.GetType() + " is not IEnumerable");
            Check.IsTrue(!(obj is IDictionary), obj.GetType() + " does not have a predictable iteration order");

            var iterable = (IEnumerable)obj;

            var tableSupport = new TableSupport(commandCall);
            var detailRows = tableSupport.GetDetailRows();

            AnnounceExpressionEvaluated(commandCall.Element);

            int index = 0;
            foreach (var loopVar in iterable)
            {
                evaluator.SetVariable(loopVariableName, loopVar);
                Row detailRow;
                if (detailRows.Count > index)
                {
                    detailRow = detailRows[index];
                }
                else
                {
                    detailRow = tableSupport.AddDetailRow();
                    AnnounceSurplusRow(detailRow.RowElement);
                }
                tableSupport.CopyCommandCallsTo(detailRow);
                commandCall.Children.Verify(evaluator, resultRecorder);
                index++;
            }

            for (; index < detailRows.Count; index++) {
                Row detailRow = detailRows[index];
                resultRecorder.Record(Result.Failure);
                AnnounceMissingRow(detailRow.RowElement);
            }
        }
开发者ID:john-ross,项目名称:concordion-net,代码行数:50,代码来源:VerifyRowsCommand.cs


示例20: SerializationLoader

        public SerializationLoader(ITargetDataStore targetDataStore, ISourceDataStore sourceDataStore, IPredicate predicate, IEvaluator evaluator, ISerializationLoaderLogger logger, PredicateRootPathResolver predicateRootPathResolver)
        {
            Assert.ArgumentNotNull(targetDataStore, "serializationProvider");
            Assert.ArgumentNotNull(sourceDataStore, "sourceDataStore");
            Assert.ArgumentNotNull(predicate, "predicate");
            Assert.ArgumentNotNull(evaluator, "evaluator");
            Assert.ArgumentNotNull(logger, "logger");
            Assert.ArgumentNotNull(predicateRootPathResolver, "predicateRootPathResolver");

            Logger = logger;
            PredicateRootPathResolver = predicateRootPathResolver;
            Evaluator = evaluator;
            Predicate = predicate;
            TargetDataStore = targetDataStore;
            SourceDataStore = sourceDataStore;
        }
开发者ID:bllue78,项目名称:Unicorn,代码行数:16,代码来源:SerializationLoader.cs



注:本文中的IEvaluator类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IEvent类代码示例发布时间:2022-05-24
下一篇:
C# IEulerPluginContext类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap