Skip to content

Commit 3707f3d

Browse files
authored
Update README.md
1 parent a08873a commit 3707f3d

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ You can find the GeneticAlgorithmEngine library on nuget.org via package name Ge
1212
- [IChromosome](#ichromosome)
1313
- [ICrossoverManager](#icrossovermanager)
1414
- [IPopulationGenerator](#ipopulationgenerator)
15+
- [Creating an Instance of GeneticSearchEngine](#creating-an-instance-of-geneticsearchengine)
1516

1617
- [Events](#events)
1718

@@ -108,12 +109,14 @@ You can also use the Pause method to pause the search, and then resume it anytim
108109
var searchEngine = new GeneticSearchEngineBuilder(POPULATION_SIZE, MAX_GENERATIONS, crossoverManager, populationGenerator)
109110
.SetMutationProbability(0.1).Build();
110111

111-
var result = searchEngine.Next();
112+
GeneticSearchResult nextGeneration = searchEngine.Next(); // Run a single generation
112113
Task.Run(() => searchEngine.Run()); // Do in a new thread, so that we don't need to wait for the engine to finish
113114
Thread.Sleep(10); // Give the engine some time to run
114115
searchEngine.Pause();
115116
var task = Task.Run(() => searchEngine.Run());
116-
var result = task.Result;
117+
GeneticSearchResult result = task.Result;
118+
119+
searchEngine.Dispose();
117120
```
118121

119122
## Events
@@ -178,7 +181,7 @@ var result = searchEngine.Run();
178181
```
179182

180183
### IPopulationRenwalManagers
181-
[PopulationRenwalManagers](/GeneticAlgorithm/Interfaces/IPopulationRenwalManager.cs) will tell the engine to renew a certain percentage of the population if some condition is met.
184+
[PopulationRenwalManagers](/GeneticAlgorithm/Interfaces/IPopulationRenwalManager.cs) will tell the engine to renew a certain percentage of the population if some condition is met. This can fix premature convergence.
182185
You can create your own managers by implementing the IPopulationRenwalManager interface, or use one of the existing managers.
183186
Note that there is no limit to the number of PopulationRenwalManagers you can add to your search engine.
184187

@@ -273,7 +276,7 @@ VectorChromosome expects an [IMutationManager<T>](#mutationmanagers) and [IEvalu
273276
{
274277
IMutationManager mutationManager = new UniformMutationManager(0, 10);
275278
IEvaluator evaluator = new BasicEvaluator();
276-
int[] vector = new int[] {1, 3, 2, 8};
279+
int[] vector = new int[] {1, 3, 2, 8};
277280
VectorChromosome<int> = new VectorChromosome<int>(vector, mutationManager, evaluator);
278281
}
279282
```
@@ -370,4 +373,4 @@ var result = searchEngine.Run();
370373
### Tutorial
371374

372375
You can find a tutorial on using an environment [here](https://github.com/ZviRosenfeld/GeneticAlgorithmEngine/wiki/Using-an-Environment).
373-
The tutorial's full source code (alone with a poorly designed GUI) is located [here](/EnvironmentGui).
376+
The tutorial's full source code (alongside a poorly designed GUI) is located [here](/EnvironmentGui).

0 commit comments

Comments
 (0)