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
Hide 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,60 +474,63 @@ public class DoMap {
...
@@ -474,60 +474,63 @@ public class DoMap {
*/
*/
// boolean flag = true;
// boolean flag = true;
// while (flag) {
// while (flag) {
for
(
int
i
=
0
;
i
<
nn
;
i
++)
{
// while (true) {
//更新速度
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
]);
//更新速度
if
(
par
.
v
[
i
]
>
1
)
{
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
]
=
1
;
if
(
par
.
v
[
i
]
>
1
)
{
}
par
.
v
[
i
]
=
1
;
if
(
par
.
v
[
i
]
<
-
1
)
{
}
par
.
v
[
i
]
=
-
1
;
if
(
par
.
v
[
i
]
<
-
1
)
{
}
par
.
v
[
i
]
=
-
1
;
}
}
//更新位置
int
maxIndex
=
0
;
//假设第一个元素为最大值 那么下标设为0
for
(
int
i
=
0
;
i
<
par
.
v
.
length
-
1
;
i
++){
if
(
par
.
v
[
maxIndex
]<
par
.
v
[
i
+
1
]){
maxIndex
=
i
+
1
;
}
}
for
(
int
i
=
(
maxIndex
/
n2
)*
n2
;
i
<(
maxIndex
/
n2
+
1
)*
n2
;
i
++){
if
(
i
==
maxIndex
){
par
.
x
[
i
]
=
1
;
}
else
{
par
.
x
[
i
]
=
0
;
}
}
}
//更新位置
int
maxIndex
=
0
;
//假设第一个元素为最大值 那么下标设为0
/* boolean flag2 = true;
for
(
int
i
=
0
;
i
<
par
.
v
.
length
-
1
;
i
++)
{
for (int i = 0; i < nn; i += n2) {
if
(
par
.
v
[
maxIndex
]
<
par
.
v
[
i
+
1
])
{
int sum = 0;
maxIndex
=
i
+
1
;
for (int j = 0; j < n2; j++) {
}
sum += par.x[i + j];
}
}
if (sum != 1) {
for
(
int
i
=
(
maxIndex
/
n2
)
*
n2
;
i
<
(
maxIndex
/
n2
+
1
)
*
n2
;
i
++)
{
flag2 = false;
if
(
i
==
maxIndex
)
{
break;
par
.
x
[
i
]
=
1
;
}
else
{
par
.
x
[
i
]
=
0
;
}
}
}
}
if (!flag2) {
continue;
}*/
// flag = false;
//extract 提取映射结果
/* boolean flag2 = true;
par
.
task
[
0
]
=
0
;
for (int i = 0; i < nn; i += n2) {
par
.
task
[
c
-
1
]
=
dev
-
1
;
int sum = 0;
int
index
=
1
;
for (int j = 0; j < n2; j++) {
for
(
int
i
=
0
;
i
<
n1
*
n2
;
i
+=
n2
)
{
sum += par.x[i + j];
for
(
int
j
=
0
;
j
<
n2
;
j
++)
{
}
if
(
par
.
x
[
i
+
j
]
==
1
)
{
if (sum != 1) {
par
.
task
[
index
]
=
num
*(
j
/
mapdev
)
+(
j
%
mapdev
)
+
1
;
flag2 = false;
index
++;
break;
break;
}
}
}
}
}
if (!flag2) {
continue;
}*/
// flag = false;
//extract 提取映射结果
par
.
task
[
0
]
=
0
;
par
.
task
[
c
-
1
]
=
dev
-
1
;
int
index
=
1
;
for
(
int
i
=
0
;
i
<
n1
*
n2
;
i
+=
n2
)
{
for
(
int
j
=
0
;
j
<
n2
;
j
++)
{
if
(
par
.
x
[
i
+
j
]
==
1
)
{
par
.
task
[
index
]
=
num
*
(
j
/
mapdev
)
+
(
j
%
mapdev
)
+
1
;
index
++;
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