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
82288acd
Commit
82288acd
authored
Apr 20, 2026
by
Tong Li
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/tl'
parents
6ad77e5d
bd586664
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
47 additions
and
14 deletions
+47
-14
GeneticDecoder.java
src/main/java/com/aps/service/Algorithm/GeneticDecoder.java
+15
-1
HybridAlgorithm.java
src/main/java/com/aps/service/Algorithm/HybridAlgorithm.java
+1
-1
RoutingDataService.java
...in/java/com/aps/service/Algorithm/RoutingDataService.java
+9
-1
VariableNeighborhoodSearch.java
...com/aps/service/Algorithm/VariableNeighborhoodSearch.java
+21
-10
PlanResultServiceTest.java
src/test/java/com/aps/demo/PlanResultServiceTest.java
+1
-1
No files found.
src/main/java/com/aps/service/Algorithm/GeneticDecoder.java
View file @
82288acd
...
@@ -58,7 +58,7 @@ public class GeneticDecoder {
...
@@ -58,7 +58,7 @@ public class GeneticDecoder {
private
DiscreteParameterMatrixService
discreteParameterMatrixService
;
private
DiscreteParameterMatrixService
discreteParameterMatrixService
;
private
String
sceneId
;
private
String
sceneId
;
private
boolean
rebuildStructureForCurrentDecode
=
fals
e
;
private
boolean
rebuildStructureForCurrentDecode
=
tru
e
;
...
@@ -405,6 +405,7 @@ public class GeneticDecoder {
...
@@ -405,6 +405,7 @@ public class GeneticDecoder {
chromosome
.
setScenarioID
(
sceneId
);
chromosome
.
setScenarioID
(
sceneId
);
if
(
rebuildStructureForCurrentDecode
)
{
if
(
rebuildStructureForCurrentDecode
)
{
//创建半成品订单
materialRequirementService
.
buildMultiLevelRequirementNetwork
(
chromosome
,
sceneId
,
baseTime
,
_globalParam
);
materialRequirementService
.
buildMultiLevelRequirementNetwork
(
chromosome
,
sceneId
,
baseTime
,
_globalParam
);
}
}
...
@@ -588,6 +589,19 @@ public class GeneticDecoder {
...
@@ -588,6 +589,19 @@ public class GeneticDecoder {
public
void
parallelDecodeByMachine
(
Chromosome
chromosome
)
{
public
void
parallelDecodeByMachine
(
Chromosome
chromosome
)
{
if
(
rebuildStructureForCurrentDecode
)
{
//创建半成品订单
materialRequirementService
.
buildMultiLevelRequirementNetwork
(
chromosome
,
sceneId
,
baseTime
,
_globalParam
);
}
if
(
rebuildStructureForCurrentDecode
&&
_globalParam
.
isIsCheckSf
())
{
int
isnew
=
generateGlobalOpList
(
chromosome
);
if
(
isnew
==
1
)
{
CreateNewOpSequence
(
chromosome
);
}
}
// 1. 获取工序处理顺序
// 1. 获取工序处理顺序
List
<
Integer
>
operationSequencing
=
chromosome
.
getOperationSequencing
();
List
<
Integer
>
operationSequencing
=
chromosome
.
getOperationSequencing
();
...
...
src/main/java/com/aps/service/Algorithm/HybridAlgorithm.java
View file @
82288acd
...
@@ -456,7 +456,7 @@ int opcount=allOperations.size();
...
@@ -456,7 +456,7 @@ int opcount=allOperations.size();
FileHelper
.
writeLogFile
(
"解码---------------"
+
population
.
size
()
);
FileHelper
.
writeLogFile
(
"解码---------------"
+
population
.
size
()
);
GeneticDecoder
decoder
=
new
GeneticDecoder
(
_GlobalParam
,
param
.
getBaseTime
(),
machines
,
orders
,
materials
,
machineScheduler
,
materialRequirementService
,
sceneId
);
GeneticDecoder
decoder
=
new
GeneticDecoder
(
_GlobalParam
,
param
.
getBaseTime
(),
machines
,
orders
,
materials
,
machineScheduler
,
materialRequirementService
,
sceneId
);
boolean
ismore
=
tru
e
;
boolean
ismore
=
fals
e
;
if
(
ismore
)
{
if
(
ismore
)
{
CompletableFuture
.
allOf
(
population
.
stream
()
CompletableFuture
.
allOf
(
population
.
stream
()
.
map
(
chromosome
->
CompletableFuture
.
runAsync
(()
->
decode
(
decoder
,
chromosome
,
param
,
allOperations
,
globalOpList
),
decodeExecutor
))
.
map
(
chromosome
->
CompletableFuture
.
runAsync
(()
->
decode
(
decoder
,
chromosome
,
param
,
allOperations
,
globalOpList
),
decodeExecutor
))
...
...
src/main/java/com/aps/service/Algorithm/RoutingDataService.java
View file @
82288acd
...
@@ -242,7 +242,15 @@ public class RoutingDataService {
...
@@ -242,7 +242,15 @@ public class RoutingDataService {
List
<
MachineOption
>
mos
=
new
ArrayList
<>();
List
<
MachineOption
>
mos
=
new
ArrayList
<>();
for
(
ProdEquipment
e
:
Equipments
)
{
for
(
ProdEquipment
e
:
Equipments
)
{
Double
totalprocessTime
=
e
.
getSpeed
()/
e
.
getSingleOut
().
doubleValue
()*
entry
.
getQuantity
();
Double
totalprocessTime
=
0
d
;
if
(
op
.
getConstTime
()==
1
)
//常数时间
{
totalprocessTime
=
e
.
getSpeed
();
}
else
{
totalprocessTime
=
e
.
getSpeed
()/
e
.
getSingleOut
().
doubleValue
()*
entry
.
getQuantity
();
}
if
(
machineIds
.
containsKey
(
e
.
getEquipId
()))
if
(
machineIds
.
containsKey
(
e
.
getEquipId
()))
{
{
if
(
machineIds
.
get
(
e
.
getEquipId
())<
totalprocessTime
)
if
(
machineIds
.
get
(
e
.
getEquipId
())<
totalprocessTime
)
...
...
src/main/java/com/aps/service/Algorithm/VariableNeighborhoodSearch.java
View file @
82288acd
...
@@ -646,9 +646,15 @@ public class VariableNeighborhoodSearch {
...
@@ -646,9 +646,15 @@ public class VariableNeighborhoodSearch {
Entry
entry1
=
entrybyids
.
get
(
op1
.
getOperationId
());
Entry
entry1
=
entrybyids
.
get
(
op1
.
getOperationId
());
Entry
entry2
=
entrybyids
.
get
(
op2
.
getOperationId
());
Entry
entry2
=
entrybyids
.
get
(
op2
.
getOperationId
());
if
(
entry1
==
null
||
entry2
==
null
)
{
if
(
entry1
==
null
&&
entry2
==
null
)
{
return
0
;
return
0
;
}
}
if
(
entry1
==
null
)
{
return
1
;
}
if
(
entry2
==
null
)
{
return
-
1
;
}
int
size1
=
priorityToGroupIds
.
getOrDefault
(
entry1
.
getPriority
(),
new
HashSet
<>()).
size
();
int
size1
=
priorityToGroupIds
.
getOrDefault
(
entry1
.
getPriority
(),
new
HashSet
<>()).
size
();
int
size2
=
priorityToGroupIds
.
getOrDefault
(
entry2
.
getPriority
(),
new
HashSet
<>()).
size
();
int
size2
=
priorityToGroupIds
.
getOrDefault
(
entry2
.
getPriority
(),
new
HashSet
<>()).
size
();
...
@@ -1700,7 +1706,7 @@ public class VariableNeighborhoodSearch {
...
@@ -1700,7 +1706,7 @@ public class VariableNeighborhoodSearch {
private
Chromosome
generateReverseNeighbor
(
Chromosome
chromosome
,
Map
<
Integer
,
Entry
>
positionIndex
,
List
<
List
<
Integer
>>
positionByPriority
)
{
private
Chromosome
generateReverseNeighbor
(
Chromosome
chromosome
,
Map
<
Integer
,
Entry
>
positionIndex
,
List
<
List
<
Integer
>>
positionByPriority
)
{
Chromosome
neighbor
=
copyChromosome
(
chromosome
);
//ProductionDeepCopyUtil.deepCopy(chromosome, Chromosome.class);
Chromosome
neighbor
=
copyChromosome
(
chromosome
);
//ProductionDeepCopyUtil.deepCopy(chromosome, Chromosome.class);
List
<
Integer
>
os
=
neighbor
.
getOperationSequencing
();
List
<
Integer
>
os
=
neighbor
.
getOperationSequencing
();
if
(
os
.
size
()
>=
2
)
{
if
(
os
.
size
()
>=
2
&&
positionByPriority
.
size
()>
0
)
{
// Map<Integer, Entry> positionIndex = buildPositionToEntryIndex(neighbor);
// Map<Integer, Entry> positionIndex = buildPositionToEntryIndex(neighbor);
int
maxAttempts
=
50
;
int
maxAttempts
=
50
;
...
@@ -1771,7 +1777,7 @@ public class VariableNeighborhoodSearch {
...
@@ -1771,7 +1777,7 @@ public class VariableNeighborhoodSearch {
private
Chromosome
generateInsertNeighbor
(
Chromosome
chromosome
,
Map
<
Integer
,
Entry
>
positionIndex
,
List
<
List
<
Integer
>>
positionByPriority
)
{
private
Chromosome
generateInsertNeighbor
(
Chromosome
chromosome
,
Map
<
Integer
,
Entry
>
positionIndex
,
List
<
List
<
Integer
>>
positionByPriority
)
{
Chromosome
neighbor
=
copyChromosome
(
chromosome
);
// ProductionDeepCopyUtil.deepCopy(chromosome, Chromosome.class);
Chromosome
neighbor
=
copyChromosome
(
chromosome
);
// ProductionDeepCopyUtil.deepCopy(chromosome, Chromosome.class);
List
<
Integer
>
os
=
neighbor
.
getOperationSequencing
();
List
<
Integer
>
os
=
neighbor
.
getOperationSequencing
();
if
(
os
.
size
()
>=
2
)
{
if
(
os
.
size
()
>=
2
&&
positionByPriority
.
size
()>
0
)
{
// Map<Integer, Entry> positionIndex = buildPositionToEntryIndex(neighbor);
// Map<Integer, Entry> positionIndex = buildPositionToEntryIndex(neighbor);
int
maxAttempts
=
50
;
int
maxAttempts
=
50
;
...
@@ -1840,7 +1846,7 @@ public class VariableNeighborhoodSearch {
...
@@ -1840,7 +1846,7 @@ public class VariableNeighborhoodSearch {
for
(
int
i
=
1
;
i
<=
op
.
getMachineOptions
().
size
();
i
++)
{
for
(
int
i
=
1
;
i
<=
op
.
getMachineOptions
().
size
();
i
++)
{
if
(
i
!=
currentMachineSeq
)
{
if
(
i
!=
currentMachineSeq
)
{
availableMachines
.
add
(
i
);
availableMachines
.
add
(
i
);
machineOptions
.
add
(
op
.
getMachineOptions
().
get
(
i
));
machineOptions
.
add
(
op
.
getMachineOptions
().
get
(
i
-
1
));
}
}
}
}
...
@@ -2167,15 +2173,20 @@ public class VariableNeighborhoodSearch {
...
@@ -2167,15 +2173,20 @@ public class VariableNeighborhoodSearch {
}
}
groupidByPriority
.
entrySet
().
removeIf
(
entry
->
entry
.
getValue
().
size
()
==
1
);
groupidByPriority
.
entrySet
().
removeIf
(
entry
->
entry
.
getValue
().
size
()
==
1
);
// if(groupidByPriority.size()!=0)
// {
indexByPriorityMap
.
keySet
().
removeIf
(
key
->
!
groupidByPriority
.
containsKey
(
key
));
indexByPriorityMap
.
keySet
().
removeIf
(
key
->
!
groupidByPriority
.
containsKey
(
key
));
//}
List
<
Map
.
Entry
<
Double
,
List
<
Integer
>>>
sortedEntries
=
new
ArrayList
<>(
indexByPriorityMap
.
entrySet
());
List
<
Map
.
Entry
<
Double
,
List
<
Integer
>>>
sortedEntries
=
new
ArrayList
<>(
indexByPriorityMap
.
entrySet
());
// if(groupidByPriority.size()!=0) {
sortedEntries
.
sort
((
e1
,
e2
)
->
{
sortedEntries
.
sort
((
e1
,
e2
)
->
{
int
size1
=
groupidByPriority
.
get
(
e1
.
getKey
()).
size
();
int
size1
=
groupidByPriority
.
get
(
e1
.
getKey
()).
size
();
int
size2
=
groupidByPriority
.
get
(
e2
.
getKey
()).
size
();
int
size2
=
groupidByPriority
.
get
(
e2
.
getKey
()).
size
();
return
Integer
.
compare
(
size2
,
size1
);
// 降序:订单数多的排前面
return
Integer
.
compare
(
size2
,
size1
);
// 降序:订单数多的排前面
});
});
// }
List
<
List
<
Integer
>>
indexByPriority
=
new
ArrayList
<>();
List
<
List
<
Integer
>>
indexByPriority
=
new
ArrayList
<>();
for
(
Map
.
Entry
<
Double
,
List
<
Integer
>>
entry
:
sortedEntries
)
{
for
(
Map
.
Entry
<
Double
,
List
<
Integer
>>
entry
:
sortedEntries
)
{
...
...
src/test/java/com/aps/demo/PlanResultServiceTest.java
View file @
82288acd
...
@@ -42,7 +42,7 @@ public class PlanResultServiceTest {
...
@@ -42,7 +42,7 @@ public class PlanResultServiceTest {
// planResultService.execute2("E29F2B3ADA8149F6B916B5119296A92B");//2000
// planResultService.execute2("E29F2B3ADA8149F6B916B5119296A92B");//2000
planResultService
.
execute2
(
"E2CD1FC6FF9B4B19A59FEC7F846D4952"
);
//600
planResultService
.
execute2
(
"E2CD1FC6FF9B4B19A59FEC7F846D4952"
);
//600
// planResultService.execute2("EAA0E2D70BC94EEDA2E5A4597BE69523");//bom
// planResultService.execute2("08B1D87FE1B84ECDBAC2E546DDB6FB81");//2000
// planResultService.execute2("08B1D87FE1B84ECDBAC2E546DDB6FB81");//2000
// planResultService.execute2("0428340BB4F540938F1FB5599F03E8A4");//5000
// planResultService.execute2("0428340BB4F540938F1FB5599F03E8A4");//5000
// planResultService.execute2("C8B533BD8944405B9A2F8823C575C204");//500
// planResultService.execute2("C8B533BD8944405B9A2F8823C575C204");//500
...
...
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