# Market input and output

OptimalApplication.SameCostsMarketType
SameCostsMarket{U<:Real}

Contains information about a college application market with identical application costs.

Constructors

SameCostsMarket(f::Vector{Float64}, t::Vector{U}, h::Integer) where {U<:Real}

Construct the SameCostsMarket defined by admissions probabilities f, utility values t, and application limit h.

julia> SameCostsMarket([0.3, 0.2, 0.05], [2, 3, 4], 2)
SameCostsMarket{Int64}(3, [0.3, 0.2, 0.05], [2, 3, 4], 2, [1, 2, 3])
SameCostsMarket(m)

Generate a random SameCostsMarket{Int} with m schools. f and t correlate negatively, mimicking a realistic market.

Internal API

This type contains the following fields:

• m: Number of schools
• f: Vector of admissions probabilities
• t: Vector of utility values (must be sorted)
• h: Number of schools student is allowed to apply to
• perm: How the input data were permuted to sort by t

U is the eltype of t.

Internally, the schools must be indexed so that t is sorted ascending. perm allows the original order to be recovered:

julia> f = rand(3); t = rand(3); mkt = SameCostsMarket(f, t, 2);

julia> t[mkt.perm] == mkt.t
true

julia> t == mkt.t[invperm(mkt.perm)]
true
source
OptimalApplication.VariedCostsMarketType
VariedCostsMarket

Contains information about a college application market with varied application costs.

Constructors

VariedCostsMarket(f::Vector{Float64}, t::Vector{Int}, g::Vector{Int}, H::Int)

Construct the VariedCostsMarket defined by admissions probabilities f, utility values t, application costs g, and application limit h.

julia> mkt = VariedCostsMarket([0.1, 0.5, 0.3, 0.1], [12, 3, 4, 13], [1, 2, 1, 1], 3)
VariedCostsMarket(4, [0.5, 0.3, 0.1, 0.1], [3, 4, 12, 13], [2, 1, 1, 1], 3, [2, 3, 1, 4])
VariedCostsMarket(m)

Generate a random SameCostsMarket{Int} with m schools. f and t correlate negatively, mimicking a realistic market. Entries of g are random integers in 5:10.

Internal API

This type contains the following fields:

• m: Number of schools
• f: Vector of admissions probabilities
• t: Vector of utility values (must be sorted)
• g: Vector of application costs
• H: Budget to spend on applications
• perm: How the input data were permuted to sort by t

Internally, the schools must be indexed so that t is sorted ascending. perm allows the original order to be recovered:

julia> f = rand(3); t = rand(3); g = rand(5:10, 3); mkt = VariedCostsMarket(f, t, g, 10);

julia> t[mkt.perm] == mkt.t
true

julia> t == mkt.t[invperm(mkt.perm)]
true
source
OptimalApplication.valuationFunction
valuation(X, mkt)

Return the valuation of the portfolio X for the market mkt, which may be either a SameCostsMarket or a VariedCostsMarket.

SameCostsMarket example (h = 3 is irrelevant):

julia> mkt = SameCostsMarket([0.1, 0.5, 0.3, 0.1], [12, 3, 4, 13], 3);

julia> round(valuation([1, 4], mkt), digits=2) # expected utility when applying to schools 1 and 4
2.38

VariedCostsMarket example (g = [1, 2, 1, 1] and H = 4 are irrelevant):

julia> mkt = VariedCostsMarket([0.1, 0.5, 0.3, 0.1], [12, 3, 4, 13], [1, 2, 1, 1], 4);

julia> round(valuation([1, 4], mkt), digits=2) # expected utility when applying to schools 1 and 4
2.38
source