scripts.allocation

Create a matrix with preferences where to move in to per household category.

The matrix will have the same dimensions as the inhabit matrix. Each row in the matrix represents one household category. The columns represent the household categories. The cells in each row are filled with values summing up to 1. A value in a cell means the following: The probability that the household with the given configuration (the row) wants to move to the dwelling type of the respective column.

From the input sheet “inputs.csv” a variant for the generation of the preference matrix must be chosen.

Currently available variant: - “current_quintile”: the preferences of the household category

are equal to the distribution of households in the inhabit matrix in the same household category (including the same quintile)

Variants in the future: - “quintile_above”: the preference of the household category in quintile qx

is equal to the distribution of households in the inhabit matrix of the same household category but in the above quintile (q{x+1})

  • “highest_quintile”: the preference of the household category in quintile x is equal to the distribution of households in the inhabit matrix of the same household category but in the highest quintile (q5)

  • “avg_highest_current_quintile”: the preference of the household category in quintile qx is equal to the average of a) the distribution of hh in the inhabit matrix of the same hh category and b) the distribution of hh in the inhabit matrix in the same hh category but in the highest quintile ((qx+q5)/2)

Functions

get_all_cases(ip)

Define all dwelling attribute modification cases and their handlers.

get_alloc_dwell_order(ip, needed_dwellings, ...)

Find available dwelling by searching through dwelling attribute modifications.

get_args_and_handler(ip, all_cases, ...)

Get handler function and arguments for modifying a dwelling attribute.

get_move_in_want(pref_v, ip, hh_stock, ...)

Calculate household move-in desires based on preferences and search rates.

get_osciallating_vals(changed_dwellings, ...)

Generate room size combinations in oscillating order for allocation search.

get_quintile_limits(df, alloc_pref_limit)

Calculate quintile-specific limits for preference allocation.

get_regtype(df[, hh_dwell])

Filter DataFrame to a specific region type (urban or rural).

get_underoccupation(ip, needed_dwellings, ...)

Calculate underoccupation level for a household-dwelling match.

other_handler(option1, option2, ...)

Toggle between two options in a dwelling configuration list.

pref_current_quintile(inhabit_v, ip, ...)

Create preference matrix from inhabit vector that focuses on the same quintile.

pref_no_underoccupation(inhabit_v, ip, ...)

Calculate preference matrix that discourages underoccupation.

pref_q4_aspiration(inhabit_v, ip, ...)

Calculate preference matrix for 'quintile 4 aspiration' setting.

pref_quintile_above(inhabit_v, ip, ...)

Calculate preference matrix for 'quintile above' setting with aspiration logic.

standard_handler(check_value, check_list, ...)

Replace values from check_list with check_value in dwelling configuration.