-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTransportNet_project.txt
More file actions
305 lines (284 loc) · 10.2 KB
/
TransportNet_project.txt
File metadata and controls
305 lines (284 loc) · 10.2 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
Сортировка MG не нужна ?
Выделение случая ind == 0 не нужно.
Порядки по xi в M(G),M(X),Q(X) одинаковы!
(это можно сделать за один проход, так как массив $R$ и список связей упорядочены одинаково):
(2**iPrev)-1<listLimits[curr][0]<2**(iPrev+1)
Input file:
*.csv
For all edjes (x,y):
<x.vertex>,<y.vertex>[,<y.vertex>...<y.vertex>]
listX[]
listY[]
MG[x][y] <0 | 1>
MG -> MGbit[listX[indX_old]: y_bit] -> MGdec[listX[indX_old]: y_dec,indX_old] -> sort on y_dec -> MGdec[indX: y_dec,indX_old] ->
listX[indX: listX[indX_old]]
graph -> matrG -> npQX -> binMG -> listR
matrG[x][y]
npQX[kx][kx]
binMG[(bitY,kxOld)]
edge[[vertex, vertexIndxInLimit]]
connection (xbit, ybit)
xPrevConnections[(xbit, ybit)]
xPrevLimitList[(xbit, ybit)]
listLimits[(xbit, ybit)]
listR[(xbit, ybit)]
lXsort[[val, oldInd]]
lYsort[[val, oldInd]]
Graph.input() #+
MG.create(Graph) #+ MG[x][y] <0 | 1>
MG.sort_by_GammaX() #+ by GammaX
MX.create(MG) #+ = M(G) × M_T(G)
QX.create(MX) #+ All X in QX with common GammaX are cluster (?)
Limitation:=(XArrBits,YArrBits)
rLimitList := List of Limitation #listR
EMPTY_EL=-1
EMPTY_TURTLE=(EMPTY_EL,EMPTY_EL)
for x,ind in QX:
if ind == 0:
rLimitList.add_x_connection(x,binMG)
continue
else:
xPrevConnections = get_sorted_prev_connections(x,QX,binMG)
xPrevLimitList = rLimitList.get_limits(xPrevConnections)
mrgPrevLimitList = xPrevLimitList.merge_limits(x)
rLimitList.add_x_connection(x,binMG)
xPrevLimitList.add_xy_bits(x,binMG)
rLimitList.add(xPrevLimitList)
rLimitList.add(mrgPrevLimitList)
#rLimitList.check_previous_Y(x,MG)
rLimitList.output()
----
Graph.input()
dual = False
build_net_limits(dual,graph)
Graph2=Graph.make_dual()
dual = True
build_net_limits(dual,graph_dual)
-----------------
int2BinStr
print_list_xy
int2BinStr
graph_input
check_list
gen_edjes
check_list
sort_y_matrG
xbit
np.dot
np.minimum
get_x_connection
get_sorted_prev_connections
get_prev_connected_limits
add_xy_bits_to_prev
check_dupl_y_in_prev
check_prev_y_in_limits
create_limits
get_x_connection
xbit
get_sorted_prev_connections
get_prev_connected_limits
print_list_xy
get_x_connection
add_xy_bits_to_prev
xbit
print_list_xy
check_dupl_y_in_prev
print_list_xy
check_prev_y_in_limits
print_list_xy
print_list_xy
str_to_limit_side
print_limits
str_to_limit_side
make_graph_dual
build_net_limits
gen_edjes
sort_y_matrG
np.dot
np.minimum
create_limits
print_limits
------------------------
Objects:
Graph
self.dual:logical = False
self.lX:list = []
self.lY:list = []
self.nX = 0
self.nY = 0
self.gr:dict = dict()
Limits
print_limits(graph)
---------------------------
buildconstrains.BuildConstrains
graph304.csv 1 0
D:\Develop0\TestTeX\TransportNet
----------------------------
buildconstrains.FullNet
3 4
4 6 10
4 4 1
----------------------------
buildconstrains.MaxLimits
2 3
----------------------------
buildconstrains.RandomNets
4 10
------------------------
buildconstrains.CheckResource
graph300.csv rsrc00.csv 0 5
buildconstrains.CheckResource
graph300.csv rsrc00.json 0
------------------------------------------------------------------------
CREATE TABLE if not exists R_STAT (
len INTEGER PRIMARY KEY,
count INTEGER,
proc NUMERIC (4, 1)
);
CREATE TABLE if not exists GRAPH (
i_net INTEGER,
x INTEGER (2),
gx INTEGER,
CONSTRAINT U_IX UNIQUE (
i_net ASC,
x ASC
)
);
CREATE UNIQUE INDEX IF NOT EXISTS U_GRAPH_IX ON GRAPH (
i_net ASC,
x ASC
);
DROP INDEX U_GRAPH_IX;
PRAGMA foreign_keys = 1;
CREATE TABLE if not exists STATE (
state INTEGER (2),
i_net INTEGER,
nx INTEGER (2),
ny INTEGER (2),
graph_file TEXT (64),
maxlenx INTEGER (2),
maxleny INTEGER (2)
);
CREATE TABLE if not exists LIMITS (
mode INTEGER (1),
x INTEGER,
y INTEGER,
beyond_border TEXT (16),
CONSTRAINT P_LIMITS PRIMARY KEY (
mode,
x,
y
)
);
select i_net,x,gx
from graph
order by 1,2
--------------
1 37*1.35=49.95*.1.35=67.4325
2 186*0.35=65.1*0.35=22.785
3 84*0.65=54.6*0.65=35.49
4 36*1.65=59.4*1.65=98.01
343 2,35 0.8 223.7175:342=0.6541
-----------------
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-nop -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-nop</artifactId>
<version>1.7.36</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.36</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.xerial/sqlite-jdbc -->
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.46.0.1</version>
</dependency>
<dependency>
<groupId>com.codenameone</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>7.0.162</version>
</dependency>
------------------------
------------------------
python битовые операции
https://timeweb.cloud/tutorials/python/pobitovye-operatory-python-rukovodstvo
https://www.guru99.com/ru/python-matrix.html
https://silvertests.ru/GuideView.aspx?id=34372
https://www.nic.ru/help/sozdaem-matricu-v-python-poshagovaya-instrukciya_11756.html
https://timeweb.cloud/tutorials/python/kak-sozdat-matricu
https://numpy.org/devdocs/user/quickstart.html
https://sky.pro/wiki/python/rabota-s-matricami-v-python-rukovodstvo-dlya-nachinayushih/
https://timeweb.com/ru/community/articles/vidy-algoritmov-sortirovki-v-python
https://skillbox.ru/media/code/sortirovka-dannykh-v-python-chto-nuzhno-znat/
https://tproger.ru/translations/python-sorting
https://ru.wikipedia.org/wiki/Timsort
https://sky.pro/wiki/python/sortirovka-spiska-python-po-dvum-polyam-algoritm-i-resheniya/
https://docs.python.org/3/howto/sorting.html
https://informatics.msk.ru/mod/page/view.php?id=38327
https://proglib.io/p/slozhnost-algoritmov-i-operaciy-na-primere-python-2020-11-03
https://proproprogs.ru/python_base/python3-argument-key-dlya-sortirovki-kollekciy-po-klyuchu
https://datastart.ru/blog/read/top-10-bibliotek-python-dlya-data-science
https://codebra.ru/ru/lessons-python/hellopython/7/5
https://pythonworld.ru/osnovy/faq.html
https://pylot.me/article/28-lokalnie-i-globalnie-peremennie-v-python/
https://codechick.io/tutorials/python/global-local-nonlocal-variables
https://metanit.com/python/tutorial/2.9.php
https://docs-python.ru/standart-library/modul-csv-python/funktsija-reader-modulja-csv/
https://www.geeksforgeeks.org/reading-csv-files-in-python/
https://realpython.com/python-csv/
https://pythonworld.ru/moduli/modul-csv.html
python list операции со списками
https://pythonworld.ru/tipy-dannyx-v-python/spiski-list-funkcii-i-metody-spiskov.html
https://skillbox.ru/media/code/spiski-v-python-chto-eto-takoe-i-kak-s-nimi-rabotat/
https://pythonru.com/primery/python-spiski-primery
https://metanit.com/python/tutorial/3.1.php
https://ya.zerocoder.ru/pgt-rabota-so-spiskami-v-python-podrobnoe-rukovodstvo/
https://thecode.media/python-lists/
https://sky.pro/media/dobavlenie-elementa-v-slovar-v-python/
https://code.mu/ru/python/faq/add-dictionary-item/
https://devpractice.ru/python-lesson-9-dict/
https://networkx.org/documentation/stable/reference/introduction.html
https://networkx.org/nx-guides/
https://packaging.python.org/en/latest/tutorials/installing-packages/
https://sky.pro/wiki/python/sozdanie-mnogostrochnykh-kommentariev-v-python-analog/
https://pythoner.name/sort-list
https://proglib.io/p/kak-pravilno-sortirovat-dannye-v-pandas
https://ru.stackoverflow.com/questions/1414122/%D0%A1%D0%BE%D1%80%D1%82%D0%B8%D1%80%D0%BE%D0%B2%D0%BA%D0%B0-%D0%BC%D0%B0%D1%82%D1%80%D0%B8%D1%86%D1%8B-%D0%A0%D0%B0%D0%B7%D0%BC%D0%B5%D1%81%D1%82%D0%B8%D1%82%D1%8C-%D1%81%D1%82%D0%BE%D0%BB%D0%B1%D1%86%D1%8B-%D0%B2-%D0%BF%D0%BE%D1%80%D1%8F%D0%B4%D0%BA%D0%B5-%D1%83%D0%BC%D0%B5%D0%BD%D1%8C%D1%88%D0%B5%D0%BD%D0%B8%D1%8F-%D1%81%D1%83%D0%BC%D0%BC-%D0%B8%D1%85-%D1%8D%D0%BB%D0%B5%D0%BC%D0%B5%D0%BD%D1%82%D0%BE%D0%B2-%D0%B8%D1%81
http://cs.mipt.ru/advanced_python/lessons/lab16.html
https://proglib.io/p/kak-pravilno-sortirovat-dannye-v-pandas
https://skillbox.ru/media/code/vyzov-znacheniy-iz-slovarya-python/
https://tproger.ru/explain/python-dictionaries
https://pythonworld.ru/tipy-dannyx-v-python/slovari-dict-funkcii-i-metody-slovarej.html
https://pythontutor.ru/lessons/dicts/
https://www.sravni.ru/kursy/info/kak-vzyat-znachenie-iz-slovarya-python-i-ne-slomat-prilozhenie/
https://docs-python.ru/standart-library/modul-queue-python/
https://codechick.io/tutorials/python/python-thread-safe-queue
https://docs.python.org/3/library/queue.html#queue-objects
https://codeforces.com/blog/entry/78584?f0a28=2&locale=ru
https://docs-python.ru/standart-library/modul-collections-python/klass-deque-modulja-collections/
https://pythonworld.ru/moduli/modul-collections.html
https://lisiynos.github.io/s1/graph_alg_py.html
https://ru.algorithmica.org/cs/shortest-paths/bfs/
http://e-maxx.ru/algo/bfs
https://proglib.io/p/10-algoritmov-dlya-raboty-s-grafami-kotorye-dolzhen-znat-kazhdyy-koder-2022-06-17
https://dzen.ru/a/X8TLEzfe6F2Fgbme
https://neerc.ifmo.ru/wiki/index.php?title=%D0%9E%D0%B1%D1%85%D0%BE%D0%B4_%D0%B2_%D1%88%D0%B8%D1%80%D0%B8%D0%BD%D1%83
https://stackoverflow.com/questions/76994479/how-to-find-the-connected-components-of-a-networkx-graph-not-using-the-nx-conn
https://networkx.org/documentation/networkx-0.37/help.html
https://networkx.org/documentation/stable/reference/algorithms/generated/networkx.algorithms.components.connected_components.html
https://networkx.org/documentation/stable/reference/introduction.html
https://networkx.org/documentation/stable/reference/classes/index.html
https://networkx.org/documentation/stable/reference/readwrite/index.html
https://github.com/networkx/networkx
https://networkx.org/documentation/stable/reference/readwrite/index.html
https://habr.com/ru/companies/skillfactory/articles/721838/
https://habr.com/ru/articles/125898/
https://blog.skillfactory.ru/glossary/networkx/
https://bigdataschool.ru/blog/connected-components-in-directed-graph-with-networkx-in-colab.html
https://sky.pro/media/kak-proverit-sushhestvovanie-fajla-bez-ispolzovaniya-isklyuchenij-v-python/
https://pythoner.name/path-exists