genalg: Function implements genetic algorithm.

Description Usage Arguments Value

View source: R/genalg.R

Description

A single speciman consists of *num_stock* stocks, each encoded by *num_genes* bits. Therefore a speciman is encoded with num_genes * num_stocks bits. During each iteration only a single stock (bits encoding one stock) is taken into accunt for crossover.

Usage

1
2
3
genalg(num_iter = 200, num_spec = 400, num_genes = 10, p_cross = 0.9,
  p_mutant = 0.01, num_stocks. = num_stocks,
  expectedReturn. = expectedReturn)

Arguments

num_iter

Number of iterations

num_spec

Number of specimen (must be even)

num_genes

Number of number of bits encoding a single stock

p_cross

Crossing-over probability

p_mutant

Mutation probability

num_stocks.

Number of stocks in analysis

expectedReturn.

Vector of expected returns (returned by prepareData)

Value

List with the following components:

$value - maximum adaptaion for each generation

$avg - average adaptation for each generation

$std - standard deviation of adaptation for each generation

$specimen - Sequence of bits encoding the best speciman in each generation

$popul - the whole population for the first and the last generation


rpietrusinski/GA-stock-prices documentation built on May 20, 2019, 5:43 p.m.