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
d316b05b
Commit
d316b05b
authored
Jun 11, 2026
by
Tong Li
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug
parent
f322e462
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
9 deletions
+32
-9
GeneticAlgorithm.java
...main/java/com/aps/service/Algorithm/GeneticAlgorithm.java
+1
-1
GeneticDecoder.java
src/main/java/com/aps/service/Algorithm/GeneticDecoder.java
+27
-6
HybridAlgorithm.java
src/main/java/com/aps/service/Algorithm/HybridAlgorithm.java
+1
-1
PlanResultService.java
src/main/java/com/aps/service/plan/PlanResultService.java
+1
-1
PlanResultServiceTest.java
src/test/java/com/aps/demo/PlanResultServiceTest.java
+2
-0
No files found.
src/main/java/com/aps/service/Algorithm/GeneticAlgorithm.java
View file @
d316b05b
...
...
@@ -366,7 +366,7 @@ public class GeneticAlgorithm {
FileHelper
.
writeLogFile
(
"解码---------------"
+
population
.
size
()
);
GeneticDecoder
decoder
=
new
GeneticDecoder
(
_GlobalParam
,
param
.
getBaseTime
(),
machines
,
orders
,
materials
,
machineScheduler
,
materialRequirementService
,
sceneId
);
boolean
ismore
=
tru
e
;
boolean
ismore
=
fals
e
;
if
(
ismore
)
{
CompletableFuture
.
allOf
(
population
.
stream
()
.
map
(
chromosome
->
CompletableFuture
.
runAsync
(()
->
decode
(
decoder
,
chromosome
,
param
,
allOperations
,
globalOpList
),
decodeExecutor
))
...
...
src/main/java/com/aps/service/Algorithm/GeneticDecoder.java
View file @
d316b05b
...
...
@@ -102,7 +102,7 @@ public class GeneticDecoder {
{
FileHelper
.
writeLogFile
(
"解码---------------"
+
population
.
size
()
);
boolean
ismore
=
tru
e
;
boolean
ismore
=
fals
e
;
if
(
ismore
)
{
CompletableFuture
.
allOf
(
population
.
stream
()
.
map
(
chromosome
->
CompletableFuture
.
runAsync
(()
->
decodeChromosomeWithCache
(
chromosome
,
false
),
decodeExecutor
))
...
...
@@ -505,6 +505,8 @@ public class GeneticDecoder {
long
decodeStart
=
System
.
nanoTime
();
chromosome
.
setScenarioID
(
sceneId
);
boolean
isJit
=
_globalParam
.
isJit
();
if
(
rebuildStructureForCurrentDecode
)
{
long
t1
=
System
.
nanoTime
();
//创建半成品订单
...
...
@@ -558,6 +560,7 @@ public class GeneticDecoder {
}
}
if
(
rebuildStructureForCurrentDecode
&&
_globalParam
.
isIsCheckSf
())
{
long
t1
=
System
.
nanoTime
();
int
isnew
=
generateGlobalOpList
(
chromosome
);
...
...
@@ -677,12 +680,13 @@ public class GeneticDecoder {
int
opCount
=
0
;
long
slowOpThresholdNs
=
500_000_000L
;
// 500ms
for
(
int
groupId
:
chromosome
.
getOperationSequencing
())
{
int
scheduledCount
=
orderProcessCounter
.
get
(
groupId
);
if
(
groupId
==
7
)
{
int
i
=
0
;
}
List
<
Entry
>
orderOps
=
new
ArrayList
<>();
boolean
orderIsJit
=
orderDueDate
.
get
(
groupId
)>
0
;
...
...
@@ -770,6 +774,9 @@ if(groupId==7)
}
Entry
currentOp
=
orderOps
.
get
(
scheduledCount
);
int
opSequence
=
currentOp
.
getSequence
();
GAScheduleResult
existingResult
=
chromosome
.
getResultOld
().
stream
()
...
...
@@ -792,7 +799,7 @@ if(groupId==7)
boolean
opIsJit
=
orderIsJit
||(
Entry
.
SchedulingMode
.
BACKWARD
.
name
().
equals
(
currentOp
.
getSchedulingMode
())&&
orderAnchor
>
=
0
);
currentOp
.
getSchedulingMode
())&&
orderAnchor
>
0
);
int
dueDateForOp
=
opIsJit
?
orderAnchor
:
(
schedInfo
!=
null
?
schedInfo
.
getValue
()
:
0
);
...
...
@@ -800,6 +807,7 @@ if(groupId==7)
machineOption
,
chromosome
,
machineIdMap
,
machineTasksCache
,
entryIndexById
,
scheduleIndexById
,
dueDateForOp
,
0
,
true
,
opIsJit
);
if
(
operationResult
.
isForwardFallbackRequired
())
{
// 倒排失败时只修复当前工序及其后道已排工序。
// 例如倒排顺序 3->2->1,2 放不下时撤回 2、3,再按 2->3 放到各自设备最后任务之后。
List
<
Integer
>
removeOp
=
clearOrderSchedulingFromSequence
(
chromosome
,
groupId
,
opSequence
,
...
...
@@ -841,6 +849,7 @@ if(groupId==7)
orderProcessCounter
.
put
(
groupId
,
orderProcessCounter
.
get
(
groupId
)
+
1
);
orderLastEndTime
.
put
(
groupId
,
actualEndTime
);
if
(
orderProcessCounter
.
get
(
groupId
)
>=
entrysBygroupId
.
get
(
groupId
).
size
())
{
// if (jitDeferredBomOrderIds.remove(groupId)) {
// entrysBygroupId.get(groupId).stream()
...
...
@@ -869,6 +878,10 @@ if(groupId==7)
}
}
}
}
if
(
chromosome
.
getReOrderids
()!=
null
&&
chromosome
.
getReOrderids
().
size
()>
0
)
{
chromosome
.
getOperationSequencing
().
removeIf
(
t
->
chromosome
.
getReOrderids
().
contains
(
t
));
...
...
@@ -876,6 +889,14 @@ if(groupId==7)
long
calcStart
=
System
.
nanoTime
();
calculateScheduleResult
(
chromosome
);
// FileHelper.writeLogFile("[PERF] serialDecode calculateScheduleResult 耗时=" + fmtMs(System.nanoTime() - calcStart));
// FileHelper.writeLogFile("[PERF] serialDecode 总耗时=" + fmtMs(System.nanoTime() - decodeStart) + ", 工序数=" + opCount + ", 全局工序数=" + globalOpList.size());
}
...
...
src/main/java/com/aps/service/Algorithm/HybridAlgorithm.java
View file @
d316b05b
...
...
@@ -460,7 +460,7 @@ public class HybridAlgorithm {
FileHelper
.
writeLogFile
(
"解码---------------"
+
population
.
size
()
);
// GeneticDecoder decoder = new GeneticDecoder(_GlobalParam, param.getBaseTime(), machines, orders, materials, machineScheduler,materialRequirementService, sceneId);
boolean
ismore
=
tru
e
;
boolean
ismore
=
fals
e
;
if
(
ismore
)
{
CompletableFuture
.
allOf
(
population
.
stream
()
.
map
(
chromosome
->
CompletableFuture
.
runAsync
(()
->
decode
(
sharedDecoder
,
chromosome
,
param
,
allOperations
,
globalOpList
),
decodeExecutor
))
...
...
src/main/java/com/aps/service/plan/PlanResultService.java
View file @
d316b05b
...
...
@@ -295,7 +295,7 @@ public class PlanResultService {
throw
new
BusinessException
(
"排产计算结果保存失败,请稍后重试或联系管理员"
);
}
WriteScheduleSummary
(
chromosome
);
//
WriteScheduleSummary(chromosome);
return
chromosome
;
...
...
src/test/java/com/aps/demo/PlanResultServiceTest.java
View file @
d316b05b
...
...
@@ -44,6 +44,8 @@ public class PlanResultServiceTest {
// planResultService.execute2("64E64F6B68094AF38CEDC418630C3CC2");//2000
// planResultService.execute2("E1448B3C9C8743DEAB39708F2CFE348A");//倒排bomces
planResultService
.
execute2
(
"197083D0D26A449EB179AC103C753FD3"
);
// planResultService.execute2("9FEDFD92BB6A4675BF9B1CC64505D1AB");
// planResultService.execute2("15210B13B88A453F8B84AAC7F16C7541");//2000
// planResultService.execute2("E29F2B3ADA8149F6B916B5119296A92B");//2000
...
...
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