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
2fe0847f
Commit
2fe0847f
authored
Dec 01, 2025
by
Tong Li
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
遗传算法
parent
f7bdf363
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
62 additions
and
7 deletions
+62
-7
GeneticDecoder.java
src/main/java/com/aps/service/Algorithm/GeneticDecoder.java
+2
-0
MachineCalculator.java
...ain/java/com/aps/service/Algorithm/MachineCalculator.java
+1
-1
ScheduleUpdater.java
src/main/java/com/aps/service/Algorithm/ScheduleUpdater.java
+9
-0
MachineSchedulerService.java
...in/java/com/aps/service/plan/MachineSchedulerService.java
+2
-1
PlanResultService.java
src/main/java/com/aps/service/plan/PlanResultService.java
+48
-5
No files found.
src/main/java/com/aps/service/Algorithm/GeneticDecoder.java
View file @
2fe0847f
...
...
@@ -303,6 +303,7 @@ public class GeneticDecoder {
// 冲突检测和解决
final
int
finalStartTime
=
startTime
;
final
int
finalEndTime
=
endTime
;
GAScheduleResult
conflictingGene
=
chromosome
.
getResult
().
stream
()
.
filter
(
g
->
g
.
getMachineId
()
==
machine
.
getId
())
.
filter
(
g
->
(
finalStartTime
<
g
.
getEndTime
()
&&
finalEndTime
>
g
.
getStartTime
()))
...
...
@@ -315,6 +316,7 @@ public class GeneticDecoder {
int
conflictSetupTime
=
calculateSetupTimeForConflict
(
chromosome
.
getResult
(),
operation
,
machine
,
machineOption
,
conflictingGene
);
int
conflictEarliestStartTime
=
conflictSetupStartTime
+
conflictSetupTime
;
machineCalculator
.
AddMachineAvailable
(
machine
,
geneDetails
);
geneDetails
=
machineCalculator
.
getNextAvailableTime
(
machine
,
conflictEarliestStartTime
,
-
1
,
processingTimeTotal
,
chromosome
.
getResult
(),
false
,
true
,
true
);
...
...
src/main/java/com/aps/service/Algorithm/MachineCalculator.java
View file @
2fe0847f
...
...
@@ -254,7 +254,7 @@ public class MachineCalculator {
machine
.
getAvailability
().
sort
(
Comparator
.
comparing
(
TimeSegment:
:
getStart
));
}
p
rivate
void
AddMachineAvailable
(
Machine
machine
,
List
<
ScheduleResultDetail
>
geneDetails
)
{
p
ublic
void
AddMachineAvailable
(
Machine
machine
,
List
<
ScheduleResultDetail
>
geneDetails
)
{
if
(
geneDetails
==
null
||
geneDetails
.
isEmpty
())
return
;
for
(
ScheduleResultDetail
detail
:
geneDetails
)
{
...
...
src/main/java/com/aps/service/Algorithm/ScheduleUpdater.java
0 → 100644
View file @
2fe0847f
package
com
.
aps
.
service
.
Algorithm
;
/**
* 作者:佟礼
* 时间:2025-11-30
*/
public
class
ScheduleUpdater
{
}
src/main/java/com/aps/service/plan/MachineSchedulerService.java
View file @
2fe0847f
...
...
@@ -207,8 +207,9 @@ public class MachineSchedulerService {
&&
containsDay
(
s
.
getDays
(),
date
.
getDayOfWeek
()))
.
collect
(
Collectors
.
toList
());
if
(
shifts
==
null
||
shifts
.
size
()==
0
)
{
LocalDate
sd
=
LocalDate
.
of
(
2020
,
10
,
1
);
shifts
=
machine
.
getShifts
().
stream
()
.
filter
(
s
->
s
.
getDays
()
!=
null
.
filter
(
s
->
sd
.
compareTo
(
s
.
getStartDate
().
toLocalDate
())==
0
&&
s
.
getDays
()
!=
null
&&
containsDay
(
s
.
getDays
(),
date
.
getDayOfWeek
()))
.
collect
(
Collectors
.
toList
());
}
...
...
src/main/java/com/aps/service/plan/PlanResultService.java
View file @
2fe0847f
...
...
@@ -54,6 +54,10 @@ public class PlanResultService {
@Autowired
private
ProdEquipmentService
_prodEquipmentService
;
@Autowired
private
PlanResourceService
_PlanResourceService
;
@Autowired
private
ProdOrderProcessService
_prodOrderProcessService
;
...
...
@@ -286,9 +290,6 @@ public class PlanResultService {
}
public
void
WriteScheduleSummary
(
Chromosome
schedule
)
{
// 写入日志
FileHelper
.
writeLogFile
(
String
.
format
(
"\n=== Schedule Summary === %f"
,
schedule
.
getFitness
()));
...
...
@@ -415,10 +416,16 @@ public class PlanResultService {
LambdaQueryWrapper
<
ProdEquipSpecialCal
>
ProdEquipSpecialCalWrapper
=
new
LambdaQueryWrapper
<>();
ProdEquipSpecialCalWrapper
.
eq
(
ProdEquipSpecialCal:
:
getSceneId
,
SceneId
);
List
<
PlanResource
>
PlanResources
=
_PlanResourceService
.
lambdaQuery
()
.
eq
(
PlanResource:
:
getIsdeleted
,
0
)
.
list
();
List
<
ProdEquipSpecialCal
>
ProdEquipSpecialCals
=
_prodEquipSpecialCalService
.
list
(
ProdEquipSpecialCalWrapper
);
List
<
MesShiftWorkSched
>
MesShiftWorkScheds
=
_MesShiftWorkSchedService
.
list
();
List
<
MesShiftWorkSched
>
MesShiftWorkScheds
=
_MesShiftWorkSchedService
.
lambdaQuery
()
.
eq
(
MesShiftWorkSched:
:
getIsdeleted
,
0
).
list
();
if
(
machines
==
null
)
{
...
...
@@ -431,7 +438,7 @@ public class PlanResultService {
machine
.
setMaintenanceWindows
(
new
ArrayList
<>());
}
List
<
ProdEquipSpecialCal
>
machineProdEquipSpecialCals
=
ProdEquipSpecialCals
.
stream
()
.
filter
(
t
->
t
.
getEquipId
()
==
machine
.
getId
())
.
filter
(
t
->
t
.
getEquipId
()
==
machine
.
getId
()
&&
t
.
getReferenceType
()==
1
)
.
collect
(
Collectors
.
toList
());
List
<
Shift
>
shifts1
=
new
ArrayList
<>();
for
(
ProdEquipSpecialCal
machineProdEquipSpecialCal
:
machineProdEquipSpecialCals
)
{
...
...
@@ -448,8 +455,44 @@ public class PlanResultService {
shifts1
.
add
(
shift
);
}
}
List
<
PlanResource
>
PlanResources1
=
PlanResources
.
stream
()
.
filter
(
t
->
t
.
getReferenceId
()
==
machine
.
getId
())
.
collect
(
Collectors
.
toList
());
if
(
PlanResources1
!=
null
&&
PlanResources1
.
size
()>
0
)
{
for
(
PlanResource
PlanResource
:
PlanResources1
)
{
List
<
MesShiftWorkSched
>
ShiftWorkScheds
=
MesShiftWorkScheds
.
stream
()
.
filter
(
t
->
(
long
)
t
.
getWeekWorkSchedId
()
==
PlanResource
.
getWorkSchedId
())
.
collect
(
Collectors
.
toList
());
List
<
Shift
>
Shifts
=
mergeShiftData
(
ShiftWorkScheds
);
for
(
Shift
shift
:
Shifts
)
{
shift
.
setMachineId
(
machine
.
getId
());
shift
.
setStartDate
(
LocalDateTime
.
of
(
2000
,
1
,
1
,
0
,
0
,
0
));
shift
.
setEndDate
(
LocalDateTime
.
of
(
2000
,
1
,
1
,
0
,
0
,
0
));
shifts1
.
add
(
shift
);
}
}
}
machine
.
setShifts
(
shifts1
);
List
<
ProdEquipSpecialCal
>
Holidays
=
ProdEquipSpecialCals
.
stream
()
.
filter
(
t
->
t
.
getEquipId
()
==
machine
.
getId
()&&
t
.
getReferenceType
()==
2
)
.
collect
(
Collectors
.
toList
());
List
<
Holiday
>
Holidays1
=
new
ArrayList
<>();
for
(
ProdEquipSpecialCal
machineProdEquipSpecialCal
:
Holidays
)
{
Holiday
holiday
=
new
Holiday
();
holiday
.
setStart
(
machineProdEquipSpecialCal
.
getStartDate
());
holiday
.
setEnd
(
machineProdEquipSpecialCal
.
getEndDate
());
Holidays1
.
add
(
holiday
);
}
machine
.
setHolidays
(
Holidays1
);
}
...
...
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