MGSurvE.optimization

GA Operators to calculate fitness and perform operations to search through optimization space.

Functions

calcDiscreteFitness(chromosome, landscape[, ...])

Calculates the fitness function of the landscape given a chromosome (in place, so not thread-safe).

calcDiscreteFitnessPseudoInverse(chromosome, ...)

Calculates the fitness function of the landscape given a chromosome (in place, so not thread-safe).

calcDiscreteSexFitness(chromosome[, ...])

Calculates the fitness function of a Male/Female set of landscapes with a weighted sum of the time-to catch between them.

calcFitness(chromosome[, landscape, ...])

Calculates the fitness function of the landscape given a chromosome (in place, so not thread-safe).

calcFitnessPseudoInverse(chromosome[, ...])

Calculates the fitness function of the landscape given a chromosome using the matrix pseudo-inverse function (in place, so not thread-safe).

calcSexFitness(chromosome[, landscapeMale, ...])

Calculates the fitness function of a Male/Female set of landscapes with a weighted sum of the time-to catch between them.

chromosomeIDtoXY(chromosome, ptsID, pointCoords)

Converts a sites-ID crhomosome into a set of XY or lon-lat coordinates.

cxBlend(ind1, ind2, fixedTrapsMask[, alpha])

Mates two chromosomes by "blend" based on the provided mask (in place).

cxDiscreteUniform(ind1, ind2, fixedTraps[, ...])

Mates two chromosomes in place by swapping alleles between them.

exportLog(logbook, outPath, filename)

Dumps a dataframe with the report of the GA's history.

genFixedTrapsMask(trapsFixed[, dims])

Creates a mask for the fixed traps (non-movable).

getCanonicalElements(tau, sitesN, trapsN)

Helper function to return canonical elements of the traps matrix (Q (tau), R (v), I).

getDaysTillTrapped(landscape[, fitFuns])

Gets the number of timesteps until a walker falls into a trap.

getDaysTillTrappedPseudoInverse(landscape[, ...])

Gets the number of timesteps until a walker falls into a trap (using pseudo-inverse matrix function).

getDaysTillTrappedVector(landscape[, fitFuns])

Gets the number of timesteps until a walker falls into a trap in vector form.

getFundamentalFitness(fundamentalMatrix[, ...])

Get fitness from Markov's fundamental matrix.

getFundamentalMatrix(tau, sitesN, trapsN)

Get Markov's fundamental matrix (pseudo-inverse).

getFundamentalMatrixPseudoInverse(tau, ...)

Get Markov's fundamental matrix (inverse).

getFundamentalVector(tau, sitesN)

Get Markov's fundamental vector.

getMarkovAbsorbing(tauCan, trapsN)

Get Markov's absorbing states (deprecated).

getMeanTimeToCapture(canonElems[, ...])

Calculates the average time to capture given the Q, R, I Markov canonical elements.

getTimeToCapture(landscape[, fitFuns, ...])

Wrapper function for 'getMeanTimeToCapture' given a landscape.

importLog(inPath, filename)

Gets the number of timesteps until a walker falls into a trap.

initChromosome(trapsCoords, fixedTrapsMask, ...)

Generates a random uniform chromosome for GA optimization.

initChromosomeMixed(trapsCoords, ...[, indpb])

Generates a compound chromosome for optimization with a coordinates-type composition (currently unusued).

initDiscreteChromosome(ptsIds, fixedTraps[, ...])

Generates a random uniform chromosome for discrete GA optimizations (from available sites).

mutShuffleIndexes(individual, typeOptimMask)

Shuffles allele indices in pairs.

mutateChromosome(chromosome, fixedTrapsMask)

Mutates a chromosome with a probability distribution based on the mutation mask (in place).

mutateChromosomeAsymmetric(chromosome, ...)

Mutates a chromosome with a probability distribution based on the mutation mask with different probabilities for XY elements (in place).

mutateChromosomeMixed(chromosome, ...[, ...])

Generates a compound chromosome for optimization with a coordinates-type composition (currently unusued).

mutateDiscreteChromosome(chromosome, ptsIds, ...)

Mutates a discrete chromosome from the available sites in the landscape (in place).

optimizeDiscreteTrapsGA(landscape[, ...])

Optimizes the traps' positions using a simple GA algorithm.

optimizeTrapsGA(landscape[, generations, ...])

Optimizes the traps' positions using a simple GA algorithm.

optimizeTwoSexesTrapsGA(landscapeMale, ...)

Optimizes the traps' positions using a simple GA algorithm for two-sexes kernels.

reshapeInCanonicalForm(tau, sitesN, trapsN)

Reshapes a migration matrix into canonical form (deprecated).