forked from tuomasr/robust
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommon_data.py
45 lines (32 loc) · 1.06 KB
/
common_data.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
import numpy as np
np.random.seed(1)
# indices and sets
num_scenarios = 1000
scenarios = range(num_scenarios)
num_nodes = 4
nodes = range(num_nodes)
existing_units = [1, 3]
existing_lines = [0, 2]
candidate_units = [0, 2]
candidate_lines = [1, 3]
units = candidate_units + existing_units
lines = candidate_lines + existing_lines
num_lines = len(lines)
# NOTE: Make sure all parameters are floats to avoid int*float -> int type issues if using Python 2
# costs
C_g = np.array([1., 5., 5., 5.])
# generation and flow limit
G_max = np.array([[10., 10., 10., 10.]])
G_max = np.tile(G_max.transpose(), (1, num_scenarios))
G_max += np.random.uniform(-1.0, 2.0, (num_nodes, num_scenarios))
F_max = np.array([[5., 5., 5., 5.]])
F_max = np.tile(F_max.transpose(), (1, num_scenarios))
F_max += np.random.uniform(-1.5, 1.5, (num_lines, num_scenarios))
F_min = -F_max
# lines x nodes
incidence = np.array([[-1., 1., 0., 0.],
[0., -1., 1., 0.],
[0., 0., -1., 1.],
[1., 0., 0., -1.]])
# equal scenario weights
weights = np.ones(num_scenarios) / float(num_scenarios)