func (t *Trial) Encode(enc *gob.Encoder) error {
	if err := enc.Encode(t.Id); err != nil {
		return err
	}
	if err := enc.Encode(len(t.Generations)); err != nil {
		return err
	}
	for _, e := range t.Generations {
		if err := e.Encode(enc); err != nil {
			return err
		}
	}
	return nil
}
Encode Encodes this trial
package experiment
import (
	"encoding/gob"
	"github.com/yaricom/goNEAT/v2/neat/genetics"
	"sort"
	"time"
)
type Trial struct {
	Id int
	Generations Generations
	WinnerGeneration *Generation
	Duration time.Duration
}
func (t *Trial) AvgEpochDuration() time.Duration {
	total := time.Duration(0)
	for _, i := range t.Generations {
		total += i.Duration
	}
	return total / time.Duration(len(t.Generations))
}
func (t *Trial) RecentEpochEvalTime() time.Time {
	var u time.Time
	for _, i := range t.Generations {
		if u.Before(i.Executed) {
			u = i.Executed
		}
	}
	return u
}
func (t *Trial) BestOrganism(onlySolvers bool) (*genetics.Organism, bool) {
	var orgs = make(genetics.Organisms, 0, len(t.Generations))
	for _, e := range t.Generations {
		if !onlySolvers {
			orgs = append(orgs, e.Best)
		} else if e.Solved {
			orgs = append(orgs, e.Best)
		}
	}
	if len(orgs) > 0 {
		sort.Sort(sort.Reverse(orgs))
		return orgs[0], true
	} else {
		return nil, false
	}
}
func (t *Trial) Solved() bool {
	for _, e := range t.Generations {
		if e.Solved {
			return true
		}
	}
	return false
}
func (t *Trial) BestFitness() Floats {
	var x Floats = make([]float64, len(t.Generations))
	for i, e := range t.Generations {
		x[i] = e.Best.Fitness
	}
	return x
}
func (t *Trial) BestAge() Floats {
	var x Floats = make([]float64, len(t.Generations))
	for i, e := range t.Generations {
		x[i] = float64(e.Best.Species.Age)
	}
	return x
}
func (t *Trial) BestComplexity() Floats {
	var x Floats = make([]float64, len(t.Generations))
	for i, e := range t.Generations {
		x[i] = float64(e.Best.Phenotype.Complexity())
	}
	return x
}
func (t *Trial) Diversity() Floats {
	var x Floats = make([]float64, len(t.Generations))
	for i, e := range t.Generations {
		x[i] = float64(e.Diversity)
	}
	return x
}
func (t *Trial) Average() (fitness, age, complexity Floats) {
	fitness = make(Floats, len(t.Generations))
	age = make(Floats, len(t.Generations))
	complexity = make(Floats, len(t.Generations))
	for i, e := range t.Generations {
		fitness[i], age[i], complexity[i] = e.Average()
	}
	return fitness, age, complexity
}
func (t *Trial) Winner() (nodes, genes, evals, diversity int) {
	if t.WinnerGeneration != nil {
		nodes = t.WinnerGeneration.WinnerNodes
		genes = t.WinnerGeneration.WinnerGenes
		evals = t.WinnerGeneration.WinnerEvals
		diversity = t.WinnerGeneration.Diversity
	} else {
		for _, e := range t.Generations {
			if e.Solved {
				nodes = e.WinnerNodes
				genes = e.WinnerGenes
				evals = e.WinnerEvals
				diversity = e.Diversity
				t.WinnerGeneration = &e
				break
			}
		}
	}
	return nodes, genes, evals, diversity
}