forked from angiuf/OLA-Project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
env_test.py
46 lines (32 loc) · 1.39 KB
/
env_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from Source.Auxiliary import *
def main():
average = np.array([[9, 10, 7],
[3, 3, 2],
[4, 4, 5],
[3, 3.5, 3],
[1.5, 2, 2]])
variance = np.array([[1, 1, 1],
[0.5, 0.5, 0.5],
[0.5, 0.5, 0.5],
[0.5, 0.5, 0.5],
[0.5, 0.5, 0.5]])
prices = generate_prices(np.array([8, 3, 5, 4, 2]))
costs = np.array([0.8, 0.3, 0.5, 0.4, 0.2])
class_probability = np.array([0.4, 0.2, 0.4])
lambdas = np.array([1, 2, 3])
alphas_par = np.array([5, 1, 1, 1, 1, 1])
np.random.seed(5)
P = np.random.uniform(0.1, 0.5, size=(5, 5, 3))
secondary_products = np.array([[1, 4],
[0, 2],
[3, 0],
[2, 4],
[0, 1]])
env1 = EnvironmentPricing(average, variance, prices, costs, lambdas, alphas_par, P, secondary_products,
class_probability=class_probability, lambda_secondary=0.5)
alphas_ratio = env1.alpha_ratio_otd()
data = env1.round_single_day(n_daily_users=100, alpha_ratio=alphas_ratio, arms_pulled=[0, 0, 0, 0, 0])
print("Customer 1:", data[0])
print("Customer 2:", data[1])
print("Customer 3:", data[2])
main()