You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: MLKit/Classes/Genetic Algorithms/Genome.swift
+4-15Lines changed: 4 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -8,25 +8,14 @@
8
8
9
9
import Foundation
10
10
11
-
12
11
/// Blueprint for a Genome. It is encouraged to inherit from this base class in order to accomodate for your needs.
13
-
openclassGenome{
12
+
publicprotocolGenome{
14
13
15
14
/// Genotype representation of the genome.
16
-
publicvargenotypeRepresentation:[Float]
15
+
vargenotypeRepresentation:[Float]{getset}
17
16
18
17
/// Fitness of a particular genome.
19
-
publicvarfitness:Float=0
20
-
21
-
publicinit(genotype:[Float]){
22
-
23
-
self.genotypeRepresentation = genotype
24
-
}
18
+
varfitness:Float{getset}
25
19
26
-
// Method used to assign a fitness value for a Genome
27
-
/* This method is not given in the framework as there is no way to tell how you will evaluate fitness within your own project. Please implement your own 'generateFitness' method. An example is given in the Example Flappy Bird Game Project.
0 commit comments