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
539b80b3
Commit
539b80b3
authored
Apr 21, 2026
by
Tong Li
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/tl'
parents
73a7b529
b9dc6d43
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
138 additions
and
127 deletions
+138
-127
GeneticDecoder.java
src/main/java/com/aps/service/Algorithm/GeneticDecoder.java
+2
-1
HillClimbing.java
src/main/java/com/aps/service/Algorithm/HillClimbing.java
+7
-3
HybridAlgorithm.java
src/main/java/com/aps/service/Algorithm/HybridAlgorithm.java
+2
-2
PlanResultService.java
src/main/java/com/aps/service/plan/PlanResultService.java
+124
-118
PlanResultServiceTest.java
src/test/java/com/aps/demo/PlanResultServiceTest.java
+3
-3
No files found.
src/main/java/com/aps/service/Algorithm/GeneticDecoder.java
View file @
539b80b3
...
...
@@ -58,7 +58,7 @@ public class GeneticDecoder {
private
DiscreteParameterMatrixService
discreteParameterMatrixService
;
private
String
sceneId
;
private
boolean
rebuildStructureForCurrentDecode
=
tru
e
;
private
boolean
rebuildStructureForCurrentDecode
=
fals
e
;
...
...
@@ -1107,6 +1107,7 @@ public class GeneticDecoder {
int
setupTime
=
0
;
long
machineId
=
machine
.
getId
();
boolean
needMaterialCheck
=
(
operation
.
getMaterialRequirements
()!=
null
&&
operation
.
getMaterialRequirements
().
size
()>
0
&&
operation
.
getTargetFinishedOperationId
()==
null
)||
calbom
;
needMaterialCheck
=
false
;
boolean
commitMaterialCheck
=
needMaterialCheck
;
int
baseEarliestStartTime
=
earliestStartTime
;
int
candidateStartTime
=
earliestStartTime
;
...
...
src/main/java/com/aps/service/Algorithm/HillClimbing.java
View file @
539b80b3
...
...
@@ -86,7 +86,7 @@ public class HillClimbing {
// 构建位置到Entry的映射:position -> Entry
Map
<
Integer
,
Entry
>
entryIndex
=
buildEntryIndex
(
current
,
entrys
);
boolean
improved
=
tru
e
;
boolean
improved
=
fals
e
;
for
(
Double
priority
:
sortedPriorities
)
{
List
<
Entry
>
priorityOps
=
priorityGroups
.
get
(
priority
);
if
(
priorityOps
.
isEmpty
())
{
...
...
@@ -107,6 +107,7 @@ public class HillClimbing {
Chromosome
machineChange
=
generateMachineChange
(
current
,
op
.
getMachineOptions
(),
maPos
);
if
(
machineChange
!=
null
)
{
decode
(
decoder
,
machineChange
,
machines
);
writeKpi
(
machineChange
);
if
(
isBetter
(
machineChange
,
current
))
{
current
=
machineChange
;
if
(
isBetter
(
current
,
best
))
{
...
...
@@ -125,7 +126,7 @@ public class HillClimbing {
if
(
improved
)
break
;
}
if
(
improved
)
continue
;
// 2. 检查是否是单一订单(如果只有一个订单,不需要交换位置
Set
<
Integer
>
groupIds
=
priorityOps
.
stream
()
...
...
@@ -312,6 +313,8 @@ public class HillClimbing {
// 根据当前优先级的工序数确定迭代次数和step
int
priorityIterations
=
Math
.
max
(
5
,
priorityOps
.
size
()
/
2
);
priorityIterations
=
Math
.
min
(
priorityIterations
,
priorityOps
.
size
());
// 200/10 =20
// 1
int
step
=
Math
.
max
(
1
,
(
int
)
Math
.
ceil
(
priorityOps
.
size
()
/
10.0
));
...
...
@@ -422,6 +425,7 @@ public class HillClimbing {
}
for
(
int
i
=
0
;
i
<
candidates
.
size
();
i
++)
{
Chromosome
candidate
=
candidates
.
get
(
i
);
writeKpi
(
candidate
);
if
(
isBetter
(
candidate
,
best
))
{
bestidx
=
i
;
}
...
...
@@ -439,7 +443,7 @@ public class HillClimbing {
fitness
+=
fitness1
[
i
]
+
","
;
}
FileHelper
.
writeLogFile
(
String
.
format
(
"爬山法
- kpi:%s"
,
fitness
));
FileHelper
.
writeLogFile
(
String
.
format
(
"爬山法
%s - kpi:%s"
,
chromosome
.
getGeneStr
()
,
fitness
));
}
/**
...
...
src/main/java/com/aps/service/Algorithm/HybridAlgorithm.java
View file @
539b80b3
...
...
@@ -119,7 +119,7 @@ int opcount=allOperations.size();
FileHelper
.
writeLogFile
(
"构造启发式初始化-----------结束-------"
);
population
=
chromosomeDistinct
(
population
);
population
=
chromosomeDistinct
(
population
)
.
subList
(
0
,
1
)
;
...
...
@@ -457,7 +457,7 @@ int opcount=allOperations.size();
FileHelper
.
writeLogFile
(
"解码---------------"
+
population
.
size
()
);
GeneticDecoder
decoder
=
new
GeneticDecoder
(
_GlobalParam
,
param
.
getBaseTime
(),
machines
,
orders
,
materials
,
machineScheduler
,
materialRequirementService
,
sceneId
);
boolean
ismore
=
fals
e
;
boolean
ismore
=
tru
e
;
if
(
ismore
)
{
CompletableFuture
.
allOf
(
population
.
stream
()
.
map
(
chromosome
->
CompletableFuture
.
runAsync
(()
->
decode
(
decoder
,
chromosome
,
param
,
allOperations
,
globalOpList
),
decodeExecutor
))
...
...
src/main/java/com/aps/service/plan/PlanResultService.java
View file @
539b80b3
This diff is collapsed.
Click to expand it.
src/test/java/com/aps/demo/PlanResultServiceTest.java
View file @
539b80b3
...
...
@@ -42,9 +42,9 @@ public class PlanResultServiceTest {
// planResultService.execute2("E29F2B3ADA8149F6B916B5119296A92B");//2000
// planResultService.execute2("E2CD1FC6FF9B4B19A59FEC7F846D4952");//600
planResultService
.
execute2
(
"EAF3C94B8F3345278F226C94FB0FED86"
);
//bom
// planResultService.execute2("08B1D87FE1B84ECDBAC2E546DDB6FB81
");//2000
// planResultService.execute2("
0428340BB4F540938F1FB5599F03E8A4
");//5000
//
planResultService.execute2("EAF3C94B8F3345278F226C94FB0FED86");//bom
planResultService
.
execute2
(
"6D63146BE5C84A78B5AB044327BA55BD
"
);
//2000
// planResultService.execute2("
6D63146BE5C84A78B5AB044327BA55BD
");//5000
// planResultService.execute2("C8B533BD8944405B9A2F8823C575C204");//500
// planResultService.execute2("EFDD34E4B5BC434BAEAE6A84DFCD4E7B");//20
// planResultService.execute2("00E0C5D3E4AD4F36B56C39395906618D");
...
...
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