github.com/RH12503/Triangula@v1.2.0/algorithm/algorithm.go (about) 1 // Package algorithm implements optimization algorithms to triangulate an image 2 package algorithm 3 4 import ( 5 "github.com/RH12503/Triangula/normgeom" 6 "time" 7 ) 8 9 // An Algorithm is an iterative algorithm for optimizing a group of points. 10 type Algorithm interface { 11 // Step runs one generation of the algorithm. 12 Step() 13 14 // Best returns the point group with the highest fitness. 15 Best() normgeom.NormPointGroup 16 17 // Stats returns statistics relating to the algorithm. 18 Stats() Stats 19 } 20 21 // Stats contains the basic statistics of an Algorithm. 22 type Stats struct { 23 BestFitness float64 24 Generation int 25 TimeForGen time.Duration // The time taken for the last generation. 26 }