optimizeUnits: Optimize units

Description Usage Arguments Details Value Examples

View source: R/simulator.R

Description

Aproximately optimize unit configuration for fixed costs.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
optimizeUnits(
  cost,
  iterations = c(5, 30, 100, 2000),
  replications = c(25, 10, 3, 1),
  rank = c("overlap", "overlap", 10, "all"),
  attacker = NULL,
  defender = NULL,
  units = c(),
  unittable = aaSimulator::lhtr2_units,
  verbose = T
)

Arguments

cost

The cost to optimize for, unit configurations must not exceed this cost

iterations

the number of iterations to run for each unit configuration.

replications

the number of replicates to run for each unit configuration

rank

number of keyword for determining which results to return. See details.

attacker

ool for attacker, NULL if attacking units are to be optimized

defender

ool for defender, NULL if defending units are to be optimized

units

the units in order of loss that should be sampled for optimization, formatted as ool. See details.

unittable

table of unit properties, formatted as unitTable

verbose

logical() whether to write progress information to stdout

Details

Runs simulation of for each possible unit configuration, respecting the order of parameter 'units', and identifies optimal configurations.

The optimal configurations returned are controlled by the parameter 'rank'. If 'rank' is an integer n, n first results will be returned, ordered by average win percentage. 'rank' may also be a keyword which will have the following effects:

'overlap'

The highest ranking result will be returned, toghether with all results where some replicate peforms at least as good as the optimum average.

'all

All results will be returned

'units' denote order of unit groups, so that units=c("inf", "arm"), will try all combinations of "inf" and "arm" allowed by the parameter 'cost', but always with all "inf" preceeding all "arm".

if 'iterations', 'replications' and 'rank' are vector of equal length, they specify a n iterative optimization, where the optimal unit configurations from the first round (optimization with interations[1], replications[1], and rank[1]) are used as the only available unit configurations for subsequent runs.

Value

list with entries formatted as formatted as simulationStats, containing stats for the optimal unit configurations. See details.

Examples

1
2
3
 results <- optimizeUnits(12, defender = "2 inf", units=c("inf", "art", "arm"),
                              iterations=100, replications=3, rank="overlap",
                              verbose=TRUE)

edvinf/aaSimulator documentation built on June 1, 2020, 12:10 p.m.