Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-WIC-Cnf
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
3
Issues
3
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
CommunityXG
OpenXG-WIC-Cnf
Commits
26898473
Commit
26898473
authored
Jul 31, 2020
by
Hu Jintao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加单位拓扑
parent
6a7798ab
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
96 additions
and
6 deletions
+96
-6
apps/cnf-path-computing/businessInCloud/src/main/java/top/ninwoo/test/doMap/CycleTopoUnit.java
...ud/src/main/java/top/ninwoo/test/doMap/CycleTopoUnit.java
+88
-0
apps/cnf-path-computing/businessInCloud/src/main/java/top/ninwoo/test/doMap/DoMap.java
...essInCloud/src/main/java/top/ninwoo/test/doMap/DoMap.java
+8
-6
No files found.
apps/cnf-path-computing/businessInCloud/src/main/java/top/ninwoo/test/doMap/CycleTopoUnit.java
0 → 100644
View file @
26898473
package
top.ninwoo.test.doMap
;
import
top.ninwoo.test.sateTopo.entity.SimData
;
import
top.ninwoo.test.sateTopo.entity.WeiXingData
;
import
top.ninwoo.test.sateTopo.service.impl.ToponetImpl
;
import
top.ninwoo.test.sateTopo.service.impl.WeixingImpl
;
import
java.io.File
;
import
java.util.*
;
public
class
CycleTopoUnit
{
public
static
void
main
(
String
[]
args
)
{
cycleTp
();
}
public
static
HashMap
<
Integer
,
int
[][]>
cycleTp
(){
//从文本中获取卫星的数据
WeixingImpl
wx
=
new
WeixingImpl
();
ToponetImpl
tp
=
new
ToponetImpl
();
SimData
sd
=
new
SimData
();
//tp.delHistory();
File
file
=
new
File
(
"topusim_1.txt"
);
//D:\LabratoryJavaPro\codingDownload\latestCoding\
List
<
WeiXingData
>
wxData
=
null
;
{
try
{
wxData
=
wx
.
iniTopo
(
file
,
sd
.
getZhouqi
());
}
catch
(
IllegalAccessException
e
)
{
e
.
printStackTrace
();
}
}
//初始topo
int
[][]
toponet
=
tp
.
getTopology
(
wxData
,
sd
);
//去掉ovs
int
[][]
topoNet
=
new
int
[
30
][
30
];
for
(
int
i
=
0
;
i
<
topoNet
.
length
;
i
++){
for
(
int
j
=
0
;
j
<
topoNet
.
length
;
j
++){
topoNet
[
i
][
j
]
=
toponet
[
i
][
j
];
}
}
HashMap
<
Integer
,
int
[][]>
TopoStore
=
new
HashMap
<>();
TopoStore
.
put
(
0
,
topoNet
);
for
(
int
i
=
1
;
i
<
sd
.
getZhouqi
()/
sd
.
getJiange
();
i
++)
{
int
time
=
i
*
sd
.
getJiange
();
List
<
WeiXingData
>
changetp
=
wx
.
changeTopo
(
wxData
,
time
);
int
[][]
changeTopo
=
tp
.
getTopology
(
changetp
,
sd
);
//去掉ovs
for
(
int
k
=
0
;
k
<
topoNet
.
length
;
k
++){
for
(
int
j
=
0
;
j
<
topoNet
.
length
;
j
++){
topoNet
[
k
][
j
]
=
changeTopo
[
k
][
j
];
}
}
for
(
int
k
=
0
;
k
<
topoNet
.
length
;
k
++){
for
(
int
j
=
k
+
1
;
j
<
topoNet
.
length
;
j
++){
topoNet
[
k
][
j
]
=
topoNet
[
j
][
k
];
}
}
TopoStore
.
put
(
i
,
topoNet
);
}
int
count
=
0
;
int
count2
=
-
1
;
Iterator
<
Map
.
Entry
<
Integer
,
int
[][]>>
iterator
=
TopoStore
.
entrySet
().
iterator
();
while
(
iterator
.
hasNext
()){
int
[][]
value
=
iterator
.
next
().
getValue
();
for
(
int
i
=
0
;
i
<
value
.
length
;
i
++){
if
(
i
>
0
){
boolean
equals
=
Arrays
.
equals
(
value
[
i
],
topoNet
[
i
]);
count
+=
(
equals
?
1
:
0
);
}
for
(
int
j
=
0
;
j
<
topoNet
.
length
;
j
++){
topoNet
[
i
][
j
]
=
value
[
i
][
j
];
}
}
for
(
int
k
=
0
;
k
<
topoNet
.
length
;
k
++){
for
(
int
j
=
k
+
1
;
j
<
topoNet
.
length
;
j
++){
topoNet
[
k
][
j
]
=
topoNet
[
j
][
k
];
}
}
if
(
count
!=
30
){
count2
++;
}
System
.
out
.
println
(
Arrays
.
deepToString
(
topoNet
));
System
.
out
.
println
(
"========================================="
);
System
.
out
.
println
(
count2
);
}
return
TopoStore
;
}
}
apps/cnf-path-computing/businessInCloud/src/main/java/top/ninwoo/test/doMap/DoMap.java
View file @
26898473
...
...
@@ -95,7 +95,7 @@ public class DoMap {
//slotnum = 3;
dev
=
num
*
slotnum
;
n2
=
dev
-
N_STABLE
*
slotnum
;
//组装最短路矩阵
//
1
组装最短路矩阵
double
[][]
edgeWeight
=
WTEG
();
//最短路由矩阵
/*System.out.println("DoMap直连边权重");
...
...
@@ -103,14 +103,15 @@ public class DoMap {
InterSlotDijstraV2
dijs
=
new
InterSlotDijstraV2
(
num
,
slot
);
InterSlotDijstraV2
.
pathRecord
pathRecord
=
dijs
.
dijstra
(
edgeWeight
,
testLatency
);
//2最短路由矩阵
double
[][]
lt
=
pathRecord
.
pathWeight
;
for
(
int
i
=
0
;
i
<
lt
.
length
;
i
++){
for
(
int
j
=
0
;
j
<
lt
.
length
;
j
++){
lt
[
i
][
j
]
*=
D
;
}
}
/*
System.out.println("最短路由");
System.out.println(Arrays.deepToString(lt));
*/
System
.
out
.
println
(
"最短路由"
);
System
.
out
.
println
(
Arrays
.
deepToString
(
lt
));
for
(
int
i
=
0
;
i
<
nt
.
length
;
i
++)
{
nt
[
i
]
=
(
D
*
1000
)
/
nt
[
i
];
}
...
...
@@ -139,7 +140,7 @@ public class DoMap {
for
(
int
i
=
0
;
i
<
route
.
length
;
i
++){
route
[
i
]
=
new
Stack
<
Integer
>();
}
//根据分配结果,回溯每一条路由
//
3
根据分配结果,回溯每一条路由
int
[][]
lastHop
=
pathRecord
.
lastHop
;
for
(
int
i
=
0
;
i
<
link
[
0
].
length
;
i
++){
int
start
=
best_par
.
taskfinal
[
link
[
0
][
i
]];
...
...
@@ -194,6 +195,7 @@ public class DoMap {
}
}
//组装大矩阵
private
static
double
[][]
WTEG
()
{
//获取当前3时隙拓扑
...
...
@@ -232,7 +234,7 @@ public class DoMap {
}
}
// System.out.println(Arrays.deepToString(slot1));
currentTp
=
cycleTp
.
get
((
slotKey
)%
300
+
1
);
currentTp
=
cycleTp
.
get
((
slotKey
++
)%
300
+
1
);
double
[][]
slot2
=
new
double
[
num
][
num
];
for
(
int
i
=
0
;
i
<
slot2
.
length
;
i
++){
for
(
int
j
=
0
;
j
<
slot2
.
length
;
j
++){
...
...
@@ -246,7 +248,7 @@ public class DoMap {
}
}
}
currentTp
=
cycleTp
.
get
((
slotKey
)%
300
+
1
);
currentTp
=
cycleTp
.
get
((
slotKey
++
)%
300
+
1
);
double
[][]
slot3
=
new
double
[
num
][
num
];
for
(
int
i
=
0
;
i
<
slot3
.
length
;
i
++){
for
(
int
j
=
0
;
j
<
slot3
.
length
;
j
++){
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment