Пример #1
0
# Continuous market distribution
R_true = NormalDistribution(8, 10)
X_true = [StudentTDistribution(ν=4)
          for _ in range(l.p)]  # EXᵢ = 0, Var(Xᵢ) = 1
l.M_true = synth.GaussianMarket(X_true,
                                R_true)  # constant corr(Xᵢ,R) = 1/p - ε

# Discretized sampled distribution in order to have real q⋆
X, R = l.M_true.sample(l.n_true)
l.M = synth.MarketDiscreteDistribution(X, R)

l.n_experiments = 100
l.λ = 3
l.δ = 0.2
l.ns = np.arange(25, 2025, 25)
l.Rf = 0

β = 1
r_threshold = 60
l.u = ut.LinearPlateauUtility(β, r_threshold)

print('Computing q⋆ for the discretized problem...')
p_star = pr.Problem(X, R, λ=0, u=l.u)
p_star.solver = cvx.SCS
R_star_q_star = p_star.solve()
q_star = p_star.q

R_star = p_star.insample_cost
R_star_q_star = R_star(q_star)
CE_star = p_star.insample_CE
CE_star_q_star = CE_star(q_star)