github.com/RH12503/Triangula@v1.2.0/algorithm/data.go (about) 1 package algorithm 2 3 import "github.com/RH12503/Triangula/mutation" 4 5 // FitnessData stores the fitness of a point group. 6 type FitnessData struct { 7 Fitness float64 8 I int // The index of the point group in an Algorithm. 9 } 10 11 // MutationsData stores a set of mutations and the index of the member which each mutation came from. 12 type MutationsData struct { 13 Mutations []mutation.Mutation 14 Indexes []int // The index of the member where the mutation came from. Indexes[i] has the mutation Mutations[i]. 15 } 16 17 // Clear clears all data from the struct. 18 func (m *MutationsData) Clear() { 19 m.Mutations = m.Mutations[:0] 20 m.Indexes = m.Indexes[:0] 21 } 22 23 // Count returns the number of mutations stored. 24 func (m MutationsData) Count() int { 25 return len(m.Mutations) 26 }