check_core: Core membership of an allocation

View source: R/check_core.R

check_coreR Documentation

Core membership of an allocation

Description

Check whether an allocation belongs to the core of the game, that is, whether it is efficient (the players share exactly v(N)) and coalitionally rational (every coalition S receives at least v(S)).

Usage

check_core(allocation, characteristic_func, details = FALSE)

Arguments

allocation

Numeric vector with the payoff of each player. Its length is the number of players of the game.

characteristic_func

The characteristic function of the game. It can be a numeric vector with the value of every coalition, in the order given by coalitions: of length 2^n - 1, without the empty coalition (whose value is taken as 0), or of length 2^n, with the empty coalition first. Vectors support up to 30 players. It can also be a function that receives a coalition (a vector of players) and returns its value; in that case there is no limit on the number of players.

details

If FALSE, only TRUE or FALSE is returned and the check stops at the first violated constraint. If TRUE, every constraint is checked and reported.

Details

All comparisons are exact: integer allocations are summed exactly in double precision and any other allocation is handled with exact rational arithmetic (package rcdd). Values are interpreted as the binary numbers stored by R. The value of the empty coalition is taken as 0.

When characteristic_func is a function, there is no limit on the number of players, but up to 2^n coalitions must be evaluated.

Value

If details is FALSE, TRUE if the allocation belongs to the core and FALSE otherwise. If details is TRUE, a list with:

in_core

Whether the allocation belongs to the core.

efficient

Whether the allocation is efficient.

coalitionally_rational

Whether every coalition receives at least its value.

violations

The rows of constraints that are not satisfied.

constraints

A data.frame with one row per coalition (in the order of coalitions): the payoff assigned to the coalition, its value, the slack, the relation required and whether it is satisfied.

Examples

v <- c(0, 0, 0, 2, 2, 2, 3)
check_core(c(1, 1, 1), v)
check_core(c(0, 1, 2), v)
check_core(c(0, 1, 2), v, details = TRUE)

v <- function(coalition) length(coalition)^2
check_core(rep(4, 4), v)


TUvalues documentation built on Nov. 8, 2026, 1:19 a.m.