statistics

package
v0.0.0-...-0a6770c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 26, 2018 License: AGPL-3.0 Imports: 14 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CentralMoment

func CentralMoment(games []GameStat, med float64, pow float64) float64

func Dispersion

func Dispersion(games []GameStat, med float64) float64

func FindUsefulInfoCoefs_Gradient

func FindUsefulInfoCoefs_Gradient(part, aiType int, qRead info.QReadFunc)

func GetUsefulCoefs

func GetUsefulCoefs(part, aiType int, qRead info.QReadFunc) []float64

func Medium

func Medium(games []GameStat) float64

func RunGamesWithCoefs

func RunGamesWithCoefs(count int, part int, aiType int, coefs []float64, qRead info.QReadFunc) float64

Types

type AIWithCoefs

type AIWithCoefs interface {
	SetCoefs(part int, coefs ...float64)
	GetCoefs(part int) []float64
}

type GameStat

type GameStat struct {
	Points    int                    `json:"points"`
	Step      int                    `json:"step"`
	RedTokens int                    `json:"red_tokens"`
	Values    map[game.CardColor]int `json:"table_values"`
}

type GeneticAlgorithm

type GeneticAlgorithm struct {
	Nodes       GeneticNodes
	Current     int
	GamesCounts []int
	N           []int
	LowValues   []float64
	Mutations   []float64
}

func NewGeneticAlgorithm

func NewGeneticAlgorithm() *GeneticAlgorithm

func (*GeneticAlgorithm) FindUsefulInfoV3Coefs

func (gen *GeneticAlgorithm) FindUsefulInfoV3Coefs(qRead info.QReadFunc)

func (*GeneticAlgorithm) GetRandIdx

func (gen *GeneticAlgorithm) GetRandIdx() int

func (*GeneticAlgorithm) NewDescendant

func (gen *GeneticAlgorithm) NewDescendant(idx1, idx2 int) *GeneticNode

func (*GeneticAlgorithm) NewMutationAbsolute

func (gen *GeneticAlgorithm) NewMutationAbsolute(idx int) *GeneticNode

func (*GeneticAlgorithm) NewMutationRelative

func (gen *GeneticAlgorithm) NewMutationRelative(idx int, k float64, N int) *GeneticNode

func (*GeneticAlgorithm) RunGamesWithCoefs

func (gen *GeneticAlgorithm) RunGamesWithCoefs(count int, aiTypes []int, coefs []float64, qRead info.QReadFunc) float64

type GeneticNode

type GeneticNode struct {
	Coefs   []float64
	Result  float64
	Percent float64
}

type GeneticNodes

type GeneticNodes []GeneticNode

func (GeneticNodes) Len

func (nodes GeneticNodes) Len() int

func (GeneticNodes) Less

func (nodes GeneticNodes) Less(i, j int) bool

func (GeneticNodes) Swap

func (nodes GeneticNodes) Swap(i, j int)

type Stat

type Stat struct {
	Count   int        `json:"count"`
	Wins    int        `json:"wins"`
	Medium  float64    `json:"medium"`
	Disp    float64    `json:"disp"`
	Asym    float64    `json:"asymmetry"`
	Kurt    float64    `json:"kurtosis"`
	AITypes []int      `json:"ai_types"`
	Games   []GameStat `json:"game_stat"`
}

func ReadFromFile

func ReadFromFile(dir, subdir string) (*Stat, error)

func RunGames

func RunGames(aiTypes []int, playerIds []int, count int, fUpdateReady func(*int, int), qRead info.QReadFunc, qUpdate info.QUpdateFunc) (Stat, []*game.Game)

func (*Stat) SaveExcel

func (stat *Stat) SaveExcel(path string, saveDistrInExcel bool) error

func (*Stat) SaveStat

func (stat *Stat) SaveStat(path string) error

func (*Stat) SaveToFile

func (stat *Stat) SaveToFile(dir, subdir string, saveDistrInExcel bool) error

func (*Stat) SetCharacteristics

func (stat *Stat) SetCharacteristics()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL