Skip to content

Engine Class

Greg Sommerville edited this page Aug 8, 2018 · 1 revision

Engine Class

The genetic engine for Evolutionary.Net. Given a primitive set, a fitness function and a set of options, it will generate a solution to a problem.

Constructors

Variation Description
Engine<T,S>() Initializes a new instance of the engine using default values. Type T is the data type for all candidates. Type S is a user-supplied state information type.
Engine<T,S>(EngineParameters) Initializes a new instance of the engine using the settings specified in the parameter. Type T is the data type for all candidates. Type S is a user-supplied state information type.

Properties

No public properties

Methods

Name Description
AddConstant(T) Adds a constant of type T to the primitive set
AddVariable(string) Adds a variable with the specified name to the primitive set
AddFunction(Func<T,T>, string) Adds a 1 parameter function to the primitive set. Function returns a value of type T, and the argument to the function is also type T. The string parameter is the name, which is used when printing a solution via .ToString()
AddFunction(Func<T,T,T>, string) Adds a 2 parameter function to the primitive set. Function returns a value of type T, and all arguments are of type T. The string parameter is the name, which is used when printing a solution via .ToString()
AddFunction(Func<T,T,T,T>, string) Adds a 3 parameter function to the primitive set. Function returns a value of type T, and all arguments are of type T. The string parameter is the name, which is used when printing a solution via .ToString()
AddStatefulFunction(Func<T,S,T>, string) Adds a 1 parameter function to the primitive set. Function returns a value of type T, and the argument to the function is also type T. The function also receives a reference to the candidate's state object as its final parameter. The string parameter is the name, which is used when printing a solution via .ToString()
AddStatefulFunction(Func<T,T,S,T>, string) Adds a 2 parameter function to the primitive set. Function returns a value of type T, and all arguments are of type T. The function also receives a reference to the candidate's state object as its final parameter. The string parameter is the name, which is used when printing a solution via .ToString()
AddStatefulFunction(Func<T,T,T,S,T>, string) Adds a 3 parameter function to the primitive set. Function returns a value of type T, and all arguments are of type T. The function also receives a reference to the candidate's state object as its final parameter. The string parameter is the name, which is used when printing a solution via .ToString()
AddTerminalFunction(Func<S,T>, string) Adds a 0 parameter function to the primitive set. Function returns a value of type T. The function also receives a reference to the candidate's state object as its final parameter. The string parameter is the name, which is used when printing a solution via .ToString()
AddFitnessFunction(Func<CandidateSolution<T,S>,float>) Specifies the fitness function to be used to evaluate a candidate. The candidate is passed in as the parameter. The function must return a float fitness score.
AddProgressFunction(Func<EngineProgress,bool>) Specifies the progress callback function. This function is called once per generation with progress information. This function must return a bool, with true meaning that processing should continue, and false indicating that the progress should stop immediately.
FindBestSolution() Uses the provided primitive set, engine parameters, and fitness function to find a solution.

Clone this wiki locally