本文整理汇总了C#中IEvaluator类的典型用法代码示例。如果您正苦于以下问题:C# IEvaluator类的具体用法?C# IEvaluator怎么用?C# IEvaluator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IEvaluator类属于命名空间,在下文中一共展示了IEvaluator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ConfigurationDetails
public ConfigurationDetails(IPredicate predicate, ISerializationProvider serializationProvider, ISourceDataProvider sourceDataProvider, IEvaluator evaluator)
{
_predicate = predicate;
_serializationProvider = serializationProvider;
_sourceDataProvider = sourceDataProvider;
_evaluator = evaluator;
}
示例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();
}
示例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).");
}
}
示例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();
}
}
示例5: ConfigurationDetails
public ConfigurationDetails(IPredicate predicate, ITargetDataStore serializationStore, ISourceDataStore sourceDataStore, IEvaluator evaluator)
{
_predicate = predicate;
_serializationStore = serializationStore;
_sourceDataStore = sourceDataStore;
_evaluator = evaluator;
}
示例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;
}
示例7: SimplePlayer
public SimplePlayer(IMoveFinder moveFinder, IEvaluator evaluator)
{
if (moveFinder == null) { throw new ArgumentNullException(nameof(moveFinder)); }
MoveFinder = moveFinder;
Evaluator = evaluator;
_numMovesTried = 0;
}
示例8: ConfigurationDetails
public ConfigurationDetails(IPredicate predicate, ITargetDataStore serializationStore, ISourceDataStore sourceDataStore, IEvaluator evaluator, ConfigurationDependencyResolver dependencyResolver)
{
_predicate = predicate;
_serializationStore = serializationStore;
_sourceDataStore = sourceDataStore;
_evaluator = evaluator;
_dependencyResolver = dependencyResolver;
}
示例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;
}
示例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();
}
示例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;
}
示例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));
}
}
示例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);
}
}
示例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));
}
}
示例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);
}
}