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
a87e54e4
Commit
a87e54e4
authored
Jan 07, 2026
by
Tong Li
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
半成品
parent
30b5a49e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
5 deletions
+22
-5
GeneticAlgorithm.java
...main/java/com/aps/service/Algorithm/GeneticAlgorithm.java
+6
-1
GeneticDecoder.java
src/main/java/com/aps/service/Algorithm/GeneticDecoder.java
+1
-0
ScheduleOperationService.java
...a/com/aps/service/Algorithm/ScheduleOperationService.java
+2
-2
PlanResultService.java
src/main/java/com/aps/service/plan/PlanResultService.java
+10
-0
PlanResultServiceTest.java
src/test/java/com/aps/demo/PlanResultServiceTest.java
+3
-2
No files found.
src/main/java/com/aps/service/Algorithm/GeneticAlgorithm.java
View file @
a87e54e4
...
@@ -88,7 +88,7 @@ public class GeneticAlgorithm {
...
@@ -88,7 +88,7 @@ public class GeneticAlgorithm {
List
<
Chromosome
>
population
=
initialization
.
generateInitialPopulation
(
param
,
globalOpList
);
List
<
Chromosome
>
population
=
initialization
.
generateInitialPopulation
(
param
,
globalOpList
);
population
=
chromosomeDistinct
(
population
);
population
=
chromosomeDistinct
(
population
);
...
@@ -217,6 +217,10 @@ public class GeneticAlgorithm {
...
@@ -217,6 +217,10 @@ public class GeneticAlgorithm {
FileHelper
.
writeLogFile
(
"迭代进化-----------结束-------"
);
FileHelper
.
writeLogFile
(
"迭代进化-----------结束-------"
);
best
.
setBaseTime
(
param
.
getBaseTime
());
best
.
setBaseTime
(
param
.
getBaseTime
());
if
(
best
.
getInitMachines
()==
null
)
{
best
.
setInitMachines
(
machines
);
}
best
.
setOrderMaterials
(
orderMaterials
);
best
.
setOrderMaterials
(
orderMaterials
);
best
.
setOperatRel
(
_entryRel
);
best
.
setOperatRel
(
_entryRel
);
...
@@ -288,6 +292,7 @@ public class GeneticAlgorithm {
...
@@ -288,6 +292,7 @@ public class GeneticAlgorithm {
chromosome
.
setResult
(
new
ArrayList
<>());
chromosome
.
setResult
(
new
ArrayList
<>());
// 假设Machine类有拷贝方法,或使用MapStruct等工具进行映射
// 假设Machine类有拷贝方法,或使用MapStruct等工具进行映射
chromosome
.
setInitMachines
(
ProductionDeepCopyUtil
.
deepCopyList
(
machines
));
// 简单拷贝,实际可能需要深拷贝
chromosome
.
setMachines
(
ProductionDeepCopyUtil
.
deepCopyList
(
machines
));
// 简单拷贝,实际可能需要深拷贝
chromosome
.
setMachines
(
ProductionDeepCopyUtil
.
deepCopyList
(
machines
));
// 简单拷贝,实际可能需要深拷贝
chromosome
.
setAllOperations
(
allOperations
);
// 简单拷贝,实际可能需要深拷贝
chromosome
.
setAllOperations
(
allOperations
);
// 简单拷贝,实际可能需要深拷贝
chromosome
.
setGlobalOpList
(
globalOpList
);
// 简单拷贝,实际可能需要深拷贝
chromosome
.
setGlobalOpList
(
globalOpList
);
// 简单拷贝,实际可能需要深拷贝
...
...
src/main/java/com/aps/service/Algorithm/GeneticDecoder.java
View file @
a87e54e4
...
@@ -290,6 +290,7 @@ if(finishedOrder==null||finishedOrder.size()==0)
...
@@ -290,6 +290,7 @@ if(finishedOrder==null||finishedOrder.size()==0)
int
scheduledCount
=
orderProcessCounter
.
get
(
groupId
);
int
scheduledCount
=
orderProcessCounter
.
get
(
groupId
);
List
<
Entry
>
orderOps
=
allOperations
.
stream
()
List
<
Entry
>
orderOps
=
allOperations
.
stream
()
.
filter
(
t
->
t
.
getGroupId
()
==
groupId
)
.
filter
(
t
->
t
.
getGroupId
()
==
groupId
)
.
sorted
(
Comparator
.
comparing
(
Entry:
:
getSequence
))
.
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
if
(
scheduledCount
>=
orderOps
.
size
())
{
if
(
scheduledCount
>=
orderOps
.
size
())
{
...
...
src/main/java/com/aps/service/Algorithm/ScheduleOperationService.java
View file @
a87e54e4
...
@@ -425,7 +425,7 @@ Integer newMachineId1=newMachineId.intValue();
...
@@ -425,7 +425,7 @@ Integer newMachineId1=newMachineId.intValue();
od
.
setPrevOperationId
(
id
);
od
.
setPrevOperationId
(
id
);
OperationDependency
.
add
(
od
);
OperationDependency
.
add
(
od
);
}
}
entry
.
setPrevEntryIds
(
OperationDependency
);
newOp
.
setPrevEntryIds
(
OperationDependency
);
}
}
if
(
nodeInfo
.
getNewChildIds
()!=
null
)
if
(
nodeInfo
.
getNewChildIds
()!=
null
)
{
{
...
@@ -435,7 +435,7 @@ Integer newMachineId1=newMachineId.intValue();
...
@@ -435,7 +435,7 @@ Integer newMachineId1=newMachineId.intValue();
od
.
setNextOperationId
(
id
);
od
.
setNextOperationId
(
id
);
OperationDependency
.
add
(
od
);
OperationDependency
.
add
(
od
);
}
}
entry
.
setNextEntryIds
(
OperationDependency
);
newOp
.
setNextEntryIds
(
OperationDependency
);
}
}
newOp
.
setQuantity
(
newids
.
get
(
nodeInfo
.
getOriginalId
()));
newOp
.
setQuantity
(
newids
.
get
(
nodeInfo
.
getOriginalId
()));
newOp
.
setMainId
(
MainId
);
newOp
.
setMainId
(
MainId
);
...
...
src/main/java/com/aps/service/plan/PlanResultService.java
View file @
a87e54e4
...
@@ -429,6 +429,16 @@ order.setDueDate(LocalDateTime.of(2025, 12, 1,0,0,0));
...
@@ -429,6 +429,16 @@ order.setDueDate(LocalDateTime.of(2025, 12, 1,0,0,0));
_sceneService
.
saveChromosomeToFile
(
chromosome
,
SceneId
);
_sceneService
.
saveChromosomeToFile
(
chromosome
,
SceneId
);
return
chromosome
;
return
chromosome
;
}
}
public
void
Redecode
(
String
SceneId
)
{
Chromosome
chromosome
=
_sceneService
.
loadChromosomeFromFile
(
SceneId
);
ScheduleOperationService
ScheduleOperation
=
new
ScheduleOperationService
();
GlobalParam
globalParam
=
new
GlobalParam
();
ScheduleOperation
.
redecode
(
chromosome
,
chromosome
.
getBaseTime
(),
globalParam
);
WriteScheduleSummary
(
chromosome
);
}
public
Chromosome
SpiltOperation
(
String
SceneId
,
int
opId
,
Double
[]
splitCounts
)
{
public
Chromosome
SpiltOperation
(
String
SceneId
,
int
opId
,
Double
[]
splitCounts
)
{
...
...
src/test/java/com/aps/demo/PlanResultServiceTest.java
View file @
a87e54e4
...
@@ -37,14 +37,15 @@ public class PlanResultServiceTest {
...
@@ -37,14 +37,15 @@ public class PlanResultServiceTest {
// nsgaiiUtils.Test();
// nsgaiiUtils.Test();
// planResultService.execute2("31EC5BAF7F6B41DFB79AB031D81C53C0");
// planResultService.execute2("31EC5BAF7F6B41DFB79AB031D81C53C0");
planResultService
.
execute2
(
"
4072BCD6A43B468F96489211AD041A26
"
);
planResultService
.
execute2
(
"
8B13052B347B4FC4B21D59E685B06642
"
);
// 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<>();
// List<Integer> opids=new ArrayList<>();
// opids.add(1);
// opids.add(1);
// planResultService.Move("B571EF6682DB463AB2977B1055A74112",opids,t,3403L);
// planResultService.Move("B571EF6682DB463AB2977B1055A74112",opids,t,3403L);
// planResultService.Redecode("B6AE363FF5044DDF8DECE32D5FE0F7EA");
// planResultService.Move("B571EF6682DB463AB2977B1055A74112",2,t,3243L
);
//planResultService.SpiltOperation("B6AE363FF5044DDF8DECE32D5FE0F7EA",5,new Double[]{6d, 5d}
);
}
}
@Test
@Test
...
...
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