Learn R Programming

nlmixr2auto (version 1.0.0)

p.calculation: Calculate selection probabilities for each node

Description

Calculates the probability of selecting each node in an ant colony optimization search, based on pheromone levels \(\phi\).

Usage

p.calculation(nodeslst, prob_min = NULL)

Value

The updated node list with recalculated p values.

Arguments

nodeslst

A data frame of nodes, including columns:

phi

Current pheromone level \(\phi\)

node.no

Group ID for the decision step

p

Probability of selection (to be calculated)

prob_min

Numeric scalar. Minimum probability each node is allowed to have within its decision group. Set to NULL or 0 to disable smoothing.

Author

Zhonghui Huang

Details

Within each decision group \(G\), selection probabilities are computed from pheromone levels \(\phi\) as: $$p_i = \frac{\phi_i}{\sum_{j \in G} \phi_j}$$

If prob_min is enabled and any calculated probability falls below this value, the algorithm:

  1. Sets all probabilities below prob_min to prob_min.

  2. Redistributes the remaining probability mass proportionally among the other nodes in the same group.

This acts as a probability smoothing mechanism, preventing premature convergence by ensuring all nodes retain some chance of being explored.

Examples

Run this code
node.list <- initNodeList(search.space = "ivbase", phi0 = 1)
p.calculation(nodeslst = node.list, prob_min = 0.2)

Run the code above in your browser using DataLab