Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
HYH.APSJ
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
佟礼
HYH.APSJ
Commits
5c497ad5
Commit
5c497ad5
authored
Jan 15, 2026
by
Tong Li
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化
parent
22c58033
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
1 deletion
+32
-1
GeneticAlgorithm.java
...main/java/com/aps/service/Algorithm/GeneticAlgorithm.java
+31
-0
PlanResultServiceTest.java
src/test/java/com/aps/demo/PlanResultServiceTest.java
+1
-1
No files found.
src/main/java/com/aps/service/Algorithm/GeneticAlgorithm.java
View file @
5c497ad5
...
@@ -275,7 +275,21 @@ public class GeneticAlgorithm {
...
@@ -275,7 +275,21 @@ public class GeneticAlgorithm {
}
}
private
List
<
Chromosome
>
chromosomeDistinct
(
List
<
Chromosome
>
population
)
private
List
<
Chromosome
>
chromosomeDistinct
(
List
<
Chromosome
>
population
)
{
{
if
(
population
==
null
)
{
FileHelper
.
writeLogFile
(
String
.
format
(
"排产-----------方案数量---%d-------"
,
0
));
return
population
;
}
FileHelper
.
writeLogFile
(
String
.
format
(
"排产-----------方案数量---%d-------"
,
population
.
size
()
));
List
<
Chromosome
>
population1
=
population
.
stream
().
filter
(
t
->
t
.
getGeneStr
()==
null
).
collect
(
Collectors
.
toList
());
if
(
population1
!=
null
&&
population1
.
size
()>
0
)
{
FileHelper
.
writeLogFile
(
String
.
format
(
"排产-----------方案GeneStrnull数量---%d-------"
,
population1
.
size
()
));
}
population
=
population
.
stream
()
population
=
population
.
stream
()
.
collect
(
Collectors
.
toMap
(
.
collect
(
Collectors
.
toMap
(
Chromosome:
:
getGeneStr
,
// key:去重的字段(GeneStr)
Chromosome:
:
getGeneStr
,
// key:去重的字段(GeneStr)
...
@@ -285,12 +299,27 @@ public class GeneticAlgorithm {
...
@@ -285,12 +299,27 @@ public class GeneticAlgorithm {
.
values
()
// 获取去重后的
.
values
()
// 获取去重后的
.
stream
()
.
stream
()
.
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
FileHelper
.
writeLogFile
(
String
.
format
(
"排产-----------方案数量---%d-------"
,
population
.
size
()
));
return
population
;
return
population
;
}
}
private
List
<
Chromosome
>
chromosomeDistinct1
(
List
<
Chromosome
>
population
)
private
List
<
Chromosome
>
chromosomeDistinct1
(
List
<
Chromosome
>
population
)
{
{
if
(
population
==
null
)
{
FileHelper
.
writeLogFile
(
String
.
format
(
"排产-----------方案数量---%d-------"
,
0
));
return
population
;
}
FileHelper
.
writeLogFile
(
String
.
format
(
"排产-----------方案数量---%d-------"
,
population
.
size
()
));
List
<
Chromosome
>
population1
=
population
.
stream
().
filter
(
t
->
t
.
getGeneStr
()==
null
).
collect
(
Collectors
.
toList
());
if
(
population1
!=
null
&&
population1
.
size
()>
0
)
{
FileHelper
.
writeLogFile
(
String
.
format
(
"排产-----------方案GeneStrnull数量---%d-------"
,
population1
.
size
()
));
}
population
=
population
.
stream
()
population
=
population
.
stream
()
.
collect
(
Collectors
.
toMap
(
.
collect
(
Collectors
.
toMap
(
Chromosome:
:
getGeneStr
,
// key:去重的字段(GeneStr)
Chromosome:
:
getGeneStr
,
// key:去重的字段(GeneStr)
...
@@ -300,6 +329,7 @@ public class GeneticAlgorithm {
...
@@ -300,6 +329,7 @@ public class GeneticAlgorithm {
.
values
()
// 获取去重后的
.
values
()
// 获取去重后的
.
stream
()
.
stream
()
.
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
FileHelper
.
writeLogFile
(
String
.
format
(
"排产-----------方案数量---%d-------"
,
population
.
size
()
));
return
population
;
return
population
;
}
}
...
@@ -355,6 +385,7 @@ public class GeneticAlgorithm {
...
@@ -355,6 +385,7 @@ public class GeneticAlgorithm {
if
(
chromosome
==
null
){
if
(
chromosome
==
null
){
System
.
out
.
println
(
"chromosome==null"
);
System
.
out
.
println
(
"chromosome==null"
);
return
;
}
}
chromosome
.
setResult
(
new
CopyOnWriteArrayList
<>());
chromosome
.
setResult
(
new
CopyOnWriteArrayList
<>());
...
...
src/test/java/com/aps/demo/PlanResultServiceTest.java
View file @
5c497ad5
...
@@ -39,7 +39,7 @@ public class PlanResultServiceTest {
...
@@ -39,7 +39,7 @@ public class PlanResultServiceTest {
// nsgaiiUtils.Test();
// nsgaiiUtils.Test();
//planResultService.execute2("C5FB5EF2A7334A0A92F826F4937E1008");
//planResultService.execute2("C5FB5EF2A7334A0A92F826F4937E1008");
// planResultService.execute2("726D4C1A712B4B1393175BD44B775B66");
// planResultService.execute2("726D4C1A712B4B1393175BD44B775B66");
planResultService
.
execute2
(
"
54476C9F81714EDC8597F5323015F58F
"
);
planResultService
.
execute2
(
"
13CC1CF783CE40D7AE3264D09FAA6378
"
);
// LocalDateTime t= LocalDateTime.of(2025, 11, 15, 6, 51, 11);
// LocalDateTime t= LocalDateTime.of(2025, 11, 15, 6, 51, 11);
// List<Integer> opids=new ArrayList<>();BCA6FA43FFA444D3952CF8F6E1EA291B
// List<Integer> opids=new ArrayList<>();BCA6FA43FFA444D3952CF8F6E1EA291B
// opids.add(1);
// opids.add(1);
...
...
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