get_fitness: Fitness function

Description Usage Arguments Value

View source: R/fitness.R

Description

This function assesses the fitness of each strategy through the use of a sequential game between each focal strategy and a fixed number of random opponents.

Usage

1
get_fitness(history, agents, payoffs, num_opponents, rounds, useC)

Arguments

history

A table of all possible prior moves of agents in sequence

agents

A list of agents whose fitness will be assessed

payoffs

A vector of the payoffs for CC (payoffs[1]), CD (payoffs[2]), DC (payoffs[3]) and DD (payoffs[4]) combinations of play choices from the focal player and the opponent

num_opponents

The number of random opponents to match the focal agent against

rounds

The number of rounds that will be played

useC

A TRUE or FALSE value that determines whether or not c will be called to calculate agent fitnesses

Value

fitness A vector in which elements correspond to the accumlated fitness (payoffs) of each agent


bradduthie/gamesGA documentation built on March 7, 2020, 2:20 p.m.