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
e5b5eadb
Commit
e5b5eadb
authored
Aug 25, 2020
by
Hu Jintao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
测试转发功能融合
parent
fbbafe90
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
54 deletions
+63
-54
apps/cnf-path-computing/businessInCloud/src/main/java/top/ninwoo/test/BisheTestMain.java
...sInCloud/src/main/java/top/ninwoo/test/BisheTestMain.java
+1
-1
apps/cnf-path-computing/businessInCloud/src/main/java/top/ninwoo/test/doMap/DoMap.java
...essInCloud/src/main/java/top/ninwoo/test/doMap/DoMap.java
+61
-50
apps/cnf-path-computing/businessInDocker/src/main/resources/application.yaml
...ting/businessInDocker/src/main/resources/application.yaml
+1
-3
No files found.
apps/cnf-path-computing/businessInCloud/src/main/java/top/ninwoo/test/BisheTestMain.java
View file @
e5b5eadb
...
@@ -66,7 +66,7 @@ public class BisheTestMain implements ApplicationRunner {
...
@@ -66,7 +66,7 @@ public class BisheTestMain implements ApplicationRunner {
result
=
doMap
.
result
;
result
=
doMap
.
result
;
flag
=
repetition
(
result
);
flag
=
repetition
(
result
);
}
}
System
.
out
.
println
(
"optimal mapping scheme"
+
Arrays
.
toString
(
result
));
DataPackage
dataPackage
=
new
DataPackage
();
DataPackage
dataPackage
=
new
DataPackage
();
//路径表
//路径表
...
...
apps/cnf-path-computing/businessInCloud/src/main/java/top/ninwoo/test/doMap/DoMap.java
View file @
e5b5eadb
...
@@ -133,9 +133,9 @@ public class DoMap {
...
@@ -133,9 +133,9 @@ public class DoMap {
DoMap
doMap
=
new
DoMap
();
DoMap
doMap
=
new
DoMap
();
Par
best_par
=
doMap
.
main_bpso
(
k
,
c
,
dev
,
n1
,
n2
,
D
,
lt
,
nt
,
link
,
n
,
s
,
c1
,
c2
,
num
,
slot
,
mapdev
);
Par
best_par
=
doMap
.
main_bpso
(
k
,
c
,
dev
,
n1
,
n2
,
D
,
lt
,
nt
,
link
,
n
,
s
,
c1
,
c2
,
num
,
slot
,
mapdev
);
if
(
best_par
.
fit
!=
0
){
if
(
best_par
.
fit
!=
0
){
//
System.out.println(1 / best_par.fit);
System
.
out
.
println
(
1
/
best_par
.
fit
);
/*
System.out.println(Arrays.toString(best_par.task));
System
.
out
.
println
(
Arrays
.
toString
(
best_par
.
task
));
System.out.println(Arrays.toString(best_par.taskfinal));
*/
System
.
out
.
println
(
Arrays
.
toString
(
best_par
.
taskfinal
));
//赋值节点映射结果
//赋值节点映射结果
int
itemp
=
0
;
int
itemp
=
0
;
for
(
int
a:
best_par
.
taskfinal
for
(
int
a:
best_par
.
taskfinal
...
@@ -474,6 +474,7 @@ public class DoMap {
...
@@ -474,6 +474,7 @@ public class DoMap {
*/
*/
// boolean flag = true;
// boolean flag = true;
// while (flag) {
// while (flag) {
// while (true) {
for
(
int
i
=
0
;
i
<
nn
;
i
++)
{
for
(
int
i
=
0
;
i
<
nn
;
i
++)
{
//更新速度
//更新速度
par
.
v
[
i
]
=
s
*
par
.
v
[
i
]
+
c1
*
random
.
nextDouble
()
*
(
best_par
.
bestx
[
i
]
-
par
.
x
[
i
])
+
c2
*
random
.
nextDouble
()
*
(
par
.
bestx
[
i
]
-
par
.
x
[
i
]);
par
.
v
[
i
]
=
s
*
par
.
v
[
i
]
+
c1
*
random
.
nextDouble
()
*
(
best_par
.
bestx
[
i
]
-
par
.
x
[
i
])
+
c2
*
random
.
nextDouble
()
*
(
par
.
bestx
[
i
]
-
par
.
x
[
i
]);
...
@@ -485,21 +486,21 @@ public class DoMap {
...
@@ -485,21 +486,21 @@ public class DoMap {
}
}
}
}
//更新位置
//更新位置
int
maxIndex
=
0
;
//假设第一个元素为最大值 那么下标设为0
int
maxIndex
=
0
;
//假设第一个元素为最大值 那么下标设为0
for
(
int
i
=
0
;
i
<
par
.
v
.
length
-
1
;
i
++)
{
for
(
int
i
=
0
;
i
<
par
.
v
.
length
-
1
;
i
++)
{
if
(
par
.
v
[
maxIndex
]<
par
.
v
[
i
+
1
])
{
if
(
par
.
v
[
maxIndex
]
<
par
.
v
[
i
+
1
])
{
maxIndex
=
i
+
1
;
maxIndex
=
i
+
1
;
}
}
}
}
for
(
int
i
=
(
maxIndex
/
n2
)*
n2
;
i
<(
maxIndex
/
n2
+
1
)*
n2
;
i
++)
{
for
(
int
i
=
(
maxIndex
/
n2
)
*
n2
;
i
<
(
maxIndex
/
n2
+
1
)
*
n2
;
i
++)
{
if
(
i
==
maxIndex
)
{
if
(
i
==
maxIndex
)
{
par
.
x
[
i
]
=
1
;
par
.
x
[
i
]
=
1
;
}
else
{
}
else
{
par
.
x
[
i
]
=
0
;
par
.
x
[
i
]
=
0
;
}
}
}
}
/* boolean flag2 = true;
/* boolean flag2 = true;
for (int i = 0; i < nn; i += n2) {
for (int i = 0; i < nn; i += n2) {
int sum = 0;
int sum = 0;
for (int j = 0; j < n2; j++) {
for (int j = 0; j < n2; j++) {
...
@@ -513,7 +514,7 @@ public class DoMap {
...
@@ -513,7 +514,7 @@ public class DoMap {
if (!flag2) {
if (!flag2) {
continue;
continue;
}*/
}*/
// flag = false;
// flag = false;
//extract 提取映射结果
//extract 提取映射结果
par
.
task
[
0
]
=
0
;
par
.
task
[
0
]
=
0
;
...
@@ -522,12 +523,14 @@ public class DoMap {
...
@@ -522,12 +523,14 @@ public class DoMap {
for
(
int
i
=
0
;
i
<
n1
*
n2
;
i
+=
n2
)
{
for
(
int
i
=
0
;
i
<
n1
*
n2
;
i
+=
n2
)
{
for
(
int
j
=
0
;
j
<
n2
;
j
++)
{
for
(
int
j
=
0
;
j
<
n2
;
j
++)
{
if
(
par
.
x
[
i
+
j
]
==
1
)
{
if
(
par
.
x
[
i
+
j
]
==
1
)
{
par
.
task
[
index
]
=
num
*(
j
/
mapdev
)
+(
j
%
mapdev
)
+
1
;
par
.
task
[
index
]
=
num
*
(
j
/
mapdev
)
+
(
j
%
mapdev
)
+
1
;
index
++;
index
++;
break
;
break
;
}
}
}
}
}
}
isRepitition
(
par
.
task
);
// }
//排序
//排序
int
temp
;
int
temp
;
for
(
int
p
=
0
;
p
<(
c
-
1
);
p
++)
{
for
(
int
p
=
0
;
p
<(
c
-
1
);
p
++)
{
...
@@ -548,6 +551,14 @@ public class DoMap {
...
@@ -548,6 +551,14 @@ public class DoMap {
}
}
}
}
private
void
isRepitition
(
int
[]
task
)
{
for
(
int
i
=
1
;
i
<
task
.
length
-
1
;
i
++){
for
(
int
j
=
i
+
1
;
j
<
task
.
length
-
1
;
j
++){
if
(
task
[
i
]==
task
[
j
]
&&
task
[
j
]%
30
<
29
)
task
[
j
]+=
1
;
}
}
}
// }
// }
/**
/**
* 计算适应度值
* 计算适应度值
...
...
apps/cnf-path-computing/businessInDocker/src/main/resources/application.yaml
View file @
e5b5eadb
...
@@ -5,6 +5,4 @@ bishe:
...
@@ -5,6 +5,4 @@ bishe:
cloud-url
:
192.168.31.198:9091
cloud-url
:
192.168.31.198:9091
# cloud-url: 192.168.31.198:9090
# cloud-url: 192.168.31.198:9090
slot=20000
slot
:
20000
\ No newline at end of file
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