示例#1
0
M = synth.GaussianMarket(X, R)

X, R = M.sample(n_true)
M = synth.MarketDiscreteDistribution(X, R)

X = DiscreteDistribution(X)
R = DiscreteDistribution(R)

n_experiments = 800
λs = np.arange(0, 13.2, 0.2)
n = 200
δ = 0.2
βs = [1, 0.99, 0.5, 0.1, 0.01]

for β in βs:
    u = ut.LinearPlateauUtility(β, 60)
    p = pr.Problem(X.points, R.points, λ=0, u=u)

    print('Computing q⋆ for the discretized problem...')
    p.solver = None
    p.solve()
    q_star = p.q
    print('Done.')

    def R_star(q, λ=0):
        return p.total_cost(X.points, R.points, q, λ)

    def CE(q, λ=0):
        return u.inverse(-R_star(q, λ))

    R_star_q_star = R_star(q_star)
示例#2
0
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)
print('Done.')

qs = np.zeros(shape=(len(l.ns), l.n_experiments, l.p + 1))
示例#3
0
plt.rc('text', usetex=True)
plt.rc('font', serif='times')

# In[5]:

p = 6
ns = np.arange(50, 2050, 50)
n_true = 50000
n_experiments = 500
λ = 150
δ = 0.2

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

Rf = 0

# In[25]:

print(ns)

# In[26]:

# True market
R_true = NormalDistribution(8, 10)
X_true = [1 / np.sqrt(2) * StudentTDistribution(ν=4) for _ in range(p)]
M_true = synth.GaussianMarket(X_true, R_true)

# Discretized market