Skip to contents

Swaps household-position classifications between two agents in a synthetic population.

Usage

switchHouseholdPositions(object, agent_1, agent_2)

Arguments

object

A ReplicaStructure object.

agent_1

Identifier of the first agent.

agent_2

Identifier of the second agent.

Value

An updated ReplicaStructure object.

Details

This function supports fallback partner-matching logic in replica when suitable candidates are unavailable within the preferred household-position pool.

The function:

  1. Retrieves both agents.

  2. Exchanges their household-position values.

  3. Updates the stored synthetic population.

Both agents must belong to the same neighbourhood.

Examples

if (FALSE) { # \dontrun{
hh <- switchHouseholdPositions(
  hh,
  "A001",
  "A002"
)
} # }